commit a47d9fd19f2fcd3aa230c7717e8909ce589125c7
parent 44ef9909ba1924a09fd68d2eb5ab9e9039f048f0
Author: finwo <finwo@pm.me>
Date: Thu, 22 Oct 2026 01:57:58 +0200
Mockup code now mobile-first
Diffstat:
3 files changed, 166 insertions(+), 121 deletions(-)
diff --git a/mockup/account.html b/mockup/account.html
@@ -85,26 +85,28 @@
.app {
display: grid;
- grid-template-columns: 15rem minmax(0, 1fr);
+ grid-template-columns: minmax(0, 1fr);
+ grid-template-rows: auto minmax(0, 1fr);
min-height: calc(100vh - 3.5rem);
}
.sidebar {
display: flex;
flex-direction: column;
- min-height: calc(100vh - 3.5rem);
+ min-height: auto;
background: var(--sidebar);
color: #fff;
}
.nav {
display: flex;
- flex: 1;
- flex-direction: column;
+ flex-direction: row;
+ flex-wrap: wrap;
padding: 0.75rem 0;
}
.nav-label {
+ display: none;
margin: 0;
padding: 0.5rem 1.5rem;
color: rgba(255, 255, 255, 0.46);
@@ -117,8 +119,10 @@
.nav-item {
display: flex;
align-items: center;
+ justify-content: center;
gap: 0.75rem;
- width: 100%;
+ width: auto;
+ flex: 1;
padding: 0.6875rem 1.5rem;
color: rgba(255, 255, 255, 0.82);
font-size: 0.875rem;
@@ -128,6 +132,10 @@
user-select: none;
}
+ .nav-item span {
+ display: none;
+ }
+
.nav-item svg {
flex: none;
width: 1.125rem;
@@ -177,7 +185,7 @@
.grid {
display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
+ grid-template-columns: minmax(0, 1fr);
gap: 1rem;
}
@@ -224,7 +232,7 @@
.details > div {
display: grid;
- grid-template-columns: 8.5rem minmax(0, 1fr);
+ grid-template-columns: minmax(0, 1fr);
gap: 1rem;
}
@@ -262,7 +270,7 @@
.summary-row {
display: grid;
- grid-template-columns: 1.5rem minmax(0, 1fr) auto;
+ grid-template-columns: 1.5rem minmax(0, 1fr);
align-items: center;
gap: 1rem;
padding: 0.875rem 0.75rem;
@@ -300,6 +308,7 @@
}
.summary-arrow {
+ display: none;
color: var(--muted);
font-size: 1.125rem;
line-height: 1;
@@ -315,7 +324,7 @@
.surface-row {
display: grid;
- grid-template-columns: 1.5rem minmax(0, 1fr) auto;
+ grid-template-columns: 1.5rem minmax(0, 1fr);
align-items: center;
gap: 1rem;
padding: 1rem 0.75rem;
@@ -341,6 +350,7 @@
}
.status {
+ display: none;
color: var(--muted);
font-size: 0.8125rem;
line-height: 1.4;
@@ -445,14 +455,24 @@
gap: 0.75rem;
width: 100%;
padding: 0.625rem 1rem;
+ border: 0;
+ background: transparent;
color: rgba(255, 255, 255, 0.82);
+ font: inherit;
font-size: 0.875rem;
line-height: 1.4;
+ text-align: left;
text-decoration: none;
cursor: pointer;
user-select: none;
}
+ .user-menu-value {
+ margin-left: auto;
+ color: rgba(255, 255, 255, 0.56);
+ font-size: 0.75rem;
+ }
+
.user-menu-item svg {
flex: none;
width: 1.125rem;
@@ -546,66 +566,54 @@
outline-offset: 2pt;
}
- @media (max-width: 60em) {
- .app {
- grid-template-columns: minmax(0, 1fr);
- }
-
- .sidebar {
- min-height: auto;
- }
-
- .nav {
- flex-direction: row;
- flex-wrap: wrap;
- padding: 0;
- }
-
- .nav-label {
- display: none;
+ @media (min-width: 40em) {
+ .nav-item span {
+ display: inline;
}
- .nav-item {
- width: auto;
- flex: 1;
- justify-content: center;
+ .details > div {
+ grid-template-columns: 8.5rem minmax(0, 1fr);
}
- .grid {
- grid-template-columns: minmax(0, 1fr);
+ .summary-row,
+ .surface-row {
+ grid-template-columns: 1.5rem minmax(0, 1fr) auto;
}
- .panel-wide {
- margin-top: 0;
+ .summary-arrow,
+ .status {
+ display: inline;
}
}
- @media (max-width: 37.5em) {
- .content {
- padding: 1.25rem 1rem 2rem;
+ @media (min-width: 60em) {
+ .app {
+ grid-template-columns: 15rem minmax(0, 1fr);
+ grid-template-rows: minmax(0, 1fr);
}
- .topbar {
- padding: 0 1rem;
+ .sidebar {
+ min-height: calc(100vh - 3.5rem);
}
- .nav-item span {
- display: none;
+ .nav {
+ flex: 1;
+ flex-direction: column;
+ flex-wrap: nowrap;
}
- .details > div {
- grid-template-columns: minmax(0, 1fr);
- gap: 0.125rem;
+ .nav-label {
+ display: block;
}
- .summary-row,
- .surface-row {
- grid-template-columns: 1.5rem minmax(0, 1fr);
+ .nav-item {
+ width: 100%;
+ flex: none;
+ justify-content: flex-start;
}
- .summary-arrow,
- .status {
- display: none;
+ .grid {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@@ -677,6 +685,21 @@
<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" />
@@ -1006,6 +1029,9 @@
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]');
+ let currentTheme = 'auto';
function setView(name) {
const isClient = name === 'client';
@@ -1033,6 +1059,7 @@
}
function setTheme(value) {
+ currentTheme = value;
if (value === 'auto') {
root.removeAttribute('data-theme');
} else {
@@ -1042,6 +1069,9 @@
themeButtons.forEach((button) => {
button.classList.toggle('is-active', button.dataset.themeTarget === value);
});
+ if (userThemeValue) {
+ userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1);
+ }
}
viewButtons.forEach((button) => {
@@ -1052,6 +1082,11 @@
button.addEventListener('click', () => setTheme(button.dataset.themeTarget));
});
+ userThemeButton?.addEventListener('click', () => {
+ const themes = ['auto', 'light', 'dark'];
+ setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]);
+ });
+
navItems.forEach((item) => {
item.addEventListener('click', (event) => {
event.preventDefault();
diff --git a/mockup/admin-dashboard.html b/mockup/admin-dashboard.html
@@ -57,14 +57,15 @@
.app {
display: grid;
- grid-template-columns: 15rem minmax(0, 1fr);
+ grid-template-columns: minmax(0, 1fr);
+ grid-template-rows: auto minmax(0, 1fr);
min-height: calc(100vh - 3.5rem);
}
.sidebar {
display: flex;
flex-direction: column;
- min-height: calc(100vh - 3.5rem);
+ min-height: auto;
background: var(--sidebar);
color: #fff;
}
@@ -90,12 +91,13 @@
.nav {
display: flex;
- flex: 1;
- flex-direction: column;
+ flex-direction: row;
+ flex-wrap: wrap;
padding: 0.75rem 0;
}
.nav-label {
+ display: none;
margin: 0;
padding: 0.5rem 1.5rem;
color: rgba(255, 255, 255, 0.46);
@@ -108,8 +110,10 @@
.nav-item {
display: flex;
align-items: center;
+ justify-content: center;
gap: 0.75rem;
- width: 100%;
+ width: auto;
+ flex: 1;
padding: 0.6875rem 1.5rem;
color: rgba(255, 255, 255, 0.82);
font-size: 0.875rem;
@@ -119,6 +123,10 @@
user-select: none;
}
+ .nav-item span {
+ display: none;
+ }
+
.nav-item svg {
flex: none;
width: 1.125rem;
@@ -309,14 +317,24 @@
gap: 0.75rem;
width: 100%;
padding: 0.625rem 1rem;
+ border: 0;
+ background: transparent;
color: rgba(255, 255, 255, 0.82);
+ font: inherit;
font-size: 0.875rem;
line-height: 1.4;
+ text-align: left;
text-decoration: none;
cursor: pointer;
user-select: none;
}
+ .user-menu-value {
+ margin-left: auto;
+ color: rgba(255, 255, 255, 0.56);
+ font-size: 0.75rem;
+ }
+
.user-menu-item svg {
flex: none;
width: 1.125rem;
@@ -330,7 +348,7 @@
.stats {
display: grid;
- grid-template-columns: repeat(4, minmax(0, 1fr));
+ grid-template-columns: minmax(0, 1fr);
gap: 1rem;
margin-bottom: 1rem;
}
@@ -358,7 +376,7 @@
.grid {
display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
+ grid-template-columns: minmax(0, 1fr);
gap: 1rem;
}
@@ -388,7 +406,7 @@
.details > div {
display: grid;
- grid-template-columns: 8.5rem minmax(0, 1fr);
+ grid-template-columns: minmax(0, 1fr);
gap: 1rem;
}
@@ -418,57 +436,48 @@
outline-offset: 2pt;
}
- @media (max-width: 60em) {
- .app {
- grid-template-columns: minmax(0, 1fr);
+ @media (min-width: 40em) {
+ .nav-item span {
+ display: inline;
}
- .sidebar {
- min-height: auto;
+ .details > div {
+ grid-template-columns: 8.5rem minmax(0, 1fr);
}
+ }
- .nav {
- flex-direction: row;
- flex-wrap: wrap;
- padding: 0;
+ @media (min-width: 60em) {
+ .app {
+ grid-template-columns: 15rem minmax(0, 1fr);
+ grid-template-rows: minmax(0, 1fr);
}
- .nav-label {
- display: none;
+ .sidebar {
+ min-height: calc(100vh - 3.5rem);
}
- .nav-item {
- width: auto;
+ .nav {
flex: 1;
- justify-content: center;
- }
-
- .stats,
- .grid {
- grid-template-columns: minmax(0, 1fr);
- }
-
- .panel-wide {
- margin-top: 0;
+ flex-direction: column;
+ flex-wrap: nowrap;
}
- }
- @media (max-width: 37.5em) {
- .content {
- padding: 1.25rem 1rem 2rem;
+ .nav-label {
+ display: block;
}
- .topbar {
- padding: 0 1rem;
+ .nav-item {
+ width: 100%;
+ flex: none;
+ justify-content: flex-start;
}
- .nav-item span {
- display: none;
+ .stats {
+ grid-template-columns: repeat(4, minmax(0, 1fr));
}
- .details > div {
- grid-template-columns: minmax(0, 1fr);
- gap: 0.125rem;
+ .grid {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@@ -526,6 +535,21 @@
</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" />
@@ -676,8 +700,12 @@
<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]');
+ let currentTheme = 'auto';
function setTheme(value) {
+ currentTheme = value;
if (value === 'auto') {
root.removeAttribute('data-theme');
} else {
@@ -687,12 +715,20 @@
themeButtons.forEach((button) => {
button.classList.toggle('is-active', button.dataset.themeTarget === value);
});
+ if (userThemeValue) {
+ userThemeValue.textContent = value.charAt(0).toUpperCase() + value.slice(1);
+ }
}
themeButtons.forEach((button) => {
button.addEventListener('click', () => setTheme(button.dataset.themeTarget));
});
+ userThemeButton?.addEventListener('click', () => {
+ const themes = ['auto', 'light', 'dark'];
+ setTheme(themes[(themes.indexOf(currentTheme) + 1) % themes.length]);
+ });
+
const userMenu = document.querySelector('.user-menu');
document.addEventListener('click', (event) => {
if (userMenu.open && !userMenu.contains(event.target)) {
diff --git a/mockup/error-pages.html b/mockup/error-pages.html
@@ -48,13 +48,13 @@
display: grid;
place-items: center;
min-height: 100vh;
- padding: 2rem;
+ padding: 0;
background-color: var(--surface);
}
.status-panel,
.login-card {
- width: min(28rem, 100%);
+ width: min(calc(100% - 2rem), 28rem);
padding: 2rem;
background: var(--surface);
}
@@ -64,7 +64,7 @@
}
.login-card {
- width: min(24rem, 100%);
+ width: min(calc(100% - 2rem), 24rem);
}
.status-panel h1,
@@ -250,32 +250,6 @@
}
}
- @media (max-width: 30em) {
- .status-page {
- padding: 1rem;
- }
-
- .status-panel,
- .login-card {
- padding: 1.5rem;
- }
-
- .status-panel h1 {
- padding-right: 2.75rem;
- }
-
- .status-icon,
- .spinner {
- top: 1.5rem;
- right: 1.5rem;
- }
-
- .status-actions .button {
- flex: 1;
- text-align: center;
- }
- }
-
@media (prefers-reduced-motion: reduce) {
.spinner {
animation: none;