Skip to content

Commit 670327c

Browse files
voida6claude
andcommitted
fix(web): line up the Date and Time fields in custom snooze
The Date column used gap-1.5 between its label and button, while the Time column is a Label that already has gap-2, so the Date button sat 2px higher than the Time field. Use gap-2 on the Date column and add a layout test. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
1 parent 05b697f commit 670327c

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { describe, expect, it } from "vite-plus/test";
2+
import { page } from "vite-plus/test/browser";
3+
4+
import "~/index.css";
5+
import { act, render } from "../../test/render";
6+
import { CustomSnoozeDialogHost, requestCustomSnooze } from "./CustomSnoozeDialog";
7+
8+
describe("CustomSnoozeDialog layout", () => {
9+
it("lines the Date button up with the Time field side by side", async () => {
10+
// Below the sm breakpoint the fields stack, so the two-column layout needs a wide viewport.
11+
await page.viewport(1280, 900);
12+
await using _screen = await render(<CustomSnoozeDialogHost />);
13+
await act(async () => void requestCustomSnooze());
14+
15+
const dateTop = page.getByLabelText("Date").element().getBoundingClientRect().top;
16+
// The bordered box around the native input is what the user sees, not the input inside it.
17+
const timeTop = page
18+
.getByLabelText("Time")
19+
.element()
20+
.parentElement!.getBoundingClientRect().top;
21+
22+
expect(dateTop, `Date top ${dateTop}px, Time top ${timeTop}px`).toBe(timeTop);
23+
});
24+
});

‎apps/web/src/components/CustomSnoozeDialog.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function CustomSnoozeDialog() {
111111
<div className="flex flex-col gap-4">
112112
{mode === "date" ? (
113113
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
114-
<div className="flex min-w-0 flex-col gap-1.5">
114+
<div className="flex min-w-0 flex-col gap-2">
115115
<Label htmlFor={`${id}-date`}>Date</Label>
116116
<Popover open={calendarOpen} onOpenChange={setCalendarOpen}>
117117
<PopoverTrigger

0 commit comments

Comments
 (0)