2023-12-21 06:30:07 +00:00
|
|
|
import React, { forwardRef, RefAttributes } from 'react';
|
2023-12-20 04:29:02 +00:00
|
|
|
|
2024-02-27 03:24:15 +00:00
|
|
|
import { SearchIcon } from './shared/CustomIcon';
|
|
|
|
import { Input, InputProps } from './shared/Input';
|
2023-12-12 12:24:20 +00:00
|
|
|
|
2023-12-20 04:29:02 +00:00
|
|
|
const SearchBar: React.ForwardRefRenderFunction<
|
|
|
|
HTMLInputElement,
|
2023-12-21 06:30:07 +00:00
|
|
|
InputProps & RefAttributes<HTMLInputElement>
|
2024-02-27 03:24:15 +00:00
|
|
|
> = ({ value, onChange, placeholder = 'Search', ...props }) => {
|
2023-12-12 12:24:20 +00:00
|
|
|
return (
|
2024-02-27 03:24:15 +00:00
|
|
|
<div className="relative flex w-full">
|
2023-12-20 04:29:02 +00:00
|
|
|
<Input
|
2024-02-27 03:24:15 +00:00
|
|
|
leftIcon={<SearchIcon />}
|
2023-12-20 04:29:02 +00:00
|
|
|
onChange={onChange}
|
|
|
|
value={value}
|
|
|
|
type="search"
|
|
|
|
placeholder={placeholder}
|
2024-02-27 03:24:15 +00:00
|
|
|
appearance={'borderless'}
|
2023-12-20 04:29:02 +00:00
|
|
|
{...props}
|
|
|
|
/>
|
2023-12-12 12:24:20 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-12-20 04:29:02 +00:00
|
|
|
export default forwardRef(SearchBar);
|