({ label, options, value, onChange })
| 65 | |
| 66 | // Segmented control component |
| 67 | const SegmentedControl = ({ label, options, value, onChange }) => { |
| 68 | return ( |
| 69 | <div className="flex flex-col gap-2"> |
| 70 | <label className="text-sm font-medium text-gray-700 dark:text-gray-300"> |
| 71 | {label} |
| 72 | </label> |
| 73 | <div className="inline-flex items-center bg-gray-50 dark:bg-gray-800 border-2 border-gray-200 dark:border-gray-700 rounded-xl p-1"> |
| 74 | {options.map((option) => ( |
| 75 | <button |
| 76 | key={option.value} |
| 77 | onClick={() => onChange(option.value)} |
| 78 | className={`flex-1 px-4 py-2 text-sm font-medium rounded-lg transition-all ${ |
| 79 | value === option.value |
| 80 | ? 'bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-md' |
| 81 | : 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200' |
| 82 | }`} |
| 83 | > |
| 84 | {value === option.value && ( |
| 85 | <Check className="w-4 h-4 inline-block mr-1" /> |
| 86 | )} |
| 87 | {option.label} |
| 88 | </button> |
| 89 | ))} |
| 90 | </div> |
| 91 | </div> |
| 92 | ) |
| 93 | } |
| 94 | |
| 95 | return ( |
| 96 | <div className="w-full"> |
nothing calls this directly
no outgoing calls
no test coverage detected