Files
spacedrive/interface/app/$libraryId/settings/Setting.tsx
Vítor Vasconcellos 8a9d690aab Fix autoformat CI & format codebase (#2581)
* Update pnpm version

* Fix autoformat

* Improve autoformat msg

* Attempt to fix autoformat 2

* Fix autoformat

* Ignore deleted files in auto-format

* Fix diff filter

* Autoformat whole codebase

* Improve error message for autoformat CI

* Test autoformat CI

* Revert "Test autoformat CI"

This reverts commit 0bf2f46d1a.
2024-07-04 08:57:43 +00:00

52 lines
1.5 KiB
TypeScript

import { Info } from '@phosphor-icons/react';
import clsx from 'clsx';
import { PropsWithChildren, ReactNode } from 'react';
import { ErrorMessage, Tooltip } from '@sd/ui';
import { usePlatform } from '~/util/Platform';
interface Props {
title: ReactNode;
registerName?: string;
description?: string | JSX.Element;
mini?: boolean;
className?: string;
containerClassName?: string;
toolTipLabel?: string | boolean;
infoUrl?: string;
}
export default ({ mini, registerName, ...props }: PropsWithChildren<Props>) => {
const platform = usePlatform();
if (typeof props.description === 'string')
props.description = <p className="mb-2 text-sm text-gray-400">{props.description}</p>;
return (
<>
<div className={clsx('relative flex flex-row', props.containerClassName)}>
<div className={clsx('flex w-full flex-col', !mini && 'pb-6', props.className)}>
<div className="mb-1 flex items-center gap-1">
<h3 className="text-sm font-medium text-ink">{props.title}</h3>
{props.toolTipLabel && (
<Tooltip label={props.toolTipLabel as string}>
<Info
onClick={() =>
props.infoUrl && platform.openLink(props.infoUrl)
}
size={15}
/>
</Tooltip>
)}
</div>
<div className="w-[85%]">{props.description}</div>
{!mini && props.children}
</div>
{mini && props.children}
</div>
{registerName ? (
<ErrorMessage name={registerName} className="mt-1 w-full text-xs" />
) : null}
</>
);
};