refactor: improve news and email handling, style, folder structure (#16)
This commit is contained in:
22
components/form/FormLabel.tsx
Normal file
22
components/form/FormLabel.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { useFormField } from '@hooks/useFormField';
|
||||
import * as LabelPrimitive from '@radix-ui/react-label';
|
||||
import { cn } from '@utils/ui';
|
||||
import * as React from 'react';
|
||||
import { Label } from '../Label';
|
||||
|
||||
export const FormLabel = React.forwardRef<
|
||||
React.ElementRef<typeof LabelPrimitive.Root>,
|
||||
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
||||
>(({ className, ...props }, ref) => {
|
||||
const { error, formItemId } = useFormField();
|
||||
|
||||
return (
|
||||
<Label
|
||||
ref={ref}
|
||||
className={cn(error && 'text-destructive', className)}
|
||||
htmlFor={formItemId}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
});
|
||||
FormLabel.displayName = 'FormLabel';
|
||||
Reference in New Issue
Block a user