mirror of
https://github.com/ershisan99/flashcards-example-project.git
synced 2025-12-18 05:09:23 +00:00
homework 2 done
This commit is contained in:
23
src/components/ui/label/label.tsx
Normal file
23
src/components/ui/label/label.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ComponentPropsWithoutRef, FC, ReactNode } from 'react'
|
||||
|
||||
import * as LabelRadixUI from '@radix-ui/react-label'
|
||||
import { clsx } from 'clsx'
|
||||
|
||||
import s from './label.module.scss'
|
||||
|
||||
export type LabelProps = {
|
||||
label?: ReactNode
|
||||
} & ComponentPropsWithoutRef<'label'>
|
||||
|
||||
export const Label: FC<LabelProps> = ({ label, children, className, ...rest }) => {
|
||||
const classNames = {
|
||||
label: clsx(s.label, className),
|
||||
}
|
||||
|
||||
return (
|
||||
<LabelRadixUI.Root {...rest}>
|
||||
{label && <div className={classNames.label}>{label}</div>}
|
||||
{children}
|
||||
</LabelRadixUI.Root>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user