forge
Explore
Log in

Don't you dare go Hollow

📱 sweep the last shrink-0 action row into the same pattern

Browse files at this commit

a3421b2656a5df7ad92becadf6eb4e0581a1f2a7Ahmet Kaan GümüşParent: 90cf972
  • fix
    • 📱 sweep the last shrink-0 action row into the same pattern
Show full message
fix: 📱 sweep the last shrink-0 action row into the same pattern

PageHeader's actions row carried the same `flex shrink-0 flex-wrap` class
string the table and section hosts had, so the class was three hosts wide and
one of them was left behind: a wide action row there could push the document
past a narrow viewport the same way.

min-w-0 lets the box shrink below its max-content width while flex-wrap keeps
the children wrapping. The shrink guard in data-table.test.tsx now renders all
three hosts, so the spelling cannot drift again (it fails on the old
PageHeader row and passes on the new one).
src/components/layout/page-header.tsxmodified+1 -1
@@ -55,7 +55,7 @@ export function PageHeader(
55 {props.children}55 {props.children}
56 </div>56 </div>
57 <Show when={props.actions}>57 <Show when={props.actions}>
58- <div class="flex shrink-0 flex-wrap items-center gap-2">{props.actions}</div>58+ <div class="flex min-w-0 flex-wrap items-center gap-2">{props.actions}</div>
59 </Show>59 </Show>
60 </div>60 </div>
61 </div>61 </div>
src/components/ui/data-table.test.tsxmodified+3 -1
@@ -2,6 +2,7 @@ import { fireEvent, render, screen } from "@solidjs/testing-library";
2 import type { ColumnDef } from "@tanstack/solid-table";2 import type { ColumnDef } from "@tanstack/solid-table";
3 import { DataTable } from "@/components/ui/data-table";3 import { DataTable } from "@/components/ui/data-table";
4 import { DataSection } from "@/components/ui/data-section";4 import { DataSection } from "@/components/ui/data-section";
5+import { PageHeader } from "@/components/layout/page-header";
5 import { PreferencesProvider } from "@/stores/preferences-context";6 import { PreferencesProvider } from "@/stores/preferences-context";
6 7
7 type Row = { name: string; role?: string };8 type Row = { name: string; role?: string };
@@ -136,11 +137,12 @@ test("the header action toolbar of every shared host can shrink below its max-co
136 />137 />
137 </PreferencesProvider>138 </PreferencesProvider>
138 <DataSection title="Card" actions={<button type="button">Export</button>} />139 <DataSection title="Card" actions={<button type="button">Export</button>} />
140+ <PageHeader title="Page" actions={<button type="button">Export</button>} />
139 </>141 </>
140 ));142 ));
141 143
142 const toolbars = screen.getAllByText("Export").map((action) => action.parentElement as HTMLElement);144 const toolbars = screen.getAllByText("Export").map((action) => action.parentElement as HTMLElement);
143- expect(toolbars).toHaveLength(2);145+ expect(toolbars).toHaveLength(3);
144 for (const toolbar of toolbars) {146 for (const toolbar of toolbars) {
145 expect(toolbar.classList).toContain("flex-wrap");147 expect(toolbar.classList).toContain("flex-wrap");
146 expect(toolbar.classList).toContain("min-w-0");148 expect(toolbar.classList).toContain("min-w-0");