Files
resolutionflow/frontend/src/components/flowpilot/FlowPilotOptions.tsx
Michael Chihlas 303a558432 refactor: replace hardcoded hex values with Tailwind semantic tokens
3,200+ hardcoded color values replaced with CSS variable-backed
Tailwind classes (bg-card, text-foreground, border-border, etc.).
Enables light mode via CSS variable swap. Only syntax highlighting
colors and intentional one-offs remain hardcoded (~15 values).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 04:34:35 -04:00

59 lines
2.0 KiB
TypeScript

import { useState } from 'react'
import { Check } from 'lucide-react'
import { cn } from '@/lib/utils'
import type { StepOptionSchema } from '@/types/ai-session'
interface FlowPilotOptionsProps {
options: StepOptionSchema[]
onSelect: (value: string) => void
disabled?: boolean
}
export function FlowPilotOptions({ options, onSelect, disabled }: FlowPilotOptionsProps) {
const [selected, setSelected] = useState<string | null>(null)
const handleSelect = (value: string) => {
if (disabled) return
setSelected(value)
onSelect(value)
}
return (
<div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
{options.map((option) => {
const isSelected = selected === option.value
return (
<button
key={option.value}
onClick={() => handleSelect(option.value)}
disabled={disabled}
className={cn(
'group relative rounded-xl border p-3 sm:p-4 text-left transition-all min-h-[44px]',
'hover:border-[rgba(6,182,212,0.3)] hover:shadow-[0_0_20px_rgba(6,182,212,0.08)]',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40',
isSelected
? 'border-primary/40 bg-accent-dim'
: 'border-border bg-card/50',
disabled && 'pointer-events-none opacity-60'
)}
>
<div className="flex items-start justify-between gap-3">
<div className="flex-1">
<p className="text-sm font-medium text-foreground">{option.label}</p>
{option.followup_hint && (
<p className="mt-1 text-xs text-muted-foreground">{option.followup_hint}</p>
)}
</div>
{isSelected && (
<span className="flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary/20 text-primary">
<Check size={12} />
</span>
)}
</div>
</button>
)
})}
</div>
)
}