Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion src/components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@

export function Search({
isOpen,
onOpen,

Check failure on line 97 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Duplicate identifier 'onOpen'.
onClose,

Check failure on line 98 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Duplicate identifier 'onClose'.
searchParameters = {
hitsPerPage: 30,
attributesToHighlight: [
Expand All @@ -110,7 +110,42 @@
],
},
}: SearchProps) {
useDocSearchKeyboardEvents({isOpen, onOpen, onClose});
const [isShowing, setIsShowing] = useState(false);

Check failure on line 113 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Cannot find name 'useState'.

const importDocSearchModalIfNeeded = useCallback(

Check failure on line 115 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Cannot find name 'useCallback'.
function importDocSearchModalIfNeeded() {
if (DocSearchModal) {
return Promise.resolve();
}

// @ts-ignore
return import('@docsearch/react/modal').then(
({DocSearchModal: Modal}) => {
DocSearchModal = Modal;

Check failure on line 124 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Cannot assign to 'DocSearchModal' because it is a constant.
}
);
},
[]
);

const onOpen = useCallback(

Check failure on line 131 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Duplicate identifier 'onOpen'.

Check failure on line 131 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Cannot find name 'useCallback'.
function onOpen() {
importDocSearchModalIfNeeded().then(() => {
setIsShowing(true);
});
},
[importDocSearchModalIfNeeded, setIsShowing]
);

const onClose = useCallback(

Check failure on line 140 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Duplicate identifier 'onClose'.

Check failure on line 140 in src/components/Search.tsx

View workflow job for this annotation

GitHub Actions / Lint on node 20.x and ubuntu-latest

Cannot find name 'useCallback'.
function onClose() {
setIsShowing(false);
},
[setIsShowing]
);

useDocSearchKeyboardEvents({isOpen: isShowing, onOpen, onClose});

return (
<>
<Head>
Expand Down
Loading