Files
overleaf-cep/services/web/frontend/js/features/settings/components/radio-button-setting.tsx
T
Kristina 9a129e7cab Merge pull request #32939 from overleaf/kh-update-settings-modal-language
[web] update copy & layout for notifications settings

GitOrigin-RevId: 13b6b78b0b2bddd9d0137362a14bfdbdba9d7d20
2026-04-23 08:06:47 +00:00

45 lines
1.1 KiB
TypeScript

import React from 'react'
import OLFormCheckbox from '@/shared/components/ol/ol-form-checkbox'
export type RadioOption<T extends string = string> = {
value: T
label: string
description?: string
}
type RadioButtonSettingProps<T extends string = string> = {
id: string
options: Array<RadioOption<T>>
value: T | undefined
onChange: (value: T) => void
}
export default function RadioButtonSetting<T extends string = string>({
id,
options,
value,
onChange,
}: RadioButtonSettingProps<T>) {
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
onChange(event.target.value as T)
}
return (
<div className="ide-radio-setting-options">
{options.map(option => (
<OLFormCheckbox
key={`${id}-${option.value}`}
type="radio"
id={`${id}-${option.value}`}
name={id}
value={option.value}
checked={value === option.value}
onChange={handleChange}
label={option.label}
description={option.description}
/>
))}
</div>
)
}