File size: 1,321 Bytes
9a43362
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
'use client';

interface TopicInputProps {
  value: string;
  onChange: (value: string) => void;
  onResearch: () => void;
  isResearching: boolean;
}

export default function TopicInput({
  value,
  onChange,
  onResearch,
  isResearching,
}: TopicInputProps): React.ReactElement {
  return (
    <div className="space-y-2">
      <label className="text-sm font-medium text-gray-700">Enter a topic</label>
      <div className="flex gap-2">
        <input
          type="text"
          value={value}
          onChange={(e) => onChange(e.target.value)}
          placeholder="e.g. productivity tips for remote workers"
          className="flex-1 px-4 py-3 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
        />
        <button
          onClick={onResearch}
          disabled={!value.trim() || isResearching}
          className="px-4 py-3 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors whitespace-nowrap"
        >
          {isResearching ? 'Researching...' : '🔍 Research'}
        </button>
      </div>
      <p className="text-xs text-gray-400">
        We&apos;ll find trending posts and articles on this topic to inspire your carousel
      </p>
    </div>
  );
}