Fix mine inbox keyboard selection

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta 2026-03-28 16:24:23 -05:00
parent 44f052f4c5
commit 7d81e4cb2a
5 changed files with 53 additions and 12 deletions

View file

@ -122,4 +122,25 @@ describe("SwipeToArchive", () => {
root.unmount();
});
});
it("renders the selected inbox treatment on the swipe surface", () => {
const root = createRoot(container);
act(() => {
root.render(
<SwipeToArchive onArchive={() => {}} selected>
<button type="button">Open issue</button>
</SwipeToArchive>,
);
});
const surface = container.querySelector("[data-inbox-row-surface]") as HTMLDivElement | null;
expect(surface).not.toBeNull();
expect(surface?.style.backgroundColor).toBe("hsl(var(--primary) / 0.06)");
expect(surface?.style.boxShadow).toBe("inset 3px 0 0 hsl(var(--primary))");
act(() => {
root.unmount();
});
});
});

View file

@ -6,6 +6,7 @@ interface SwipeToArchiveProps {
children: ReactNode;
onArchive: () => void;
disabled?: boolean;
selected?: boolean;
className?: string;
}
@ -17,6 +18,7 @@ export function SwipeToArchive({
children,
onArchive,
disabled = false,
selected = false,
className,
}: SwipeToArchiveProps) {
const containerRef = useRef<HTMLDivElement | null>(null);
@ -148,10 +150,13 @@ export function SwipeToArchive({
</span>
</div>
<div
data-inbox-row-surface
className="relative bg-card will-change-transform"
style={{
transform: `translate3d(${offsetX}px, 0, 0)`,
transition: isDragging ? "none" : "transform 180ms ease-out",
backgroundColor: selected ? "hsl(var(--primary) / 0.06)" : undefined,
boxShadow: selected ? "inset 3px 0 0 hsl(var(--primary))" : undefined,
}}
>
{children}