feat: scaffold complete danable frontend architecture with all pages, layouts, stores, and 3 annotator modes
This commit is contained in:
commit
78848dd7d1
173 changed files with 18649 additions and 0 deletions
63
src/components/ui/RadioGroup.tsx
Normal file
63
src/components/ui/RadioGroup.tsx
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
import React from 'react'
|
||||
import clsx from 'clsx'
|
||||
|
||||
export interface RadioOption {
|
||||
value: string
|
||||
label: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface RadioGroupProps {
|
||||
name: string
|
||||
label?: string
|
||||
options: RadioOption[]
|
||||
value: string
|
||||
onChange: (value: string) => void
|
||||
className?: string
|
||||
}
|
||||
|
||||
export const RadioGroup: React.FC<RadioGroupProps> = ({
|
||||
name,
|
||||
label,
|
||||
options,
|
||||
value,
|
||||
onChange,
|
||||
className,
|
||||
}) => {
|
||||
return (
|
||||
<div className={className}>
|
||||
{label && <div className="text-sm font-medium text-slate-700 mb-2">{label}</div>}
|
||||
<div className="space-y-2">
|
||||
{options.map((option) => {
|
||||
const checked = value === option.value
|
||||
return (
|
||||
<label
|
||||
key={option.value}
|
||||
className={clsx(
|
||||
'flex items-start gap-3 rounded-xl border p-3 cursor-pointer transition-colors',
|
||||
checked
|
||||
? 'border-[#C95C3C] bg-orange-50/40'
|
||||
: 'border-slate-200 hover:bg-slate-50'
|
||||
)}
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name={name}
|
||||
value={option.value}
|
||||
checked={checked}
|
||||
onChange={() => onChange(option.value)}
|
||||
className="mt-0.5 h-4 w-4 border-slate-300 text-[#C95C3C] focus:ring-[#C95C3C]/30 accent-[#C95C3C]"
|
||||
/>
|
||||
<div className="text-sm">
|
||||
<div className="font-medium text-slate-800">{option.label}</div>
|
||||
{option.description && (
|
||||
<div className="text-xs text-slate-500 mt-0.5">{option.description}</div>
|
||||
)}
|
||||
</div>
|
||||
</label>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue