Initial commit
This commit is contained in:
commit
db896255d6
744 changed files with 56028 additions and 0 deletions
24
web/app/components/base/radio/component/group/index.tsx
Normal file
24
web/app/components/base/radio/component/group/index.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import type { ReactElement } from 'react'
|
||||
import cn from 'classnames'
|
||||
import RadioGroupContext from '../../context'
|
||||
import s from '../../style.module.css'
|
||||
|
||||
export type TRadioGroupProps = {
|
||||
children?: ReactElement | ReactElement[]
|
||||
value?: string | number
|
||||
className?: string
|
||||
onChange?: (value: any) => void
|
||||
}
|
||||
|
||||
export default function Group({ children, value, onChange, className = '' }: TRadioGroupProps): JSX.Element {
|
||||
const onRadioChange = (value: any) => {
|
||||
onChange?.(value)
|
||||
}
|
||||
return (
|
||||
<div className={cn('flex items-center bg-gray-50', s.container, className)}>
|
||||
<RadioGroupContext.Provider value={{ value, onChange: onRadioChange }}>
|
||||
{children}
|
||||
</RadioGroupContext.Provider>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue