mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
feat(react): port sort child notes
This commit is contained in:
30
apps/client/src/widgets/react/FormRadioGroup.tsx
Normal file
30
apps/client/src/widgets/react/FormRadioGroup.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
interface FormRadioProps {
|
||||
name: string;
|
||||
currentValue?: string;
|
||||
values: {
|
||||
value: string;
|
||||
label: string;
|
||||
}[];
|
||||
onChange(newValue: string): void;
|
||||
}
|
||||
|
||||
export default function FormRadioGroup({ name, values, currentValue, onChange }: FormRadioProps) {
|
||||
return (
|
||||
<>
|
||||
{(values || []).map(({ value, label }) => (
|
||||
<div className="form-check">
|
||||
<label className="form-check-label tn-radio">
|
||||
<input
|
||||
className="form-check-input"
|
||||
type="radio"
|
||||
name={name}
|
||||
value={value}
|
||||
checked={value === currentValue}
|
||||
onChange={e => onChange((e.target as HTMLInputElement).value)} />
|
||||
{label}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user