File size: 1,361 Bytes
6b435ec
 
 
 
 
 
3baad7e
6b435ec
 
3baad7e
6b435ec
 
 
 
 
 
 
 
 
 
 
3baad7e
 
6b435ec
3baad7e
6b435ec
 
 
 
 
 
 
 
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
import { Lightbulb } from "lucide-react";
import { compactQuestions } from "./utils";

interface SuggestedQuestionsBarProps {
  questions: string[];
  onSelect: (question: string) => void;
  disabled?: boolean;
}

export function SuggestedQuestionsBar({ questions, onSelect, disabled }: SuggestedQuestionsBarProps) {
  const filtered = compactQuestions(questions);
  if (filtered.length === 0) return null;

  return (
    <div className="flex flex-shrink-0 items-center gap-2 border-t border-slate-200 bg-white px-4 py-2">
      <Lightbulb className="h-3.5 w-3.5 flex-shrink-0 text-amber-500" />
      <div className="flex min-w-0 flex-1 items-center gap-1.5 overflow-x-auto">
        {filtered.map((question) => (
          <button
            key={question}
            type="button"
            onClick={() => { if (!disabled) onSelect(question); }}
            disabled={disabled}
            title={question}
            className="flex-shrink-0 whitespace-nowrap rounded-full border border-slate-200 bg-white px-3 py-1 text-xs text-slate-600 transition hover:border-emerald-300 hover:bg-emerald-50 hover:text-emerald-800 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-slate-200 disabled:hover:bg-white disabled:hover:text-slate-600"
          >
            {question}
          </button>
        ))}
      </div>
    </div>
  );
}