Updated clear button

This commit is contained in:
Djordje Vlaisavljevic 2022-07-05 16:51:29 +02:00
parent d952c38a7f
commit 4243959ac9

View File

@ -138,18 +138,28 @@ function SearchBox() {
className='grow text-[1.65rem] focus-visible:outline-none placeholder:text-gray-300'
placeholder='Search posts, tags, authors..'
/>
<ClearIcon
className='ml-3 fill-neutral-400 cursor-pointer' alt='Clear'
onClick={() => {
dispatch('update', {
searchValue: ''
});
}}
/>
<ClearButton />
</div>
);
}
function ClearButton() {
const {searchValue = '', dispatch} = useContext(AppContext);
if (!searchValue) {
return null;
}
return (
<ClearIcon
className='ml-3 fill-neutral-400 cursor-pointer' alt='Clear'
onClick={() => {
dispatch('update', {
searchValue: ''
});
}}
/>
);
}
function TagListItem({title}) {
return (
<div className='flex items-center py-3 -mx-7 px-7 hover:bg-gray-100 cursor-pointer'>