auth

Main authentication module for my projects
git clone git://git.finwo.net/app/auth
Log | Files | Refs

commit 4a0d40ac4263d5bc5dba15ac7ec5ca24bd59f428
parent cca943d35f2e9d5066abb29679a5254365bd12e7
Author: finwo <finwo@pm.me>
Date:   Mon,  2 Nov 2026 01:14:35 +0100

Added mobile overlay navigation

Diffstat:
Mapp/account/src/screen/account.tsx | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mapp/admin/src/screen/admin.tsx | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mapp/shared/component/app-shell.tsx | 25+++++++++++++++++++++++--
Aapp/shared/component/mobile-nav.tsx | 133+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mapp/shared/component/topbar.tsx | 6+++++-
Mapp/shared/component/user-menu.tsx | 80+++++++++++++++++++++++++++++++++++++++++++++++--------------------------------
Mapp/shared/style/global.css | 236++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
Mmockup/plain/account.html | 161+++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
Mmockup/plain/admin-client-detail.html | 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
Mmockup/plain/admin-clients.html | 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
Mmockup/plain/admin-dashboard.html | 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
Mmockup/plain/admin-settings.html | 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
Mmockup/plain/admin-user-detail.html | 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
Mmockup/plain/admin-user-global-detail.html | 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
Mmockup/plain/admin-users.html | 195++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------
Mmockup/plain/global.css | 239+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
Amockup/plain/shell.js | 49+++++++++++++++++++++++++++++++++++++++++++++++++
17 files changed, 1926 insertions(+), 497 deletions(-)

