refactor: build label on the text component
This commit is contained in:
parent
0da1bf0e7e
commit
73c67dbe9f
@ -1,17 +1,6 @@
|
|||||||
import * as React from 'react';
|
import type { LabelHTMLAttributes } from 'react';
|
||||||
import { cva, type VariantProps } from 'class-variance-authority';
|
import { Text } from '~/components/ui/text';
|
||||||
import { cn } from '~/lib/utils';
|
|
||||||
|
|
||||||
const labelVariants = cva(
|
export function Label(props: LabelHTMLAttributes<HTMLLabelElement>) {
|
||||||
'text-xs font-bold text-neutral-400 uppercase tracking-wider select-none leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'
|
return <Text as='label' variant='label' {...props} />;
|
||||||
);
|
}
|
||||||
|
|
||||||
const Label = React.forwardRef<
|
|
||||||
HTMLLabelElement,
|
|
||||||
React.LabelHTMLAttributes<HTMLLabelElement> & VariantProps<typeof labelVariants>
|
|
||||||
>(({ className, ...props }, ref) => (
|
|
||||||
<label ref={ref} className={cn(labelVariants(), className)} {...props} />
|
|
||||||
));
|
|
||||||
Label.displayName = 'Label';
|
|
||||||
|
|
||||||
export { Label };
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user