Minimize search text section.

This commit is contained in:
Bradley Shellnut 2022-07-28 17:07:23 -07:00
parent f0f8137fd6
commit a56c8d9303
7 changed files with 86 additions and 49 deletions

View file

@ -20,7 +20,7 @@
"@sveltejs/adapter-auto": "1.0.0-next.64", "@sveltejs/adapter-auto": "1.0.0-next.64",
"@sveltejs/kit": "1.0.0-next.396", "@sveltejs/kit": "1.0.0-next.396",
"@types/cookie": "^0.5.1", "@types/cookie": "^0.5.1",
"@types/node": "^18.6.1", "@types/node": "^18.6.2",
"@typescript-eslint/eslint-plugin": "^5.31.0", "@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0", "@typescript-eslint/parser": "^5.31.0",
"carbon-components-svelte": "^0.67.4", "carbon-components-svelte": "^0.67.4",

View file

@ -12,7 +12,7 @@ specifiers:
'@sveltejs/kit': 1.0.0-next.396 '@sveltejs/kit': 1.0.0-next.396
'@types/cookie': ^0.5.1 '@types/cookie': ^0.5.1
'@types/feather-icons': ^4.7.0 '@types/feather-icons': ^4.7.0
'@types/node': ^18.6.1 '@types/node': ^18.6.2
'@typescript-eslint/eslint-plugin': ^5.31.0 '@typescript-eslint/eslint-plugin': ^5.31.0
'@typescript-eslint/parser': ^5.31.0 '@typescript-eslint/parser': ^5.31.0
carbon-components-svelte: ^0.67.4 carbon-components-svelte: ^0.67.4
@ -50,7 +50,7 @@ devDependencies:
'@sveltejs/adapter-auto': 1.0.0-next.64 '@sveltejs/adapter-auto': 1.0.0-next.64
'@sveltejs/kit': 1.0.0-next.396_svelte@3.49.0+vite@3.0.3 '@sveltejs/kit': 1.0.0-next.396_svelte@3.49.0+vite@3.0.3
'@types/cookie': 0.5.1 '@types/cookie': 0.5.1
'@types/node': 18.6.1 '@types/node': 18.6.2
'@typescript-eslint/eslint-plugin': 5.31.0_d5zwcxr4bwkhmuo464cb3a2puu '@typescript-eslint/eslint-plugin': 5.31.0_d5zwcxr4bwkhmuo464cb3a2puu
'@typescript-eslint/parser': 5.31.0_he2ccbldppg44uulnyq4rwocfa '@typescript-eslint/parser': 5.31.0_he2ccbldppg44uulnyq4rwocfa
carbon-components-svelte: 0.67.4 carbon-components-svelte: 0.67.4
@ -196,7 +196,7 @@ packages:
engines: {node: '>=14'} engines: {node: '>=14'}
hasBin: true hasBin: true
dependencies: dependencies:
'@types/node': 18.6.1 '@types/node': 18.6.2
playwright-core: 1.24.1 playwright-core: 1.24.1
dev: true dev: true
@ -315,8 +315,8 @@ packages:
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
dev: true dev: true
/@types/node/18.6.1: /@types/node/18.6.2:
resolution: {integrity: sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg==} resolution: {integrity: sha512-KcfkBq9H4PI6Vpu5B/KoPeuVDAbmi+2mDBqGPGUgoL7yXQtcWGu2vJWmmRkneWK3Rh0nIAX192Aa87AqKHYChQ==}
dev: true dev: true
/@types/pug/2.0.6: /@types/pug/2.0.6:
@ -326,7 +326,7 @@ packages:
/@types/sass/1.43.1: /@types/sass/1.43.1:
resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==} resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
dependencies: dependencies:
'@types/node': 18.6.1 '@types/node': 18.6.2
dev: true dev: true
/@typescript-eslint/eslint-plugin/5.31.0_d5zwcxr4bwkhmuo464cb3a2puu: /@typescript-eslint/eslint-plugin/5.31.0_d5zwcxr4bwkhmuo464cb3a2puu:

View file

