Files
scrabble-game/ui/src/components/TabBar.svelte
T
Ilia Denisov ab1ad998aa
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 13s
CI / ui (pull_request) Successful in 52s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m19s
feat(ui): batch of UI polish tweaks
- admin dashboard "Users" count excludes robots (CountUsers, humans only)
- lobby finished-game delete reveal: background matches header/tab-bar (--bg-elev)
- mobile: swipe up on the zoom-out board (no staged tiles) shuffles the rack
- lobby: status icons -25%, game-row top/bottom padding halved
- toast: info tier drifts up ~a tab-bar height while fading over 2s and dismisses
  on tap; error tier unchanged
- game: confirm-move button stays pinned at the right edge; rack tiles shrink to
  fit so a full rack never overflows onto it
- telegram: a successful invite-link redeem shows a welcome window pointing at the bot
- settings: remove the grid-lines toggle; the board is always a gapless checkerboard
- settings/comms hubs: the selected tab highlight wraps icon + label as a pill

Docs: UI_DESIGN (toast, board surface, selected tab), PLAN; e2e updated for the
removed grid-lines toggle.
2026-06-19 08:56:29 +02:00

101 lines
3.0 KiB
Svelte

<script lang="ts">
import type { Snippet } from 'svelte';
// The bottom tab bar: square borderless buttons, evenly distributed, mobile-OS feel.
// Direct children (plain `.tab` buttons or TapConfirm wrappers) share the width.
let { children }: { children?: Snippet } = $props();
</script>
<div class="tabbar">{@render children?.()}</div>
<style>
.tabbar {
display: flex;
gap: 12px;
padding: 8px var(--pad);
background: var(--bg-elev);
border-top: 1px solid var(--border);
user-select: none;
-webkit-user-select: none;
}
:global(.tabbar > *) {
flex: 1 1 0;
min-width: 0;
}
/* Tab face: an icon square (the press-highlight target) + a tiny truncated label. */
:global(.tab) {
display: flex;
flex-direction: column;
align-items: center;
gap: 0;
background: none;
border: none;
padding: 1px 0;
color: var(--text);
width: 100%;
user-select: none;
-webkit-user-select: none;
-webkit-tap-highlight-color: transparent; /* no WebKit flash on tap */
}
:global(.tab:disabled) {
opacity: 0.4;
}
/* The icon square hugs the emoji (just a little padding) so the badge can sit on its
corner. */
:global(.tab .sq) {
position: relative;
display: inline-grid;
place-items: center;
padding: 3px 10px;
border-radius: 12px;
font-size: 1.75rem;
line-height: 1;
transition: background-color 0.12s;
}
/* A tab that navigates between peer views (Settings / Comms hubs) wraps its icon and label
in a .face so the selected highlight hugs both — a filled pill with an accent underline,
sized to the content with a small padding. A tap itself leaves no highlight (no press
tint, and the WebKit tap flash is disabled on .tab). Plain action tabs (the lobby nav,
the in-game controls) carry no .face and are never .active, so they are unaffected. */
:global(.tab .face) {
display: inline-flex;
flex-direction: column;
align-items: center;
padding: 3px 10px;
border-radius: 12px;
transition: background-color 0.12s;
}
/* Inside a face the icon square needs no padding of its own — the face provides the
surround (the bare .sq padding still applies to the unwrapped action tabs). */
:global(.tab .face .sq) {
padding: 0;
}
:global(.tab.active .face) {
background: var(--surface-2);
box-shadow: inset 0 -2px 0 var(--accent);
}
/* A small count badge on the icon square's corner (lobby ⚙️, the Friends tab, the
hint count) — one shared style so every tab badge reads the same. */
:global(.tab .badge) {
position: absolute;
top: -3px;
right: -3px;
font-size: 0.68rem;
font-weight: 700;
background: var(--accent);
color: var(--accent-text);
border-radius: 999px;
min-width: 15px;
padding: 0 3px;
line-height: 1.4;
text-align: center;
}
:global(.tab .lbl) {
font-size: 0.62rem;
color: var(--text-muted);
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>