mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 09:11:38 +00:00
* add menu item * add pages * add build search script Add custom algolia component * fix image in post width Delete useless file Modify post data to algolia script
32 lines
804 B
TypeScript
32 lines
804 B
TypeScript
import { FC } from 'react';
|
|
import { connectSearchBox } from 'react-instantsearch-dom';
|
|
import { SearchBoxProvided } from 'react-instantsearch-core';
|
|
import {
|
|
InputGroup,
|
|
Input,
|
|
InputRightElement,
|
|
CloseButton,
|
|
} from '@chakra-ui/react';
|
|
|
|
const SearchBox: FC<SearchBoxProvided> = ({ currentRefinement, refine }) => {
|
|
return (
|
|
<>
|
|
<InputGroup>
|
|
<Input
|
|
value={currentRefinement}
|
|
onChange={(event) => refine(event.currentTarget.value)}
|
|
autoFocus
|
|
placeholder="Seach posts..."
|
|
/>
|
|
<InputRightElement>
|
|
{currentRefinement && <CloseButton onClick={() => refine('')} />}
|
|
</InputRightElement>
|
|
</InputGroup>
|
|
</>
|
|
);
|
|
};
|
|
|
|
const CustomSearchBox = connectSearchBox(SearchBox);
|
|
|
|
export default CustomSearchBox;
|