Skip to content

Commit

Permalink
docsearch
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Dec 23, 2024
1 parent 72f02a6 commit e9764da
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 110 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
},
"dependencies": {
"@algolia/autocomplete-js": "^1.17.7",
"@docsearch/css": "3",
"@docsearch/js": "3",
"@rehype-pretty/transformers": "^0.13.2",
"@sveltejs/adapter-netlify": "^4.3.6",
"hastscript": "^9.0.0",
Expand Down
49 changes: 49 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

108 changes: 0 additions & 108 deletions src/lib/components/CommandMenu.svelte

This file was deleted.

16 changes: 16 additions & 0 deletions src/lib/components/DocSearch.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script lang="ts">
import '@docsearch/css';
import docsearch from '@docsearch/js';
import { onMount } from 'svelte';
onMount(() => {
docsearch({
container: '#docsearch',
appId: '2Y8OU39U1X',
indexName: 'docsearch_mock',
apiKey: '0e82d6007f06d9f280629a37bb8a0892'
});
});
</script>

<div id="docsearch"></div>
4 changes: 2 additions & 2 deletions src/lib/components/SiteHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ModeToggle from '$lib/components/ModeToggle.svelte';
import { MainNav, MobileNav } from '$lib/components/nav';
import { Icons } from '$lib/components/icons';
import CommandMenu from '$lib/components/CommandMenu.svelte';
import DocSearch from '$lib/components/DocSearch.svelte';
import { buttonVariants } from '$lib/components/ui/button';
import { siteConfig } from '$lib/config/site.js';
import { cn } from '$lib/utils.js';
Expand All @@ -18,7 +18,7 @@
<MobileNav />
<div class="flex flex-1 items-center justify-between space-x-2 md:justify-end">
<div class="w-full flex-1 md:w-auto md:flex-none">
<CommandMenu />
<DocSearch />
</div>
<nav class="flex items-center">
<a href={siteConfig.links.github} target="_blank" rel="noopener noreferrer">
Expand Down

0 comments on commit e9764da

Please sign in to comment.