Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apps/web/src/components/threadSidebarWidth.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @effect-diagnostics nodeBuiltinImport:off - Regression coverage compares shipped CSS with the sidebar width contract.
import * as NodeFS from "node:fs";

import { describe, expect, it } from "vite-plus/test";

import {
Expand Down Expand Up @@ -31,4 +34,22 @@ describe("thread sidebar width", () => {
it("keeps the sidebar minimum when the whole layout is narrower than its minimums", () => {
expect(resolveInitialThreadSidebarWidth(900, 700)).toBe(THREAD_SIDEBAR_MIN_WIDTH);
});

it("shows the desktop wordmark across the sidebar's full legal width range", () => {
const sidebarStyles = NodeFS.readFileSync(new URL("../index.css", import.meta.url), "utf8");
const desktopHeaderStyles = sidebarStyles.slice(
sidebarStyles.indexOf("@media (min-width: 48rem)"),
sidebarStyles.indexOf("/* Stage-channel sidebar art"),
);
const stageLabelThreshold = desktopHeaderStyles.match(
/@container sidebar-header \(min-width: ([\d.]+)rem\) \{\s*\.sidebar-brand-stage \{\s*display: inline-flex;/,
)?.[1];

expect(sidebarStyles).toMatch(/\.sidebar-brand \{\s*display: none;/);
expect(desktopHeaderStyles).toMatch(
/@media \(min-width: 48rem\) \{\s*\.sidebar-brand \{\s*display: flex;/,
);
expect(THREAD_SIDEBAR_MIN_WIDTH).toBe(13 * 16);
expect(Number(stageLabelThreshold) * 16).toBeGreaterThan(THREAD_SIDEBAR_MIN_WIDTH);
});
});
6 changes: 2 additions & 4 deletions apps/web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,8 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
}

@media (min-width: 48rem) {
@container sidebar-header (min-width: 13.5rem) {
.sidebar-brand {
display: flex;
}
.sidebar-brand {
display: flex;
}

@container sidebar-header (min-width: 15.75rem) {
Expand Down
Loading