diff --git a/app/account/src/screen/account.tsx b/app/account/src/screen/account.tsx @@ -1,7 +1,8 @@ import { AppWindow, LayoutGrid, ShieldCheck } from 'lucide'; import m from 'mithril'; import { AppShell } from '@component/app-shell'; -import { Nav, type NavItem } from '@component/nav'; +import { type NavItem } from '@component/nav'; +import { MobileNavAccount, MobileNavToggle } from '@component/mobile-nav'; import { StatusPage } from '@component/status-page'; import { Topbar } from '@component/topbar'; import { UserMenu } from '@component/user-menu'; @@ -57,13 +58,37 @@ export const Account: m.Component = { revokePending: false, signedOut: false, theme: getTheme() as Theme, + mobileNavOpen: false, + lastPath: '', + desktopMedia: null as MediaQueryList | null, + onDesktopMediaChange: null as ((event: MediaQueryListEvent) => void) | null, oninit(this: any) { applyTheme(this.theme); + this.lastPath = currentPath(); this.load(); }, + oncreate(this: any) { + this.desktopMedia = window.matchMedia('(min-width: 60em)'); + this.onDesktopMediaChange = (event: MediaQueryListEvent) => { + if (event.matches) this.mobileNavOpen = false; + }; + this.desktopMedia.addEventListener('change', this.onDesktopMediaChange); + }, + + onremove(this: any) { + if (this.desktopMedia && this.onDesktopMediaChange) { + this.desktopMedia.removeEventListener('change', this.onDesktopMediaChange); + } + }, + onupdate(this: any) { + const path = currentPath(); + if (path !== this.lastPath) { + this.lastPath = path; + this.mobileNavOpen = false; + } this.updateTitle(); }, @@ -161,6 +186,14 @@ export const Account: m.Component = { : 'Account'; }, + toggleMobileNav(this: any) { + this.mobileNavOpen = !this.mobileNavOpen; + }, + + closeMobileNav(this: any) { + this.mobileNavOpen = false; + }, + cycleTheme(this: any) { this.theme = cycleTheme(); }, @@ -223,8 +256,15 @@ export const Account: m.Component = { label="Auth account" onclick={(event: Event) => { event.preventDefault(); + this.closeMobileNav(); m.route.set('/'); }} + menuButton={ + <MobileNavToggle + expanded={this.mobileNavOpen} + onToggle={() => this.toggleMobileNav()} + /> + } > <UserMenu name={name || 'Account'} @@ -232,6 +272,7 @@ export const Account: m.Component = { theme={this.theme} onCycleTheme={() => this.cycleTheme()} onSignOut={() => { + this.closeMobileNav(); this.signOut().catch((error: Error) => { this.error = error; m.redraw(); @@ -240,7 +281,26 @@ export const Account: m.Component = { /> </Topbar> } - nav={<Nav label="Account" ariaLabel="Account" items={navItems} />} + navLabel="Account" + navAriaLabel="Account" + navItems={navItems} + accountPanel={ + <MobileNavAccount + name={name || 'Account'} + meta={meta} + theme={this.theme} + onCycleTheme={() => this.cycleTheme()} + onSignOut={() => { + this.closeMobileNav(); + this.signOut().catch((error: Error) => { + this.error = error; + m.redraw(); + }); + }} + /> + } + mobileNavOpen={this.mobileNavOpen} + onMobileNavClose={() => this.closeMobileNav()} > {this.error ? ( <div class="alert" role="alert"> diff --git a/app/admin/src/screen/admin.tsx b/app/admin/src/screen/admin.tsx @@ -1,7 +1,8 @@ import { Activity, AppWindow, LayoutGrid, Settings, Users } from 'lucide'; import m from 'mithril'; import { AppShell } from '@component/app-shell'; -import { Nav, type NavItem } from '@component/nav'; +import { type NavItem } from '@component/nav'; +import { MobileNavAccount, MobileNavToggle } from '@component/mobile-nav'; import { StatusPage } from '@component/status-page'; import { Topbar } from '@component/topbar'; import { UserMenu } from '@component/user-menu'; @@ -127,13 +128,37 @@ export const Admin: m.Component = { error: null as Error | null, authUrl: window.location.origin, theme: getTheme() as Theme, + mobileNavOpen: false, + lastPath: '', + desktopMedia: null as MediaQueryList | null, + onDesktopMediaChange: null as ((event: MediaQueryListEvent) => void) | null, oninit(this: any) { applyTheme(this.theme); + this.lastPath = currentPath(); this.load(); }, + oncreate(this: any) { + this.desktopMedia = window.matchMedia('(min-width: 60em)'); + this.onDesktopMediaChange = (event: MediaQueryListEvent) => { + if (event.matches) this.mobileNavOpen = false; + }; + this.desktopMedia.addEventListener('change', this.onDesktopMediaChange); + }, + + onremove(this: any) { + if (this.desktopMedia && this.onDesktopMediaChange) { + this.desktopMedia.removeEventListener('change', this.onDesktopMediaChange); + } + }, + onupdate(this: any) { + const path = currentPath(); + if (path !== this.lastPath) { + this.lastPath = path; + this.mobileNavOpen = false; + } this.updateTitle(); }, @@ -237,6 +262,14 @@ export const Admin: m.Component = { document.title = title; }, + toggleMobileNav(this: any) { + this.mobileNavOpen = !this.mobileNavOpen; + }, + + closeMobileNav(this: any) { + this.mobileNavOpen = false; + }, + cycleTheme(this: any) { this.theme = cycleTheme(); }, @@ -326,8 +359,15 @@ export const Admin: m.Component = { href={appUrl('/')} onclick={(event: Event) => { event.preventDefault(); + this.closeMobileNav(); m.route.set('/'); }} + menuButton={ + <MobileNavToggle + expanded={this.mobileNavOpen} + onToggle={() => this.toggleMobileNav()} + /> + } > <UserMenu name={user?.name || 'Administrator'} @@ -336,6 +376,7 @@ export const Admin: m.Component = { theme={this.theme} onCycleTheme={() => this.cycleTheme()} onSignOut={() => { + this.closeMobileNav(); adminSignOut().catch((error: Error) => { this.error = error; m.redraw(); @@ -344,7 +385,27 @@ export const Admin: m.Component = { /> </Topbar> } - nav={<Nav label="Administration" ariaLabel="Administration" items={navItems} />} + navLabel="Administration" + navAriaLabel="Administration" + navItems={navItems} + accountPanel={ + <MobileNavAccount + name={user?.name || 'Administrator'} + meta={user?.email || user?.preferred_username || 'Identity provider'} + accountHref={`${this.authUrl}/app/account`} + theme={this.theme} + onCycleTheme={() => this.cycleTheme()} + onSignOut={() => { + this.closeMobileNav(); + adminSignOut().catch((error: Error) => { + this.error = error; + m.redraw(); + }); + }} + /> + } + mobileNavOpen={this.mobileNavOpen} + onMobileNavClose={() => this.closeMobileNav()} > {this.error ? ( <div class="alert" role="alert"> diff --git a/app/shared/component/app-shell.tsx b/app/shared/component/app-shell.tsx @@ -1,8 +1,15 @@ import m from 'mithril'; +import { Nav, type NavItem } from '@component/nav'; +import { MobileNav } from '@component/mobile-nav'; interface AppShellAttrs { topbar: m.Children; - nav: m.Children; + navLabel: string; + navAriaLabel: string; + navItems: NavItem[]; + accountPanel?: m.Children; + mobileNavOpen: boolean; + onMobileNavClose: () => void; } export const AppShell: m.Component<AppShellAttrs> = { @@ -11,11 +18,25 @@ export const AppShell: m.Component<AppShellAttrs> = { <div class="app-shell"> {attrs.topbar} <div class="app"> - <aside class="sidebar">{attrs.nav}</aside> + <aside class="sidebar"> + <Nav + label={attrs.navLabel} + ariaLabel={attrs.navAriaLabel} + items={attrs.navItems} + /> + </aside> <div class="main"> <main class="content">{children}</main> </div> </div> + <MobileNav + label={attrs.navLabel} + ariaLabel={attrs.navAriaLabel} + items={attrs.navItems} + accountPanel={attrs.accountPanel} + open={attrs.mobileNavOpen} + onClose={attrs.onMobileNavClose} + /> </div> ); }, diff --git a/app/shared/component/mobile-nav.tsx b/app/shared/component/mobile-nav.tsx @@ -0,0 +1,133 @@ +import m from 'mithril'; +import { Nav, type NavItem } from '@component/nav'; +import { AccountActions, type UserMenuAttrs } from '@component/user-menu'; + +export interface MobileNavToggleAttrs { + expanded: boolean; + onToggle: () => void; +} + +export const MobileNavToggle: m.Component<MobileNavToggleAttrs> = { + view({ attrs }) { + const label = attrs.expanded ? 'Close navigation' : 'Open navigation'; + + return ( + <button + id="mobile-nav-toggle" + class={`mobile-nav-toggle${attrs.expanded ? ' is-open' : ''}`} + type="button" + aria-controls="mobile-navigation" + aria-expanded={attrs.expanded ? 'true' : 'false'} + aria-label={label} + onclick={attrs.onToggle} + > + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + ); + }, +}; + +export const MobileNavAccount: m.Component<UserMenuAttrs> = { + view({ attrs }) { + return ( + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">{attrs.name}</span> + <span class="user-meta">{attrs.meta}</span> + </div> + <AccountActions + accountHref={attrs.accountHref} + theme={attrs.theme} + onCycleTheme={attrs.onCycleTheme} + onSignOut={attrs.onSignOut} + /> + </section> + ); + }, +}; + +export interface MobileNavAttrs { + label: string; + ariaLabel: string; + items: NavItem[]; + accountPanel?: m.Children; + open: boolean; + onClose: () => void; +} + +export const MobileNav: m.Component<MobileNavAttrs> = { + oncreate(this: any, vnode: m.Vnode<MobileNavAttrs>) { + this.attrs = vnode.attrs; + this.open = Boolean(vnode.attrs.open); + this.applyState(this.open); + this.onKeydown = (event: KeyboardEvent) => { + if (event.key === 'Escape' && this.open) { + this.attrs.onClose(); + m.redraw(); + } + }; + window.addEventListener('keydown', this.onKeydown); + }, + + onupdate(this: any, vnode: m.Vnode<MobileNavAttrs>) { + this.attrs = vnode.attrs; + const open = Boolean(vnode.attrs.open); + if (open === this.open) return; + + if (open) { + this.focusBefore = document.activeElement; + } + + this.applyState(open); + + if (!open) { + (this.focusBefore as HTMLElement | null)?.focus?.(); + this.focusBefore = null; + } + }, + + onremove(this: any) { + window.removeEventListener('keydown', this.onKeydown); + this.applyState(false); + }, + + applyState(this: any, open: boolean) { + this.open = open; + document.documentElement.classList.toggle('mobile-nav-open', open); + + const main = document.querySelector('.main') as HTMLElement | null; + if (main) (main as any).inert = open; + }, + + view({ attrs }) { + const items = attrs.items.map((item) => ({ + ...item, + onclick: (event: Event) => { + attrs.onClose(); + item.onclick?.(event); + }, + })); + + return ( + <div + id="mobile-navigation" + class={`mobile-nav${attrs.open ? ' is-open' : ''}`} + aria-hidden={attrs.open ? null : 'true'} + onclick={(event: MouseEvent) => { + const target = event.target as Element | null; + if (!target?.closest('.nav-item')) { + if (!target?.closest('.user-menu-item, button, a')) attrs.onClose(); + } + }} + > + <Nav label={attrs.label} ariaLabel={attrs.ariaLabel} items={items} /> + {attrs.accountPanel ? ( + <> + <div class="mobile-nav-divider" aria-hidden="true"></div> + {attrs.accountPanel} + </> + ) : null} + </div> + ); + }, +}; diff --git a/app/shared/component/topbar.tsx b/app/shared/component/topbar.tsx @@ -7,6 +7,7 @@ interface TopbarAttrs { brandName?: string; label?: string; onclick?: (event: Event) => void; + menuButton?: m.Children; } export const Topbar: m.Component<TopbarAttrs> = { @@ -22,7 +23,10 @@ export const Topbar: m.Component<TopbarAttrs> = { {Icon(Hexagon, { class: 'brand-icon' })} <span class="brand-name">{attrs.brandName || 'Auth'}</span> </a> - {children} + <div class="topbar-actions"> + {attrs.menuButton} + {children} + </div> </header> ); }, diff --git a/app/shared/component/user-menu.tsx b/app/shared/component/user-menu.tsx @@ -3,15 +3,54 @@ import m from 'mithril'; import { themeLabel, type Theme } from '@util/theme'; import { Icon } from '@component/icon'; -interface UserMenuAttrs { - name: string; - meta: string; +export interface AccountActionsAttrs { accountHref?: string; theme: Theme; onCycleTheme: () => void; onSignOut: () => void; } +export interface UserMenuAttrs extends AccountActionsAttrs { + name: string; + meta: string; +} + +export const AccountActions: m.Component<AccountActionsAttrs> = { + view({ attrs }) { + return ( + <div class="user-menu-list"> + {attrs.accountHref ? ( + <a class="user-menu-item" href={attrs.accountHref}> + {Icon(Settings)} + <span>Account settings</span> + </a> + ) : null} + <button + class="user-menu-item" + type="button" + aria-label={`Theme: ${themeLabel(attrs.theme)}`} + onclick={attrs.onCycleTheme} + > + {Icon(Sun)} + <span>Theme</span> + <span class="user-menu-value">{themeLabel(attrs.theme)}</span> + </button> + <a + class="user-menu-item" + href="#" + onclick={(event: Event) => { + event.preventDefault(); + attrs.onSignOut(); + }} + > + {Icon(LogOut)} + <span>Sign out</span> + </a> + </div> + ); + }, +}; + export const UserMenu: m.Component<UserMenuAttrs> = { view({ attrs }) { return ( @@ -34,35 +73,12 @@ export const UserMenu: m.Component<UserMenuAttrs> = { <span class="user-name">{attrs.name}</span> <span class="user-meta">{attrs.meta}</span> </div> - <div class="user-menu-list"> - {attrs.accountHref ? ( - <a class="user-menu-item" href={attrs.accountHref}> - {Icon(Settings)} - <span>Account settings</span> - </a> - ) : null} - <button - class="user-menu-item" - type="button" - aria-label={`Theme: ${themeLabel(attrs.theme)}`} - onclick={attrs.onCycleTheme} - > - {Icon(Sun)} - <span>Theme</span> - <span class="user-menu-value">{themeLabel(attrs.theme)}</span> - </button> - <a - class="user-menu-item" - href="#" - onclick={(event: Event) => { - event.preventDefault(); - attrs.onSignOut(); - }} - > - {Icon(LogOut)} - <span>Sign out</span> - </a> - </div> + <AccountActions + accountHref={attrs.accountHref} + theme={attrs.theme} + onCycleTheme={attrs.onCycleTheme} + onSignOut={attrs.onSignOut} + /> </div> </details> ); diff --git a/app/shared/style/global.css b/app/shared/style/global.css @@ -24,6 +24,7 @@ --field-line: rgba(0, 0, 0, 0.42); --shadow: 0 0.125em 0.25em #0008; --hex: url('./assets/hex-grid-light.svg'); + --topbar-height: 3.5rem; } *, @@ -49,7 +50,8 @@ body { -webkit-font-smoothing: antialiased; } -html.modal-open body { +html.modal-open body, +html.mobile-nav-open body { overflow: hidden; } @@ -68,12 +70,12 @@ textarea { .topbar { position: sticky; top: 0; - z-index: 20; + z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 1rem; - min-height: 3.5rem; + min-height: var(--topbar-height); padding: env(safe-area-inset-top) max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left)); background: var(--topbar); @@ -101,19 +103,28 @@ textarea { line-height: 1.3; } +.topbar-actions { + display: flex; + align-items: center; + gap: 0.75rem; +} + +.topbar .user-menu { + display: none; +} + .app { display: grid; grid-template-columns: minmax(0, 1fr); - grid-template-rows: auto minmax(0, 1fr); - min-height: calc(100vh - 3.5rem); - min-height: calc(100svh - 3.5rem); + grid-template-rows: minmax(0, 1fr); + min-height: calc(100vh - var(--topbar-height)); + min-height: calc(100svh - var(--topbar-height)); } .sidebar { min-width: 0; - display: flex; + display: none; flex-direction: column; - min-height: auto; background: var(--sidebar); color: #fff; } @@ -192,6 +203,155 @@ textarea { color: #fff; } +.mobile-nav-toggle { + position: relative; + display: grid; + place-items: center; + width: 2.5rem; + height: 2.5rem; + padding: 0; + border: 0; + background: transparent; + color: rgba(255, 255, 255, 0.86); + cursor: pointer; + touch-action: manipulation; + user-select: none; + -webkit-tap-highlight-color: transparent; +} + +.mobile-nav-toggle:hover, +.mobile-nav-toggle.is-open { + color: #fff; +} + +.mobile-nav-toggle-bars, +.mobile-nav-toggle-bars::before, +.mobile-nav-toggle-bars::after { + position: absolute; + width: 1.25rem; + height: 1pt; + background: currentColor; + transition: transform 0.3s ease; +} + +.mobile-nav-toggle-bars::before, +.mobile-nav-toggle-bars::after { + content: ''; + left: 0; +} + +.mobile-nav-toggle-bars::before { + top: -0.5rem; +} + +.mobile-nav-toggle-bars::after { + top: 0.5rem; +} + +.mobile-nav-toggle.is-open .mobile-nav-toggle-bars { + background: transparent; +} + +.mobile-nav-toggle.is-open .mobile-nav-toggle-bars::before { + transform: translateY(0.5rem) rotate(45deg); +} + +.mobile-nav-toggle.is-open .mobile-nav-toggle-bars::after { + transform: translateY(-0.5rem) rotate(-45deg); +} + +.mobile-nav { + position: fixed; + top: calc(var(--topbar-height) + env(safe-area-inset-top)); + right: max(0rem, env(safe-area-inset-right)); + bottom: 0; + left: max(0rem, env(safe-area-inset-left)); + z-index: 30; + overflow-y: auto; + overscroll-behavior: contain; + background: var(--sidebar); + color: #fff; + visibility: hidden; + opacity: 0; + transform: translateX(100%); + pointer-events: none; + transition: + transform 0.3s ease, + opacity 0.2s ease, + visibility 0.3s; +} + +html.mobile-nav-open .mobile-nav { + visibility: visible; + opacity: 1; + transform: none; + pointer-events: auto; +} + +.mobile-nav .nav { + min-width: 0; + min-height: 0; + flex-direction: column; + flex-wrap: nowrap; + overflow: visible; + padding: 1rem max(1.5rem, env(safe-area-inset-right)) + calc(1rem + env(safe-area-inset-bottom)) + max(1.5rem, env(safe-area-inset-left)); + gap: 0.25rem; +} + +.mobile-nav .nav-label { + display: block; + padding: 0.5rem 0; +} + +.mobile-nav .nav-item { + width: 100%; + flex: none; + justify-content: flex-start; + padding-inline: 1rem; + text-align: left; + opacity: 0; + transform: translateX(2rem); + transition: + opacity 0.2s ease 0.2s, + transform 0.3s ease 0.2s; +} + +html.mobile-nav-open .mobile-nav .nav-item { + opacity: 1; + transform: none; +} + +.mobile-nav .nav-item span { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip-path: none; + display: inline; + white-space: normal; +} + +.mobile-nav-divider { + height: 1pt; + margin: 1rem 1.5rem; + background: rgba(255, 255, 255, 0.18); +} + +.mobile-nav-account { + margin: 0 1.5rem calc(1rem + env(safe-area-inset-bottom)); +} + +.mobile-nav-account .user-summary { + padding-inline: 0; +} + +.mobile-nav-account .user-menu-list { + padding: 0; +} + .main { display: flex; flex-direction: column; @@ -1000,21 +1160,6 @@ select:focus-visible { width: 1%; } - .nav-item { - padding-inline: 1rem; - } - - .nav-item span { - position: static; - width: auto; - height: auto; - margin: 0; - overflow: visible; - clip-path: none; - display: inline; - white-space: normal; - } - .details > div { grid-template-columns: 8.5rem minmax(0, 1fr); } @@ -1067,8 +1212,18 @@ select:focus-visible { } .sidebar { - min-height: calc(100vh - 3.5rem); - min-height: calc(100svh - 3.5rem); + display: flex; + min-height: calc(100vh - var(--topbar-height)); + min-height: calc(100svh - var(--topbar-height)); + } + + .mobile-nav-toggle, + .mobile-nav { + display: none; + } + + .topbar .user-menu { + display: block; } .nav { @@ -1076,10 +1231,13 @@ select:focus-visible { overflow: visible; flex-direction: column; flex-wrap: nowrap; + padding: 0.75rem 0; + gap: 0; } .nav-label { display: block; + padding: 0.5rem 1.5rem; } .nav-item { @@ -1089,6 +1247,20 @@ select:focus-visible { padding-inline: 1.5rem; justify-content: flex-start; text-align: left; + opacity: 1; + transform: none; + transition: none; + } + + .nav-item span { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip-path: none; + display: inline; + white-space: normal; } .grid { @@ -1110,6 +1282,7 @@ select:focus-visible { touch-action: manipulation; } + .mobile-nav-toggle, .user-menu summary, .modal-close { min-width: 2.75rem; @@ -1142,6 +1315,19 @@ select:focus-visible { .spinner { animation: none; } + + .mobile-nav, + .mobile-nav .nav-item, + .mobile-nav-toggle-bars, + .mobile-nav-toggle-bars::before, + .mobile-nav-toggle-bars::after { + transition: none; + } + + .mobile-nav, + .mobile-nav .nav-item { + transform: none; + } } @media (prefers-color-scheme: dark) { diff --git a/mockup/plain/account.html b/mockup/plain/account.html @@ -206,47 +206,115 @@ </svg> <span class="brand-name">Auth</span> </a> - <details class="user-menu" open> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu" open> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">Demo User</span> + <span class="user-meta">demo@example.com</span> + </div> + <div class="user-menu-list"> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Account"> + <p class="nav-label">Account</p> + <a class="nav-item is-active" href="#" data-nav="overview" aria-current="page"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">Demo User</span> - <span class="user-meta">demo@example.com</span> - </div> - <div class="user-menu-list"> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item" href="#" data-nav="security"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" /> + </svg> + <span>Security</span> + </a> + <a class="nav-item" href="#" data-nav="apps"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <path d="M14 17.5h7" /> + <path d="M17.5 14v7" /> + </svg> + <span>Apps</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">Demo User</span> + <span class="user-meta">demo@example.com</span> </div> - </details> - </header> + <div class="user-menu-list"> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -578,8 +646,8 @@ const navItems = document.querySelectorAll('[data-nav]'); const views = document.querySelectorAll('main [data-view]'); const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setView(name) { @@ -616,9 +684,9 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } viewButtons.forEach((button) => { @@ -629,9 +697,11 @@ button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); navItems.forEach((item) => { @@ -665,5 +735,6 @@ setTheme(initialTheme); } </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/admin-client-detail.html b/mockup/plain/admin-client-detail.html @@ -14,54 +14,142 @@ </svg> <span class="brand-name">Auth</span> </a> - <details class="user-menu"> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu"> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> + </div> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Administration"> + <p class="nav-label">Administration</p> + <a class="nav-item" href="./admin-dashboard.html"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">System Admin</span> - <span class="user-meta">admin@system.test</span> - </div> - <div class="user-menu-list"> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> - <circle cx="12" cy="12" r="3" /> - </svg> - <span>Account settings</span> - </a> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item is-active" href="./admin-clients.html" aria-current="page"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="2" y="4" width="20" height="16" rx="2" /> + <path d="M10 4v4" /> + <path d="M2 8h20" /> + <path d="M6 4v4" /> + </svg> + <span>Clients</span> + </a> + <a class="nav-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M22 12h-4l-3 8-6-16-3 8H2" /> + </svg> + <span>Sessions</span> + </a> + <a class="nav-item" href="./admin-users.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /> + <circle cx="12" cy="7" r="4" /> + </svg> + <span>Users</span> + </a> + <a class="nav-item" href="./admin-settings.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Settings</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> </div> - </details> - </header> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -207,8 +295,8 @@ <script> const root = document.documentElement; const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setTheme(value) { @@ -221,18 +309,20 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } themeButtons.forEach((button) => { button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); const userMenu = document.querySelector('.user-menu'); @@ -275,5 +365,6 @@ } }); </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/admin-clients.html b/mockup/plain/admin-clients.html @@ -14,54 +14,142 @@ </svg> <span class="brand-name">Auth</span> </a> - <details class="user-menu"> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu"> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> + </div> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Administration"> + <p class="nav-label">Administration</p> + <a class="nav-item" href="./admin-dashboard.html"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">System Admin</span> - <span class="user-meta">admin@system.test</span> - </div> - <div class="user-menu-list"> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> - <circle cx="12" cy="12" r="3" /> - </svg> - <span>Account settings</span> - </a> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item is-active" href="./admin-clients.html" aria-current="page"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="2" y="4" width="20" height="16" rx="2" /> + <path d="M10 4v4" /> + <path d="M2 8h20" /> + <path d="M6 4v4" /> + </svg> + <span>Clients</span> + </a> + <a class="nav-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M22 12h-4l-3 8-6-16-3 8H2" /> + </svg> + <span>Sessions</span> + </a> + <a class="nav-item" href="./admin-users.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /> + <circle cx="12" cy="7" r="4" /> + </svg> + <span>Users</span> + </a> + <a class="nav-item" href="./admin-settings.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Settings</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> </div> - </details> - </header> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -273,8 +361,8 @@ <script> const root = document.documentElement; const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setTheme(value) { @@ -287,18 +375,20 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } themeButtons.forEach((button) => { button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); const userMenu = document.querySelector('.user-menu'); @@ -360,5 +450,6 @@ }); }); </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/admin-dashboard.html b/mockup/plain/admin-dashboard.html @@ -49,54 +49,142 @@ </svg> <span class="brand-name">Auth</span> </div> - <details class="user-menu" open> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu" open> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> + </div> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Administration"> + <p class="nav-label">Administration</p> + <a class="nav-item is-active" href="#" aria-current="page"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">System Admin</span> - <span class="user-meta">admin@system.test</span> - </div> - <div class="user-menu-list"> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> - <circle cx="12" cy="12" r="3" /> - </svg> - <span>Account settings</span> - </a> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item" href="./admin-clients.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="2" y="4" width="20" height="16" rx="2" /> + <path d="M10 4v4" /> + <path d="M2 8h20" /> + <path d="M6 4v4" /> + </svg> + <span>Clients</span> + </a> + <a class="nav-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M22 12h-4l-3 8-6-16-3 8H2" /> + </svg> + <span>Sessions</span> + </a> + <a class="nav-item" href="./admin-users.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /> + <circle cx="12" cy="7" r="4" /> + </svg> + <span>Users</span> + </a> + <a class="nav-item" href="./admin-settings.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Settings</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> </div> - </details> - </header> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -235,8 +323,8 @@ <script> const root = document.documentElement; const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setTheme(value) { @@ -250,18 +338,20 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } themeButtons.forEach((button) => { button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); const userMenu = document.querySelector('.user-menu'); @@ -271,5 +361,6 @@ } }); </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/admin-settings.html b/mockup/plain/admin-settings.html @@ -116,54 +116,142 @@ </svg> <span class="brand-name">Auth</span> </a> - <details class="user-menu"> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu"> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> + </div> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Administration"> + <p class="nav-label">Administration</p> + <a class="nav-item" href="./admin-dashboard.html"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">System Admin</span> - <span class="user-meta">admin@system.test</span> - </div> - <div class="user-menu-list"> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> - <circle cx="12" cy="12" r="3" /> - </svg> - <span>Account settings</span> - </a> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item" href="./admin-clients.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="2" y="4" width="20" height="16" rx="2" /> + <path d="M10 4v4" /> + <path d="M2 8h20" /> + <path d="M6 4v4" /> + </svg> + <span>Clients</span> + </a> + <a class="nav-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M22 12h-4l-3 8-6-16-3 8H2" /> + </svg> + <span>Sessions</span> + </a> + <a class="nav-item" href="./admin-users.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /> + <circle cx="12" cy="7" r="4" /> + </svg> + <span>Users</span> + </a> + <a class="nav-item is-active" href="./admin-settings.html" aria-current="page"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Settings</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> </div> - </details> - </header> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -430,8 +518,8 @@ <script> const root = document.documentElement; const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setTheme(value) { @@ -444,9 +532,9 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } const queryTheme = new URLSearchParams(window.location.search).get('theme'); @@ -458,9 +546,11 @@ button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); const userMenu = document.querySelector('.user-menu'); @@ -470,5 +560,6 @@ } }); </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/admin-user-detail.html b/mockup/plain/admin-user-detail.html @@ -14,54 +14,142 @@ </svg> <span class="brand-name">Auth</span> </a> - <details class="user-menu"> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu"> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">Acme IT</span> + <span class="user-meta">it@acme.test</span> + </div> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Administration"> + <p class="nav-label">Administration</p> + <a class="nav-item" href="./admin-dashboard.html"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">Acme IT</span> - <span class="user-meta">it@acme.test</span> - </div> - <div class="user-menu-list"> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> - <circle cx="12" cy="12" r="3" /> - </svg> - <span>Account settings</span> - </a> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item" href="./admin-clients.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="2" y="4" width="20" height="16" rx="2" /> + <path d="M10 4v4" /> + <path d="M2 8h20" /> + <path d="M6 4v4" /> + </svg> + <span>Clients</span> + </a> + <a class="nav-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M22 12h-4l-3 8-6-16-3 8H2" /> + </svg> + <span>Sessions</span> + </a> + <a class="nav-item is-active" href="./admin-users.html" aria-current="page"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /> + <circle cx="12" cy="7" r="4" /> + </svg> + <span>Users</span> + </a> + <a class="nav-item" href="./admin-settings.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Settings</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">Acme IT</span> + <span class="user-meta">it@acme.test</span> </div> - </details> - </header> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -462,8 +550,8 @@ <script> const root = document.documentElement; const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setTheme(value) { @@ -476,18 +564,20 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } themeButtons.forEach((button) => { button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); const userMenu = document.querySelector('.user-menu'); @@ -530,5 +620,6 @@ } }); </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/admin-user-global-detail.html b/mockup/plain/admin-user-global-detail.html @@ -14,54 +14,142 @@ </svg> <span class="brand-name">Auth</span> </a> - <details class="user-menu"> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu"> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> + </div> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Administration"> + <p class="nav-label">Administration</p> + <a class="nav-item" href="./admin-dashboard.html"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">System Admin</span> - <span class="user-meta">admin@system.test</span> - </div> - <div class="user-menu-list"> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> - <circle cx="12" cy="12" r="3" /> - </svg> - <span>Account settings</span> - </a> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item" href="./admin-clients.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="2" y="4" width="20" height="16" rx="2" /> + <path d="M10 4v4" /> + <path d="M2 8h20" /> + <path d="M6 4v4" /> + </svg> + <span>Clients</span> + </a> + <a class="nav-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M22 12h-4l-3 8-6-16-3 8H2" /> + </svg> + <span>Sessions</span> + </a> + <a class="nav-item is-active" href="./admin-users.html" aria-current="page"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /> + <circle cx="12" cy="7" r="4" /> + </svg> + <span>Users</span> + </a> + <a class="nav-item" href="./admin-settings.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Settings</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> </div> - </details> - </header> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -226,8 +314,8 @@ <script> const root = document.documentElement; const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setTheme(value) { @@ -240,18 +328,20 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } themeButtons.forEach((button) => { button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); const userMenu = document.querySelector('.user-menu'); @@ -261,5 +351,6 @@ } }); </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/admin-users.html b/mockup/plain/admin-users.html @@ -14,54 +14,142 @@ </svg> <span class="brand-name">Auth</span> </a> - <details class="user-menu"> - <summary aria-label="Account menu"> + <div class="topbar-actions"> + <button class="mobile-nav-toggle" type="button" id="mobile-nav-toggle" aria-controls="mobile-navigation" aria-expanded="false" aria-label="Open navigation"> + <span class="mobile-nav-toggle-bars" aria-hidden="true"></span> + </button> + <details class="user-menu"> + <summary aria-label="Account menu"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="10" /> + <circle cx="12" cy="10" r="3" /> + <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + </svg> + </summary> + <div class="user-panel"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> + </div> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </div> + </details> + </div> + </header> + + <div class="mobile-nav" id="mobile-navigation" aria-hidden="true"> + <nav class="nav" aria-label="Administration"> + <p class="nav-label">Administration</p> + <a class="nav-item" href="./admin-dashboard.html"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="10" /> - <circle cx="12" cy="10" r="3" /> - <path d="M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662" /> + <rect x="3" y="3" width="7" height="7" /> + <rect x="14" y="3" width="7" height="7" /> + <rect x="3" y="14" width="7" height="7" /> + <rect x="14" y="14" width="7" height="7" /> </svg> - </summary> - <div class="user-panel"> - <div class="user-summary"> - <span class="user-name">System Admin</span> - <span class="user-meta">admin@system.test</span> - </div> - <div class="user-menu-list"> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> - <circle cx="12" cy="12" r="3" /> - </svg> - <span>Account settings</span> - </a> - <button class="user-menu-item" type="button" data-user-theme> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <circle cx="12" cy="12" r="4" /> - <path d="M12 2v2" /> - <path d="M12 20v2" /> - <path d="m4.93 4.93 1.41 1.41" /> - <path d="m17.66 17.66 1.41 1.41" /> - <path d="M2 12h2" /> - <path d="M20 12h2" /> - <path d="m6.34 17.66-1.41 1.41" /> - <path d="m19.07 4.93-1.41 1.41" /> - </svg> - <span>Theme</span> - <span class="user-menu-value" data-user-theme-value>Auto</span> - </button> - <a class="user-menu-item" href="#"> - <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> - <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> - <path d="m16 17 5-5-5-5" /> - <path d="M21 12H9" /> - </svg> - <span>Sign out</span> - </a> - </div> + <span>Overview</span> + </a> + <a class="nav-item" href="./admin-clients.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <rect x="2" y="4" width="20" height="16" rx="2" /> + <path d="M10 4v4" /> + <path d="M2 8h20" /> + <path d="M6 4v4" /> + </svg> + <span>Clients</span> + </a> + <a class="nav-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M22 12h-4l-3 8-6-16-3 8H2" /> + </svg> + <span>Sessions</span> + </a> + <a class="nav-item is-active" href="./admin-users.html" aria-current="page"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" /> + <circle cx="12" cy="7" r="4" /> + </svg> + <span>Users</span> + </a> + <a class="nav-item" href="./admin-settings.html"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Settings</span> + </a> + </nav> + <div class="mobile-nav-divider" aria-hidden="true"></div> + <section class="mobile-nav-account" aria-label="Account"> + <div class="user-summary"> + <span class="user-name">System Admin</span> + <span class="user-meta">admin@system.test</span> </div> - </details> - </header> + <div class="user-menu-list"> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /> + <circle cx="12" cy="12" r="3" /> + </svg> + <span>Account settings</span> + </a> + <button class="user-menu-item" type="button" data-user-theme> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <circle cx="12" cy="12" r="4" /> + <path d="M12 2v2" /> + <path d="M12 20v2" /> + <path d="m4.93 4.93 1.41 1.41" /> + <path d="m17.66 17.66 1.41 1.41" /> + <path d="M2 12h2" /> + <path d="M20 12h2" /> + <path d="m6.34 17.66-1.41 1.41" /> + <path d="m19.07 4.93-1.41 1.41" /> + </svg> + <span>Theme</span> + <span class="user-menu-value" data-user-theme-value>Auto</span> + </button> + <a class="user-menu-item" href="#"> + <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> + <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> + <path d="m16 17 5-5-5-5" /> + <path d="M21 12H9" /> + </svg> + <span>Sign out</span> + </a> + </div> + </section> + </div> <div class="app"> <aside class="sidebar"> @@ -274,8 +362,8 @@ <script> const root = document.documentElement; const themeButtons = document.querySelectorAll('[data-theme-target]'); - const userThemeButton = document.querySelector('[data-user-theme]'); - const userThemeValue = document.querySelector('[data-user-theme-value]'); + const userThemeButtons = document.querySelectorAll('[data-user-theme]'); + const userThemeValues = document.querySelectorAll('[data-user-theme-value]'); let currentTheme = 'auto'; function setTheme(value) { @@ -288,18 +376,20 @@ themeButtons.forEach((button) => { button.classList.toggle('is-active', button.dataset.themeTarget === value); }); - if (userThemeValue) { - userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1); - } + userThemeValues.forEach((element) => { + element.textContent = value.charAt(0).toUpperCase() + value.slice(1); + }); } themeButtons.forEach((button) => { button.addEventListener('click', () => setTheme(button.dataset.themeTarget)); }); - userThemeButton?.addEventListener('click', () => { + userThemeButtons.forEach((button) => { + button.addEventListener('click', () => { const themes = ['auto', 'light', 'dark']; - setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]); + }); }); const userMenu = document.querySelector('.user-menu'); @@ -328,5 +418,6 @@ }); }); </script> + <script src="./shell.js"></script> </body> </html> diff --git a/mockup/plain/global.css b/mockup/plain/global.css @@ -24,6 +24,7 @@ --field-line: rgba(0, 0, 0, 0.42); --shadow: 0 0.125em 0.25em #0008; --hex: url('./hex-grid-light.svg'); + --topbar-height: 3.5rem; } *, @@ -53,15 +54,23 @@ body { display: none !important; } +html.mobile-nav-open body { + overflow: hidden; +} + +.topbar .user-menu { + display: none; +} + .topbar { position: sticky; top: 0; - z-index: 20; + z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 1rem; - min-height: 3.5rem; + min-height: var(--topbar-height); padding: env(safe-area-inset-top) max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left)); background: var(--topbar); @@ -89,19 +98,24 @@ body { line-height: 1.3; } +.topbar-actions { + display: flex; + align-items: center; + gap: 0.75rem; +} + .app { display: grid; grid-template-columns: minmax(0, 1fr); - grid-template-rows: auto minmax(0, 1fr); - min-height: calc(100vh - 3.5rem); - min-height: calc(100svh - 3.5rem); + grid-template-rows: minmax(0, 1fr); + min-height: calc(100vh - var(--topbar-height)); + min-height: calc(100svh - var(--topbar-height)); } .sidebar { min-width: 0; - display: flex; + display: none; flex-direction: column; - min-height: auto; background: var(--sidebar); color: #fff; } @@ -180,6 +194,155 @@ body { color: #fff; } +.mobile-nav-toggle { + position: relative; + display: grid; + place-items: center; + width: 2.5rem; + height: 2.5rem; + padding: 0; + border: 0; + background: transparent; + color: rgba(255, 255, 255, 0.86); + cursor: pointer; + touch-action: manipulation; + user-select: none; + -webkit-tap-highlight-color: transparent; +} + +.mobile-nav-toggle:hover, +.mobile-nav-toggle.is-open { + color: #fff; +} + +.mobile-nav-toggle-bars, +.mobile-nav-toggle-bars::before, +.mobile-nav-toggle-bars::after { + position: absolute; + width: 1.25rem; + height: 1pt; + background: currentColor; + transition: transform 0.3s ease; +} + +.mobile-nav-toggle-bars::before, +.mobile-nav-toggle-bars::after { + content: ''; + left: 0; +} + +.mobile-nav-toggle-bars::before { + top: -0.5rem; +} + +.mobile-nav-toggle-bars::after { + top: 0.5rem; +} + +.mobile-nav-toggle.is-open .mobile-nav-toggle-bars { + background: transparent; +} + +.mobile-nav-toggle.is-open .mobile-nav-toggle-bars::before { + transform: translateY(0.5rem) rotate(45deg); +} + +.mobile-nav-toggle.is-open .mobile-nav-toggle-bars::after { + transform: translateY(-0.5rem) rotate(-45deg); +} + +.mobile-nav { + position: fixed; + top: calc(var(--topbar-height) + env(safe-area-inset-top)); + right: max(0rem, env(safe-area-inset-right)); + bottom: 0; + left: max(0rem, env(safe-area-inset-left)); + z-index: 30; + overflow-y: auto; + overscroll-behavior: contain; + background: var(--sidebar); + color: #fff; + visibility: hidden; + opacity: 0; + transform: translateX(100%); + pointer-events: none; + transition: + transform 0.3s ease, + opacity 0.2s ease, + visibility 0.3s; +} + +html.mobile-nav-open .mobile-nav { + visibility: visible; + opacity: 1; + transform: none; + pointer-events: auto; +} + +.mobile-nav .nav { + min-width: 0; + min-height: 0; + flex-direction: column; + flex-wrap: nowrap; + overflow: visible; + padding: 1rem max(1.5rem, env(safe-area-inset-right)) + calc(1rem + env(safe-area-inset-bottom)) + max(1.5rem, env(safe-area-inset-left)); + gap: 0.25rem; +} + +.mobile-nav .nav-label { + display: block; + padding: 0.5rem 0; +} + +.mobile-nav .nav-item { + width: 100%; + flex: none; + justify-content: flex-start; + padding-inline: 1rem; + text-align: left; + opacity: 0; + transform: translateX(2rem); + transition: + opacity 0.2s ease 0.2s, + transform 0.3s ease 0.2s; +} + +html.mobile-nav-open .mobile-nav .nav-item { + opacity: 1; + transform: none; +} + +.mobile-nav .nav-item span { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip-path: none; + display: inline; + white-space: normal; +} + +.mobile-nav-divider { + height: 1pt; + margin: 1rem 1.5rem; + background: rgba(255, 255, 255, 0.18); +} + +.mobile-nav-account { + margin: 0 1.5rem calc(1rem + env(safe-area-inset-bottom)); +} + +.mobile-nav-account .user-summary { + padding-inline: 0; +} + +.mobile-nav-account .user-menu-list { + padding: 0; +} + .main { display: flex; flex-direction: column; @@ -1028,6 +1191,7 @@ summary:focus-visible { touch-action: manipulation; } + .mobile-nav-toggle, .user-menu summary, .modal-close { min-width: 2.75rem; @@ -1175,21 +1339,6 @@ summary:focus-visible { width: auto; } - .nav-item { - padding-inline: 1rem; - } - - .nav-item span { - position: static; - width: auto; - height: auto; - margin: 0; - overflow: visible; - clip-path: none; - display: inline; - white-space: normal; - } - .details > div { grid-template-columns: 8.5rem minmax(0, 1fr); } @@ -1202,8 +1351,18 @@ summary:focus-visible { } .sidebar { - min-height: calc(100vh - 3.5rem); - min-height: calc(100svh - 3.5rem); + display: flex; + min-height: calc(100vh - var(--topbar-height)); + min-height: calc(100svh - var(--topbar-height)); + } + + .mobile-nav-toggle, + .mobile-nav { + display: none; + } + + .topbar .user-menu { + display: block; } .nav { @@ -1211,10 +1370,13 @@ summary:focus-visible { overflow: visible; flex-direction: column; flex-wrap: nowrap; + padding: 0.75rem 0; + gap: 0; } .nav-label { display: block; + padding: 0.5rem 1.5rem; } .nav-item { @@ -1224,6 +1386,20 @@ summary:focus-visible { padding-inline: 1.5rem; justify-content: flex-start; text-align: left; + opacity: 1; + transform: none; + transition: none; + } + + .nav-item span { + position: static; + width: auto; + height: auto; + margin: 0; + overflow: visible; + clip-path: none; + display: inline; + white-space: normal; } .grid { @@ -1231,6 +1407,21 @@ summary:focus-visible { } } +@media (prefers-reduced-motion: reduce) { + .mobile-nav, + .mobile-nav .nav-item, + .mobile-nav-toggle-bars, + .mobile-nav-toggle-bars::before, + .mobile-nav-toggle-bars::after { + transition: none; + } + + .mobile-nav, + .mobile-nav .nav-item { + transform: none; + } +} + @media (prefers-color-scheme: dark) { :root:not([data-theme]) { --canvas: #181818; diff --git a/mockup/plain/shell.js b/mockup/plain/shell.js @@ -0,0 +1,49 @@ +(() => { + const root = document.documentElement; + const nav = document.getElementById('mobile-navigation'); + const toggle = document.getElementById('mobile-nav-toggle'); + const main = document.querySelector('.main'); + const desktop = window.matchMedia('(min-width: 60em)'); + + if (!nav || !toggle) return; + + const setOpen = (open) => { + nav.classList.toggle('is-open', open); + nav.setAttribute('aria-hidden', open ? 'false' : 'true'); + toggle.classList.toggle('is-open', open); + toggle.setAttribute('aria-expanded', open ? 'true' : 'false'); + toggle.setAttribute('aria-label', open ? 'Close navigation' : 'Open navigation'); + root.classList.toggle('mobile-nav-open', open); + + if (main) main.inert = open; + }; + + const isOpen = () => toggle.getAttribute('aria-expanded') === 'true'; + + toggle.addEventListener('click', () => setOpen(!isOpen())); + + nav.addEventListener('click', (event) => { + const target = event.target; + if (!(target instanceof Element)) return; + + if (target.closest('.nav-item')) { + setOpen(false); + return; + } + + if (!target.closest('.user-menu-item, button, a')) setOpen(false); + }); + + document.addEventListener('keydown', (event) => { + if (event.key === 'Escape' && isOpen()) { + setOpen(false); + toggle.focus(); + } + }); + + desktop.addEventListener('change', (event) => { + if (event.matches) setOpen(false); + }); + + if (desktop.matches) setOpen(false); +})();