Create a SiteSearch component

pull/4161/head
Elijah 6 years ago
parent abe88f3b3a
commit c5c68907f8

@ -0,0 +1,21 @@
<script>
import { writable } from 'svelte/store';
export let showing = false;
</script>
{#if showing}
<div class="search"></div>
{/if}
<style>
.search {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 385px;
background: var(--back);
z-index: 100;
}
</style>

@ -3,9 +3,12 @@
import { stores } from '@sapper/app'; import { stores } from '@sapper/app';
import { Icon, Icons, Nav, NavItem } from '@sveltejs/site-kit'; import { Icon, Icons, Nav, NavItem } from '@sveltejs/site-kit';
import PreloadingIndicator from '../components/PreloadingIndicator.svelte'; import PreloadingIndicator from '../components/PreloadingIndicator.svelte';
import SiteSearch from '../components/SiteSearch.svelte';
export let segment; export let segment;
let showingSearch = false;
const { page, preloading, session } = stores(); const { page, preloading, session } = stores();
setContext('app', { setContext('app', {
@ -53,7 +56,15 @@
<NavItem external="https://github.com/sveltejs/svelte" title="GitHub Repo"> <NavItem external="https://github.com/sveltejs/svelte" title="GitHub Repo">
<Icon name="github"/> <Icon name="github"/>
</NavItem> </NavItem>
<NavItem active={showingSearch} title="Search Site">
<span on:click={() => showingSearch = true}>
<Icon name="github"/>
</span>
</NavItem>
</Nav> </Nav>
<SiteSearch bind:showing={showingSearch}/>
{/if} {/if}
<main> <main>

Loading…
Cancel
Save