[ui] DomiUi: Rosea's buttons and town search on @domi/ui v1.0.4 (CPAL-1.0, vendored by its own tool into packages/domi-ui), the licence credit at the foot of every screen, the README's copy line and public-domain sources; before-and-after pictures by pnpm look:shots
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '@domi/ui';
|
||||
import type { NamedPlace } from '@rosea/engine';
|
||||
import { en } from '../copy/en.js';
|
||||
import SunsetLine from './SunsetLine.svelte';
|
||||
@@ -87,8 +88,8 @@
|
||||
<p>{en.sunset.noTown}</p>
|
||||
{/if}
|
||||
<div class="choices">
|
||||
<button type="button" onclick={(e) => { e.stopPropagation(); showing += 1; }}>{en.chair.again}</button>
|
||||
<button type="button" class="quiet" onclick={(e) => { e.stopPropagation(); leave(); }}>{en.chair.back}</button>
|
||||
<Button onclick={(e) => { e.stopPropagation(); showing += 1; }}>{en.chair.again}</Button>
|
||||
<Button variant="quiet" onclick={(e) => { e.stopPropagation(); leave(); }}>{en.chair.back}</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -186,27 +187,25 @@
|
||||
|
||||
.choices {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
button {
|
||||
font: inherit;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border-radius: 999px;
|
||||
border: 1px solid #f4d58d;
|
||||
background: transparent;
|
||||
color: #fbf6f1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.quiet {
|
||||
border: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
button:focus-visible {
|
||||
outline: 2px solid #f4d58d;
|
||||
outline-offset: 2px;
|
||||
/* @domi/ui's buttons on dusk, whatever the page's theme: the plate is the evening's own glass with the
|
||||
sunset's gold edge, as Rosea's button was (domi-ui.md D5). */
|
||||
.choices {
|
||||
--domi-fg: var(--ink);
|
||||
--domi-fg-2: var(--ink-soft);
|
||||
--domi-edge: #f4d58d;
|
||||
--domi-accent: #f4d58d;
|
||||
--domi-plate: linear-gradient(180deg, #ffffff1f, #ffffff0a);
|
||||
--domi-plate-hover: linear-gradient(180deg, #ffffff2e, #ffffff12);
|
||||
--domi-plate-press: linear-gradient(180deg, #00000033, #ffffff0a);
|
||||
--domi-plate-shadow: inset 0 1px 0 #ffffff33, 0 8px 18px -12px #000000cc;
|
||||
--domi-plate-shadow-hover: inset 0 1px 0 #ffffff47, 0 10px 22px -12px #000000e6;
|
||||
--domi-tint: #f4d58d24;
|
||||
--domi-tint-strong: #f4d58d38;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Button, TextField } from '@domi/ui';
|
||||
import type { NamedPlace } from '@rosea/engine';
|
||||
import { en } from '../copy/en.js';
|
||||
import type { SunsetChoice } from './types.js';
|
||||
@@ -28,7 +29,7 @@
|
||||
let query = $state('');
|
||||
// Raw: the towns are handed on as they came, never wrapped in a state Proxy.
|
||||
let results = $state.raw<readonly NamedPlace[]>([]);
|
||||
let input = $state<HTMLInputElement>();
|
||||
let input = $state<HTMLInputElement | HTMLTextAreaElement | null>(null);
|
||||
|
||||
// Only the latest query's answer is shown, however the searches finish.
|
||||
let asked = 0;
|
||||
@@ -61,15 +62,20 @@
|
||||
<h2 id="{uid}-q">{en.sunset.question}</h2>
|
||||
<p class="why">{en.sunset.why}</p>
|
||||
|
||||
<label for="{uid}-search">{en.sunset.searchLabel}</label>
|
||||
<input
|
||||
<!-- The list already follows the typing; the seal and Enter only confirm it, so they say nothing of their own
|
||||
(sentText) and the status line below speaks (domi-ui.md D4). Nothing is sent anywhere: "search", never "send". -->
|
||||
<TextField
|
||||
id="{uid}-search"
|
||||
type="search"
|
||||
label={en.sunset.searchLabel}
|
||||
action="search"
|
||||
actionLabel={en.sunset.searchAction}
|
||||
sentText=""
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
enterkeyhint="search"
|
||||
spellcheck={false}
|
||||
onsend={() => {}}
|
||||
bind:value={query}
|
||||
bind:this={input}
|
||||
bind:input
|
||||
/>
|
||||
<p class="found" role="status" aria-live="polite">{query.trim() === '' ? '' : en.sunset.found(results.length)}</p>
|
||||
|
||||
@@ -77,10 +83,10 @@
|
||||
<ul>
|
||||
{#each results as town (`${town.name}|${town.lat}|${town.lon}`)}
|
||||
<li>
|
||||
<button type="button" onclick={() => onchoose({ kind: 'town', town })}>
|
||||
<Button block onclick={() => onchoose({ kind: 'town', town })}>
|
||||
<span class="name">{town.name}</span>
|
||||
<span class="where">{where(town)}</span>
|
||||
</button>
|
||||
</Button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
@@ -88,11 +94,11 @@
|
||||
|
||||
<div class="other">
|
||||
{#if current && oncancel}
|
||||
<button type="button" class="quiet" onclick={oncancel}>{en.sunset.keep(current.name)}</button>
|
||||
<Button variant="quiet" onclick={oncancel}>{en.sunset.keep(current.name)}</Button>
|
||||
{/if}
|
||||
<button type="button" class="quiet" onclick={() => onchoose({ kind: 'device-zone' })}>
|
||||
<Button variant="quiet" onclick={() => onchoose({ kind: 'device-zone' })}>
|
||||
{guess ? en.sunset.skip(guess.name) : en.sunset.skipNoGuess}
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -123,19 +129,6 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
input {
|
||||
font: inherit;
|
||||
padding: var(--space-2);
|
||||
border: 1px solid var(--ink-soft);
|
||||
border-radius: 0.5rem;
|
||||
background: var(--paper);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
@@ -144,22 +137,11 @@
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
button {
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
border-radius: 0.5rem;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
li button {
|
||||
/* A town row: its name at the start, its region at the end, on @domi/ui's plate. */
|
||||
li :global(.domi-btn__label) {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2);
|
||||
text-align: start;
|
||||
background: var(--paper);
|
||||
border: 1px solid color-mix(in srgb, var(--ink-soft) 40%, transparent);
|
||||
}
|
||||
|
||||
.where {
|
||||
@@ -172,18 +154,4 @@
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.quiet {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: var(--space-1) 0;
|
||||
color: var(--rose);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
button:focus-visible,
|
||||
input:focus-visible {
|
||||
outline: 2px solid var(--rose);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user