Files
frigate/web/src/components/ui/text.tsx
T
Josh HawkinsandGitHub cabdffea20 Update more web deps and reformat with updated prettier (#24358)
* update date-fns, i18next, react-dropzone, react-markdown and @types/node

react-i18next 17 peers `i18next >= 26.2.0`, so the two move together. react-day-picker already depends on date-fns 4, so date-fns now dedupes to a single copy. react-dropzone 20 declares `node >=22` in `engines`, but npm only warns on Node 20 and nothing in the build needs Node 22.

* update js-yaml, @hookform/resolvers and prettier

js-yaml 5 has no default export, so `DictAsYamlField` imports `dump`, `load` and `YAMLException` by name. @hookform/resolvers 5 types `zodResolver` with the schema's input and output types separately, and fields with defaults are optional on input, so the zone and classification model forms pass both types to `useForm`. zod's range now starts at 3.25, which resolvers 5 requires.

* format with prettier 3.9
2026-09-15 15:18:49 -06:00

71 lines
1.6 KiB
TypeScript

import { cn } from "@/lib/utils";
type TextElements =
"p" | "blockquote" | "code" | "lead" | "large" | "small" | "muted";
const Text = ({
children,
as,
className,
}: {
children: React.ReactNode;
as: TextElements;
className?: string;
}) => {
switch (as) {
case "p":
return (
<p className={cn("leading-7 [&:not(:first-child)]:mt-6", className)}>
{children}
</p>
);
case "blockquote":
return (
<blockquote className={cn("mt-6 border-l-2 pl-6 italic", className)}>
{children}
</blockquote>
);
case "code":
return (
<code
className={cn(
"relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
className,
)}
>
{children}
</code>
);
case "lead":
return (
<p className={cn("text-xl text-muted-foreground", className)}>
{children}
</p>
);
case "large":
return (
<div className={cn("text-lg font-semibold", className)}>{children}</div>
);
case "small":
return (
<small className={cn("text-sm font-medium leading-none", className)}>
{children}
</small>
);
case "muted":
return (
<p className={cn("text-sm text-muted-foreground", className)}>
{children}.
</p>
);
default:
return (
<p className={cn("leading-7 [&:not(:first-child)]:mt-6", className)}>
{children}
</p>
);
}
};
export default Text;