-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial algolia integration * initial algolia integration * upgraded to algolia, indexed docs, and removed vocs indexing * removed chainlistParsing
- Loading branch information
1 parent
1419ffc
commit 65ad205
Showing
7 changed files
with
366 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Suspense, lazy, useEffect, useState } from 'react' | ||
import type { DocSearchProps } from '@docsearch/react' | ||
import '@docsearch/css' | ||
|
||
let hydrating = true | ||
|
||
export function useHydrated() { | ||
const [hydrated, setHydrated] = useState(() => !hydrating) | ||
useEffect(() => { | ||
hydrating = false | ||
setHydrated(true) | ||
}, []) | ||
return hydrated | ||
} | ||
|
||
const OriginalDocSearch = lazy(() => | ||
import('@docsearch/react').then((module) => ({ | ||
default: module.DocSearch, | ||
})), | ||
) | ||
|
||
export function DocSearch(docSearchProps: DocSearchProps) { | ||
const hydrated = useHydrated() | ||
|
||
if (!hydrated) { | ||
return <div className="h-9" /> | ||
} | ||
|
||
return ( | ||
<Suspense fallback={<div className="h-9" />}> | ||
<div className=".DocSearch .DocSearch-Button"> | ||
<OriginalDocSearch {...docSearchProps} /> | ||
</div> | ||
</Suspense> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.