-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
350 additions
and
31 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,65 @@ | ||
:root { | ||
--docsearch-key-shadow: none; | ||
--docsearch-key-gradient: #fff; | ||
--docsearch-primary-color: var(--color-text-primary); | ||
--docsearch-key-pressed-shadow: none; | ||
--docsearch-text-color: inherit; | ||
} | ||
|
||
.DocSearch-Input { | ||
&:focus { | ||
box-shadow: none; | ||
} | ||
} | ||
|
||
.DocSearch-Commands-Key { | ||
@apply border border-solid border-slate-200; | ||
} | ||
|
||
.DocSearch-Button { | ||
@apply rounded-md md:min-w-[200px]; | ||
} | ||
|
||
.DocSearch-Button-Key { | ||
@apply mr-1 bg-white; | ||
|
||
&:last-child { | ||
@apply text-xs font-semibold; | ||
} | ||
} | ||
|
||
.DocSearch-Button-Placeholder { | ||
@apply text-sm; | ||
} | ||
|
||
.DocSearch-Search-Icon { | ||
@apply md:scale-75 dark:text-white; | ||
} | ||
|
||
.DocSearch-Form .DocSearch-Search-Icon { | ||
@apply text-slate-900; | ||
} | ||
|
||
.DocSearch-Button { | ||
@apply bg-transparent dark:md:bg-slate-800 md:bg-slate-100; | ||
} | ||
|
||
.navbar-home { | ||
.DocSearch-Button-Key { | ||
@apply opacity-90; | ||
} | ||
|
||
.DocSearch-Button { | ||
@apply bg-transparent md:bg-slate-900 md:text-slate-400; | ||
|
||
.DocSearch-Search-Icon { | ||
@apply text-white md:text-slate-400; | ||
} | ||
} | ||
} | ||
|
||
.nextra-sidebar-container { | ||
.DocSearch-Button { | ||
@apply hidden; | ||
} | ||
} |
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,46 @@ | ||
import {DocSearch} from '@docsearch/react'; | ||
import Router from 'next/router'; | ||
import {TITLE_TEMPLATE_SUFFIX} from 'theme.config'; | ||
import '@docsearch/css'; | ||
import './AlgoliaSearch.css'; | ||
|
||
export default function AlgoliaSearch() { | ||
return ( | ||
<DocSearch | ||
apiKey="7c038bab58b7eb07475d5dcdfdaba88f" | ||
appId="4MXOXYFOUD" | ||
indexName="next-intl-vercel" | ||
navigator={{ | ||
navigate({itemUrl}) { | ||
Router.push(itemUrl); | ||
} | ||
}} | ||
transformItems={(items) => | ||
items.map((item) => { | ||
const url = new URL(item.url); | ||
const localUrl = item.url.replace(url.origin, ''); | ||
|
||
return { | ||
...item, | ||
url: localUrl, | ||
|
||
// Remove page title from the hierarchy | ||
_snippetResult: { | ||
...item._snippetResult, | ||
hierarchy: { | ||
...item._snippetResult.hierarchy, | ||
lvl1: { | ||
...item._snippetResult.hierarchy?.lvl1, | ||
value: item._snippetResult.hierarchy?.lvl1?.value?.replace( | ||
TITLE_TEMPLATE_SUFFIX, | ||
'' | ||
) | ||
} | ||
} | ||
} | ||
}; | ||
}) | ||
} | ||
/> | ||
); | ||
} |
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
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.