[feat](trx-frontend-http): box the selected tab instead of underlining it
The desktop strip marked the current page with a 2px underline while the mobile bottom nav already boxed it, so one navigation model looked like two. The box now sits on both: a transparent 1px border on the base reserves it, so switching pages moves no neighbours, and hover fills a fainter version of the same shape. Tools carries it too — that button is marked active for the destinations the strip hides. Dropping the mobile rule's border-bottom:none, which only existed to cancel the old desktop underline, closes the bottom edge its active box had been missing. The smoke test checks all four edges. Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -1550,19 +1550,34 @@ small { color: var(--text-muted); }
|
|||||||
.tab-bar-nav .tab .tab-icon, .tab-bar-nav .tab .tab-more-icon { display: block; }
|
.tab-bar-nav .tab .tab-icon, .tab-bar-nav .tab .tab-more-icon { display: block; }
|
||||||
.tab-bar-nav .tab { padding: 0.5rem 0.6rem; }
|
.tab-bar-nav .tab { padding: 0.5rem 0.6rem; }
|
||||||
}
|
}
|
||||||
|
/* The selected destination is boxed, not underlined — the same treatment the
|
||||||
|
mobile bottom nav already used, so one navigation model reads the same at
|
||||||
|
every width. The transparent border is on the base so switching tabs moves
|
||||||
|
no neighbours. */
|
||||||
.tab {
|
.tab {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: 1px solid transparent;
|
||||||
border-bottom: 2px solid transparent;
|
border-radius: var(--radius-md);
|
||||||
border-radius: 0;
|
padding: 0.45rem 0.9rem;
|
||||||
padding: 0.5rem 0.95rem;
|
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
transition: color var(--dur-fast) var(--ease-standard),
|
||||||
|
background-color var(--dur-fast) var(--ease-standard),
|
||||||
|
border-color var(--dur-fast) var(--ease-standard);
|
||||||
|
}
|
||||||
|
.tab.active {
|
||||||
|
border-color: color-mix(in srgb, var(--accent-green) 50%, var(--border-light));
|
||||||
|
background: color-mix(in srgb, var(--accent-green) 12%, transparent);
|
||||||
|
color: var(--accent-text);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.tab:hover:not(.active) {
|
||||||
|
color: var(--text);
|
||||||
|
background: color-mix(in srgb, var(--btn-bg) 55%, transparent);
|
||||||
|
border-color: color-mix(in srgb, var(--border-light) 40%, transparent);
|
||||||
}
|
}
|
||||||
.tab.active { border-bottom-color: var(--accent-green); color: var(--accent-text); font-weight: 600; }
|
|
||||||
.tab:hover:not(.active) { color: var(--text); }
|
|
||||||
/* Tab icons — hidden on desktop, shown on mobile bottom nav */
|
/* Tab icons — hidden on desktop, shown on mobile bottom nav */
|
||||||
.tab-icon {
|
.tab-icon {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -3361,7 +3376,6 @@ body[data-operator-layout="broadcast"] #cw-bar-overlay {
|
|||||||
min-height: 3.2rem;
|
min-height: 3.2rem;
|
||||||
padding: 0.35rem 0.1rem 0.3rem;
|
padding: 0.35rem 0.1rem 0.3rem;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-bottom: none;
|
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { fileURLToPath } from "node:url";
|
|||||||
import { chromium } from "playwright-core";
|
import { chromium } from "playwright-core";
|
||||||
|
|
||||||
// page.evaluate callbacks run in the browser, not in this Node process.
|
// page.evaluate callbacks run in the browser, not in this Node process.
|
||||||
/* global document */
|
/* global document, getComputedStyle */
|
||||||
|
|
||||||
const frontendDir = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
const frontendDir = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
||||||
const webDir = path.resolve(frontendDir, "../assets/web");
|
const webDir = path.resolve(frontendDir, "../assets/web");
|
||||||
@@ -213,6 +213,21 @@ try {
|
|||||||
await page.locator("#aprs-map .leaflet-pane").first().waitFor({ state: "attached" });
|
await page.locator("#aprs-map .leaflet-pane").first().waitFor({ state: "attached" });
|
||||||
assert.equal(new URL(page.url()).pathname, "/map");
|
assert.equal(new URL(page.url()).pathname, "/map");
|
||||||
|
|
||||||
|
// The selected destination is marked by a box on all four sides, so a rule
|
||||||
|
// that drops one edge (the mobile nav used to lose its bottom border) is a
|
||||||
|
// regression even though the tab still reads as "active".
|
||||||
|
const activeTab = await page.evaluate(() => {
|
||||||
|
const style = getComputedStyle(document.querySelector(".tab-bar-nav .tab.active"));
|
||||||
|
return ["Top", "Right", "Bottom", "Left"].map((side) => ({
|
||||||
|
width: style.getPropertyValue(`border-${side.toLowerCase()}-width`),
|
||||||
|
color: style.getPropertyValue(`border-${side.toLowerCase()}-color`),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
for (const edge of activeTab) {
|
||||||
|
assert.notEqual(edge.width, "0px", `active tab border: ${JSON.stringify(activeTab)}`);
|
||||||
|
assert.ok(!/rgba\(0, 0, 0, 0\)|transparent/.test(edge.color), `active tab border: ${JSON.stringify(activeTab)}`);
|
||||||
|
}
|
||||||
|
|
||||||
// The map is full-bleed: it breaks out of the centred .card column and
|
// The map is full-bleed: it breaks out of the centred .card column and
|
||||||
// reaches both viewport edges, without pushing the page sideways.
|
// reaches both viewport edges, without pushing the page sideways.
|
||||||
const stage = await page.evaluate(() => {
|
const stage = await page.evaluate(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user