Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ describe("FlatGroup", () => {
</FlatGroup>,
);
expect(host.querySelector('[data-testid="body"]')).not.toBeNull();
const header = host.querySelector('[data-flat-group-open="true"] > div');
expect(header?.className).toContain("sticky");
expect(header?.className).toContain("top-0");
expect(header?.className).toContain("bottom-0");
expect(header?.className).toContain("bg-panel-bg");
const pin = host.querySelector<HTMLButtonElement>('[data-flat-group-pin="true"]');
act(() => pin?.dispatchEvent(new MouseEvent("click", { bubbles: true })));
expect(onTogglePin).toHaveBeenCalledTimes(1);
Expand All @@ -148,6 +153,10 @@ describe("FlatGroup", () => {
expect(host.querySelector('[data-testid="body"]')).toBeNull();
expect(host.textContent).toContain("fill none · 100%");
const row = host.querySelector<HTMLButtonElement>('[data-flat-group-collapsed="true"]');
expect(row?.className).toContain("sticky");
expect(row?.className).toContain("top-0");
expect(row?.className).toContain("bottom-0");
expect(row?.className).toContain("bg-panel-bg");
act(() => row?.dispatchEvent(new MouseEvent("click", { bubbles: true })));
expect(onToggleOpen).toHaveBeenCalledTimes(1);
act(() => root.unmount());
Expand Down Expand Up @@ -469,6 +478,11 @@ describe("PinnedGroupRow", () => {
expect(host.textContent).toContain("Pinned");
expect(host.textContent).toContain("Motion");
expect(host.querySelector('[data-testid="body"]')).not.toBeNull();
const header = host.querySelector('[data-pinned-group="true"] > div');
expect(header?.className).toContain("sticky");
expect(header?.className).toContain("top-0");
expect(header?.className).toContain("bottom-0");
expect(header?.className).toContain("bg-panel-bg");
const unpin = host.querySelector<HTMLButtonElement>('[data-pinned-group-unpin="true"]');
act(() => unpin?.dispatchEvent(new MouseEvent("click", { bubbles: true })));
expect(onUnpin).toHaveBeenCalledTimes(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function FlatGroup({
type="button"
data-flat-group-collapsed="true"
onClick={onToggleOpen}
className="flex min-h-10 w-full items-center justify-between gap-2 border-b border-panel-hairline px-4 text-left"
className="sticky top-0 bottom-0 z-10 flex min-h-10 w-full items-center justify-between gap-2 border-b border-panel-hairline bg-panel-bg px-4 text-left"
>
<span className="flex min-w-0 items-center gap-2">
<span className="text-[12px] font-medium text-panel-text-2">{title}</span>
Expand All @@ -186,7 +186,7 @@ export function FlatGroup({

return (
<div className="border-b border-panel-hairline px-4 py-3" data-flat-group-open="true">
<div className="mb-2.5 flex items-center justify-between">
<div className="sticky top-0 bottom-0 z-10 -mx-4 mb-2.5 flex items-center justify-between bg-panel-bg px-4">
<span className="text-[12px] font-semibold text-panel-text-0">{title}</span>
<span className="flex items-center gap-2.5 text-panel-text-5">
{accessory}
Expand Down Expand Up @@ -467,7 +467,7 @@ export function PinnedGroupRow({
}) {
return (
<div className="border-b border-panel-hairline px-4 py-3" data-pinned-group="true">
<div className="mb-2.5 flex items-center justify-between">
<div className="sticky top-0 bottom-0 z-10 -mx-4 mb-2.5 flex items-center justify-between bg-panel-bg px-4">
<span className="flex items-center gap-1.5">
<span className="text-[9px] font-semibold uppercase tracking-[0.08em] text-panel-accent">
Pinned
Expand Down
Loading