mirror of
https://github.com/bitbaum/kits.git
synced 2026-12-04 06:17:56 +01:00
- rememberLocale (+ switchLocaleHref, localeCookie, isSafeNextPath): the route that remembers a reader's language in an app with no language in its URL; relative 303, checked next, Secure over HTTPS (sbb-fundbuero's lessons) - alternateLanguages: hreflang alternates for Next metadata - langkit check --code <dirs> [--fail-unused]: messages no code appears to ask for; measured on eight apps, hand-traced samples were dead messages - fix: with nineteen languages the switcher widened a 390px page to 1081px inside sitekit's masthead; now it scrolls inside itself. Checked in a real browser at 320/390/1280px - first public version: private removed, 0.2.0 (0.1.0 was never published) Claude-Session: https://claude.ai/code/session_019MDtmsTRGc34xnG6koVuAY Co-authored-by: Claude <noreply@anthropic.com>
62 lines
1.6 KiB
CSS
62 lines
1.6 KiB
CSS
/*
|
|
* @bitbaum/langkit — the language switcher.
|
|
*
|
|
* One row of equal cells, each a 44px target; many languages scroll sideways
|
|
* rather than wrap. Colours follow the app: set --lk-* or let them fall back
|
|
* to sitekit's (--sk-fg, --sk-muted, --sk-focus, --sk-radius).
|
|
*/
|
|
.lk-switcher {
|
|
--lk-fg: var(--sk-muted, currentColor);
|
|
--lk-fg-current: var(--sk-fg, CanvasText);
|
|
--lk-ring: var(--sk-focus, currentColor);
|
|
min-width: 0;
|
|
max-width: 100%;
|
|
overflow-x: auto;
|
|
scrollbar-width: none;
|
|
}
|
|
/* sitekit's actions slot keeps its full width (flex-shrink: 0), which is right
|
|
for an account button and wrong for a row of nineteen languages: the phone
|
|
page scrolled sideways to 1081px at 390. Holding a switcher, the slot may
|
|
shrink, and the switcher scrolls inside it instead. */
|
|
.sk-account-actions:has(> .lk-switcher) {
|
|
flex-shrink: 1;
|
|
min-width: 0;
|
|
}
|
|
.lk-switcher-list {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.125rem;
|
|
margin: 0;
|
|
padding: 0;
|
|
list-style: none;
|
|
}
|
|
.lk-switcher-item {
|
|
flex: 0 0 auto;
|
|
}
|
|
.lk-switcher-link {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-sizing: border-box;
|
|
min-width: 2.75rem;
|
|
min-height: 2.75rem;
|
|
padding: 0 0.5rem;
|
|
border-radius: var(--sk-radius, 0.5rem);
|
|
color: var(--lk-fg);
|
|
font-size: 0.875rem;
|
|
line-height: 1;
|
|
text-decoration: none;
|
|
white-space: nowrap;
|
|
}
|
|
.lk-switcher-link:hover {
|
|
color: var(--lk-fg-current);
|
|
}
|
|
.lk-switcher-link[aria-current="true"] {
|
|
color: var(--lk-fg-current);
|
|
font-weight: 600;
|
|
}
|
|
.lk-switcher-link:focus-visible {
|
|
outline: 2px solid var(--lk-ring);
|
|
outline-offset: -2px;
|
|
}
|