-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #459 from MuckRock/sveltekit-searchbar
[SvelteKit] ContentLayout with toolbars
- Loading branch information
Showing
11 changed files
with
316 additions
and
145 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,48 @@ | ||
<div class="container"> | ||
{#if $$slots.header} | ||
<header> | ||
<slot name="header" /> | ||
</header> | ||
{/if} | ||
<main> | ||
<slot /> | ||
</main> | ||
{#if $$slots.footer} | ||
<footer> | ||
<slot name="footer" /> | ||
</footer> | ||
{/if} | ||
</div> | ||
|
||
<style> | ||
.container { | ||
display: flex; | ||
padding: 0; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
flex: 1 0 0; | ||
align-self: stretch; | ||
position: relative; | ||
} | ||
header { | ||
flex: 0 0 0; | ||
width: 100%; | ||
position: sticky; | ||
top: 0; | ||
padding: 0.625rem; | ||
} | ||
main { | ||
flex: 1 0 0; | ||
width: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
} | ||
footer { | ||
flex: 0 0 0; | ||
width: 100%; | ||
position: sticky; | ||
bottom: 0; | ||
padding: 0.625rem; | ||
} | ||
</style> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<script lang="ts"> | ||
import { Search24, XCircleFill24 } from "svelte-octicons"; | ||
import Button from "./common/Button.svelte"; | ||
export let query: string = ""; | ||
let input: HTMLInputElement; | ||
function clear() { | ||
query = ""; | ||
input.focus(); | ||
} | ||
</script> | ||
|
||
<form class="container" on:submit|preventDefault> | ||
<label for="query" title="Search"><Search24 /></label> | ||
<input | ||
id="query" | ||
name="query" | ||
bind:value={query} | ||
bind:this={input} | ||
on:change | ||
autocomplete="off" | ||
placeholder="Search…" | ||
/> | ||
<button | ||
title="Clear Search" | ||
type="reset" | ||
class:hidden={!query} | ||
on:click={clear} | ||
> | ||
<XCircleFill24 /> | ||
</button> | ||
</form> | ||
|
||
<style> | ||
form { | ||
display: flex; | ||
align-items: center; | ||
align-self: stretch; | ||
gap: 0.75rem; | ||
color: var(--gray-5, #233944); | ||
fill: var(--gray-5, #233944); | ||
} | ||
input { | ||
flex: 1 0 0; | ||
appearance: none; | ||
padding: 0.25rem; | ||
border: none; | ||
font-family: var(--font-sans, "Source Sans Pro"); | ||
font-weight: var(--font-regular, 400); | ||
font-size: var(--font-m, 1rem); | ||
} | ||
input::placeholder { | ||
color: var(--gray-4, #5c717c); | ||
} | ||
label { | ||
display: flex; | ||
align-items: center; | ||
} | ||
button { | ||
flex: 0 0 0; | ||
appearance: none; | ||
border: none; | ||
display: flex; | ||
align-items: center; | ||
padding: 0; | ||
font-family: var(--font-sans, "Source Sans Pro"); | ||
font-weight: var(--font-regular, 400); | ||
font-size: var(--font-m, 1rem); | ||
background: transparent; | ||
fill: var(--gray-3, #99a8b3); | ||
cursor: pointer; | ||
opacity: 1; | ||
visibility: visible; | ||
transform: translateX(0) rotate(0deg); | ||
transition: | ||
transform 0.25s ease-in-out, | ||
opacity 0.125s linear, | ||
visibility 0s; | ||
} | ||
button.hidden { | ||
visibility: hidden; | ||
opacity: 0; | ||
transform: translateX(100%) rotate(90deg); | ||
transition: | ||
transform 0.25s ease-in-out, | ||
opacity 0.125s linear, | ||
visibility 0s linear 0.25s; | ||
} | ||
</style> |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.