mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 15:10:48 +02:00
452d854d5b
Unified access onboarding data collection pages GitOrigin-RevId: c56a3d52f749883eeb2302e22aaf6bdf1239160c
47 lines
940 B
TypeScript
47 lines
940 B
TypeScript
import React from 'react'
|
|
|
|
type DSSelectionGroupItemProps<ValueType> = {
|
|
checked?: boolean
|
|
disabled?: boolean
|
|
onChange?: (value: ValueType) => void
|
|
required?: boolean
|
|
children: React.ReactNode
|
|
} & (
|
|
| {
|
|
type: 'radio'
|
|
name: string
|
|
value: ValueType
|
|
}
|
|
| {
|
|
type: 'checkbox'
|
|
name?: string
|
|
value?: ValueType
|
|
}
|
|
)
|
|
|
|
export default function DSSelectionGroupItem(
|
|
props: DSSelectionGroupItemProps<any>
|
|
) {
|
|
const handleChange = () => {
|
|
props.onChange?.(props.value)
|
|
}
|
|
|
|
return (
|
|
<li className="selection-group-ds-item">
|
|
<label>
|
|
<input
|
|
type={props.type}
|
|
className="check-input-ds"
|
|
name={props.name}
|
|
value={props.value}
|
|
checked={props.checked}
|
|
disabled={props.disabled}
|
|
required={props.required}
|
|
onChange={handleChange}
|
|
/>
|
|
{props.children}
|
|
</label>
|
|
</li>
|
|
)
|
|
}
|