feat: add shared workspace layouts

This commit is contained in:
2026-08-18 02:17:13 +02:00
parent 934db6d44b
commit dd7ad4d9c7
11 changed files with 207 additions and 11 deletions
+48
View File
@@ -0,0 +1,48 @@
function assert(condition: unknown, message = "assertion failed"): void {
if (!condition) throw new Error(message);
}
import { renderToStaticMarkup } from "react-dom/server";
import WorkspaceLayout from "../src/components/WorkspaceLayout";
import { PlatformLanguageProvider } from "../src/i18n/LanguageContext";
const navigationMarkup = renderToStaticMarkup(
<PlatformLanguageProvider>
<WorkspaceLayout
primary={<nav>Sections</nav>}
primaryLabel="Campaign sections"
contentLabel="Campaign content"
interfaceId="campaign.workspace"
helpModuleId="campaign"
>
<main>Selected section</main>
</WorkspaceLayout>
</PlatformLanguageProvider>
);
assert(navigationMarkup.includes("workspace-layout-navigation"), "navigation workspaces use the central navigation geometry");
assert(navigationMarkup.includes("workspace-layout-primary-default"), "the default primary-pane width is explicit");
assert(navigationMarkup.includes("workspace-layout-pane-contained"), "navigation panes defer scrolling to their navigation component");
assert(navigationMarkup.includes('aria-label="Campaign sections"'), "the primary pane can be named");
assert(navigationMarkup.includes('aria-label="Campaign content"'), "the content pane can be named");
assert(navigationMarkup.includes('data-help-scope="workspace"'), "workspace contextual-help scope is centralized");
assert(navigationMarkup.includes('data-interface-id="campaign.workspace"'), "workspace identity reaches the root");
assert(navigationMarkup.includes('data-help-documentation-type="user"'), "workspace documentation type is explicit");
const splitMarkup = renderToStaticMarkup(
<PlatformLanguageProvider>
<WorkspaceLayout
variant="split"
primarySize="wide"
contentScrollable={false}
primary={<div>Collection</div>}
>
Detail
</WorkspaceLayout>
</PlatformLanguageProvider>
);
assert(splitMarkup.includes("workspace-layout-split"), "list-detail workspaces opt into split-pane geometry");
assert(splitMarkup.includes("workspace-layout-primary-wide"), "split workspaces use central width variants");
assert(splitMarkup.includes("workspace-layout-pane-scrollable"), "split primary panes can own scrolling");
assert(splitMarkup.includes("workspace-layout-content workspace-layout-pane-contained"), "contained content panes can delegate scrolling to their children");