ConceptPortal-public/rsconcept/frontend/src/components/Common/ConceptSearch.tsx

30 lines
783 B
TypeScript
Raw Normal View History

2023-11-06 02:20:16 +03:00
import { MagnifyingGlassIcon } from '../Icons';
import TextInput from './TextInput';
interface ConceptSearchProps {
value: string
onChange?: (newValue: string) => void
dense?: boolean
}
function ConceptSearch({ value, onChange, dense }: ConceptSearchProps) {
const borderClass = dense ? 'border-t border-x': '';
return (
<div className='relative'>
<div className='absolute inset-y-0 flex items-center pl-3 pointer-events-none text-controls'>
<MagnifyingGlassIcon />
</div>
<TextInput noOutline
2023-11-06 02:20:16 +03:00
placeholder='Поиск'
dimensions={`w-full pl-10 ${borderClass}`}
2023-11-06 02:20:16 +03:00
noBorder={dense}
value={value}
onChange={event => (onChange ? onChange(event.target.value) : undefined)}
2023-11-06 02:20:16 +03:00
/>
</div>);
}
export default ConceptSearch;