prod setup
This commit is contained in:
17
src/components/admin/fields/FieldError.tsx
Normal file
17
src/components/admin/fields/FieldError.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useFormContext, get } from 'react-hook-form';
|
||||
|
||||
type Props = { name: string };
|
||||
|
||||
export function FieldError({ name }: Props) {
|
||||
const {
|
||||
formState: { errors },
|
||||
} = useFormContext();
|
||||
const error = get(errors, name);
|
||||
if (!error?.message) return null;
|
||||
return (
|
||||
<p className="mt-1 flex items-center gap-2 font-mono text-xs text-[color:var(--color-magenta)]">
|
||||
<span className="led led-red animate-led-red" />
|
||||
<span>{String(error.message)}</span>
|
||||
</p>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user