'use client' import React from 'react' import { cn } from '../../utils/cn' import { SearchIcon } from '../icons-v2-generated' export interface HeaderGlobalSearchProps { /** Current search value */ value?: string /** Callback when search value changes */ onChange?: (value: string) => void /** Callback when search is submitted */ onSubmit?: (value: string) => void /** Placeholder text */ placeholder?: string /** Additional class names */ className?: string } export function HeaderGlobalSearch({ value = '', onChange, onSubmit, placeholder = 'Global Search', className }: HeaderGlobalSearchProps) { const [internalValue, setInternalValue] = React.useState(value) const currentValue = onChange ? value : internalValue const handleChange = (e: React.ChangeEvent) => { const newValue = e.target.value if (onChange) { onChange(newValue) } else { setInternalValue(newValue) } } const handleSubmit = (e: React.FormEvent) => { e.preventDefault() onSubmit?.(currentValue) } const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { onSubmit?.(currentValue) } } return (
) } export default HeaderGlobalSearch