Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 54x 37x 37x 10x | import { Check, Loader2 } from 'lucide-react'
import { cn } from '../lib/utils'
interface SuggestionSelectorProps {
suggestions: string[]
selectedSuggestions: string[]
loadingSuggestions: boolean
disabled: boolean
onSuggestionClick: (suggestion: string) => void
}
export default function SuggestionSelector({
suggestions,
selectedSuggestions,
loadingSuggestions,
disabled,
onSuggestionClick,
}: SuggestionSelectorProps) {
return (
<div className="mb-5">
<div className="mb-3 flex items-center justify-between">
<h3 className="text-sm font-medium text-foreground">Suggestions</h3>
{selectedSuggestions.length > 0 && (
<span className="text-xs text-muted-foreground">
{selectedSuggestions.length} selected
</span>
)}
</div>
{loadingSuggestions ? (
<div className="flex items-center justify-center py-8">
<Loader2 className="h-6 w-6 animate-spin text-primary" />
<span className="ml-2 text-sm text-muted-foreground">
Generating suggestions...
</span>
</div>
) : (
<div className="flex flex-wrap gap-2">
{suggestions.map((suggestion, index) => {
const isSelected = selectedSuggestions.includes(suggestion)
return (
<button
key={index}
onClick={() => onSuggestionClick(suggestion)}
disabled={disabled}
className={cn(
'flex items-center gap-1.5 rounded-full px-3 py-1.5 text-sm transition-colors',
isSelected
? 'bg-primary text-primary-foreground'
: 'bg-muted text-foreground hover:bg-muted/80'
)}
>
{isSelected && <Check className="h-3.5 w-3.5" />}
{suggestion}
</button>
)
})}
</div>
)}
</div>
)
}
|