ConceptPortal-public/rsconcept/frontend/src/components/ui/SearchBar.tsx

33 lines
887 B
TypeScript
Raw Normal View History

2023-12-16 19:20:26 +03:00
import { BiSearchAlt2 } from 'react-icons/bi';
import { CProps } from '../props';
2023-12-08 19:24:08 +03:00
import Overlay from './Overlay';
2023-11-06 02:20:16 +03:00
import TextInput from './TextInput';
interface SearchBarProps extends CProps.Styling {
2023-12-28 14:04:44 +03:00
value: string;
onChange?: (newValue: string) => void;
noBorder?: boolean;
2023-11-06 02:20:16 +03:00
}
function SearchBar({ value, onChange, noBorder, ...restProps }: SearchBarProps) {
2023-11-06 02:20:16 +03:00
return (
2023-12-28 14:04:44 +03:00
<div {...restProps}>
<Overlay position='top-[-0.125rem] left-3 translate-y-1/2' className='pointer-events-none clr-text-controls'>
<BiSearchAlt2 size='1.25rem' />
</Overlay>
<TextInput
noOutline
placeholder='Поиск'
type='search'
2023-12-30 19:43:24 +03:00
className='w-full pl-10'
2023-12-28 14:04:44 +03:00
noBorder={noBorder}
value={value}
onChange={event => (onChange ? onChange(event.target.value) : undefined)}
/>
</div>
);
2023-11-06 02:20:16 +03:00
}
export default SearchBar;