Spaces:
Running

File size: 1,626 Bytes
130ca31
 
bb9454a
 
 
130ca31
bb9454a
130ca31
 
 
bb9454a
 
 
 
 
 
 
130ca31
bb9454a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { useState } from 'react'
import { useDebounce } from '../hooks/useDebounce'

export default function SearchBar({ onSearch, isSearching }) {
  const [value, setValue] = useState('')
  const debouncedValue = useDebounce(value, 300)

  useState(() => {
    onSearch(debouncedValue)
  }, [debouncedValue, onSearch])

  return (
    <div className="relative max-w-3xl mx-auto">
      <div className="relative">
        <input
          type="text"
          value={value}
          onChange={(e) => setValue(e.target.value)}
          placeholder="Search transcripts, tags, or keywords..."
          className="input-field pl-12 pr-12 py-4 text-lg shadow-xl"
          autoFocus
        />
        <div className="absolute left-4 top-1/2 -translate-y-1/2 text-dark-500">
          <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
          </svg>
        </div>
        {isSearching && (
          <div className="absolute right-4 top-1/2 -translate-y-1/2">
            <div className="w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"></div>
          </div>
        )}
      </div>
      
      <div className="flex justify-center gap-2 mt-4 text-xs text-dark-500">
        <span className="bg-dark-800 px-2 py-1 rounded border border-dark-700">Tip: Use quotes for exact phrases</span>
        <span className="bg-dark-800 px-2 py-1 rounded border border-dark-700">Tip: Use * for wildcards</span>
      </div>
    </div>
  )
}