@ -1,34 +1,33 @@
<script lang="ts"> <script lang="ts">
export let labelText: string; export let labelText: string;
export let showLabel: boolean; export let showLabel: boolean;
export let name: string;
export let value: boolean;
export let onChange: FormDataEvent<HTMLInputElement>;
</script> </script>
<label htmlFor={`${guest.id}`} className="checkbox"> <label for={name} class="checkbox">
<span class="checkbox__input"> <span class="checkbox__input">
<input <input id={name} {name} checked={value} on:change={onChange} type="checkbox" />
id={`${guest.id}`}
name={`${guest.id}`}
checked={inputs[`${guest.id}`].plusOne}
onChange={onChangePlusOne}
type="checkbox"
/>
<span class="checkbox__control"> <span class="checkbox__control">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24" view-box="0 0 24 24"
aria-hidden="true" aria-hidden="true"
focusable="false" focusable="false"
> >
<path <path
fill="none" fill="none"
stroke="currentColor" stroke="currentColor"
strokeWidth="3" stroke-width="3"
d="M1.73 12.91l6.37 6.37L22.79 4.59" d="M1.73 12.91l6.37 6.37L22.79 4.59"
/> />
</svg> </svg>
</span> </span>
</span> </span>
<span class="checkbox__label">Plus one? </span> {#if showLabel}
<span class="checkbox__label">{labelText}</span>
{/if}
</label> </label>
<style lang="scss"> <style lang="scss">

View file

@ -1,12 +1,7 @@
<script lang="ts"> <script lang="ts">
// import {
// Theme,
// RadioButtonGroup,
// RadioButton,
// } from "carbon-components-svelte";
// import type { CarbonTheme } from "carbon-components-svelte/types/Theme/Theme.svelte";
import { page } from '$app/stores'; import { page } from '$app/stores';
import Themes from '$lib/components/preferences/themes.svelte'; import Themes from '$lib/components/preferences/themes.svelte';
import Profile from '../preferences/profile.svelte';
import logo from './bored-game.png'; import logo from './bored-game.png';
// let theme: CarbonTheme = "white"; // let theme: CarbonTheme = "white";
@ -20,13 +15,8 @@
</div> </div>
<nav> <nav>
<!-- <ul>
<li class:active={$page.url.pathname === '/'}><a sveltekit:prefetch href="/">Home</a></li>
<li class:active={$page.url.pathname === '/about'}>
<a sveltekit:prefetch href="/about">About</a>
</li>
</ul> -->
<div><Themes /></div> <div><Themes /></div>
<!-- <div><Profile /></div> -->
</nav> </nav>
</header> </header>
@ -35,14 +25,12 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
/* box-shadow: var(--level-2); */
padding: 0 var(--containerPadding); padding: 0 var(--containerPadding);
font-size: 1.6rem; font-size: 1.6rem;
@media (max-width: 1000px) { @media (max-width: 1000px) {
padding-top: 1.25rem; padding-top: 1.25rem;
} }
/* max-width: 1000px; */
} }
.corner { .corner {

View file

@ -0,0 +1,25 @@
<script lang="ts">
import { Popover, PopoverButton, PopoverPanel } from '@rgossiaux/svelte-headlessui';
</script>
<Popover style="position: relative;">
<PopoverButton>Solutions</PopoverButton>
<PopoverPanel style="position: absolute; z-index: 10;">
<div class="panel-contents">
<a href="/analytics">Analytics</a>
<a href="/engagement">Engagement</a>
<a href="/security">Security</a>
<a href="/integrations">Integrations</a>
</div>
<img src="/solutions.jpg" alt="" />
</PopoverPanel>
</Popover>
<style lang="scss">
.panel-contents {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
</style>

View file

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { Checkbox } from 'carbon-components-svelte';
import { boredState } from '$lib/stores/boredState'; import { boredState } from '$lib/stores/boredState';
import { gameStore } from '$lib/stores/gameSearchStore'; import { gameStore } from '$lib/stores/gameSearchStore';
@ -50,7 +49,15 @@
/> />
Min Players Min Players
</label> </label>
<Checkbox name="exactMinPlayers" labelText="Search exact?" bind:checked={exactMinPlayers} /> <label htmlfor="exactMinPlayers">
<input
id="exactMinPlayers"
type="checkbox"
name="exactMinPlayers"
bind:checked={exactMinPlayers}
/>
<span>Exact?</span>
</label>
</div> </div>
<div> <div>
<label htmlfor="maxPlayers"> <label htmlfor="maxPlayers">
@ -71,7 +78,7 @@
name="exactMaxPlayers" name="exactMaxPlayers"
bind:checked={exactMaxPlayers} bind:checked={exactMaxPlayers}
/> />
<span>Search exact?</span> <span>Exact?</span>
</label> </label>
</div> </div>
</fieldset> </fieldset>

View file

@ -17,41 +17,59 @@
gameStore.addAll(responseData?.games); gameStore.addAll(responseData?.games);
} }
export const showButton = false;
let submitting = $boredState?.loading; let submitting = $boredState?.loading;
let name = ''; let name = '';
</script> </script>
<form on:submit|preventDefault={handleSearch} method="post"> <form on:submit|preventDefault={handleSearch} method="post">
<fieldset aria-busy={submitting} disabled={submitting}> <fieldset aria-busy={submitting} disabled={submitting}>
<div> <label for="name">
<label htmlfor="name"> Search
Search <input
<input id="name" name="name" bind:value={name} type="text" placeholder="Enter name" /> id="name"
</label> name="name"
</div> bind:value={name}
type="text"
aria-label="Search boardgame"
placeholder="Search boardgame"
/>
{#if showButton}
<button class="btn" type="submit" disabled={submitting}>Search</button>
{/if}
</label>
</fieldset> </fieldset>
<button type="submit" disabled={submitting}>Search</button>
</form> </form>
<style lang="scss"> <style lang="scss">
form {
display: grid;
grid-template-columns: 1fr 1fr;
place-items: start;
}
h1 { h1 {
width: 100%; width: 100%;
} }
button { button {
border-radius: 10px; max-height: 5rem;
margin: 0.5rem; padding: 2rem;
padding: 1rem; /* border-radius: 10px; */
color: var(--clr-input-txt); /* margin: 0.5rem; */
background-color: var(--color-btn-primary-active); /* padding: 1rem; */
/* color: var(--clr-input-txt); */
/* background-color: var(--color-btn-primary-active); */
} }
fieldset { fieldset {
display: grid; /* grid-template-columns: repeat(3, 1fr); */
grid-template-columns: repeat(3, 1fr);
} }
label { label {
display: grid; display: grid;
grid-template-columns: auto auto auto;
gap: 1rem;
place-items: center;
margin: 1rem; margin: 1rem;
} }
</style> </style>