Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: now layout toggles are radio buttons #3888

Merged
merged 1 commit into from
Aug 8, 2024
Merged
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
26 changes: 16 additions & 10 deletions components/atoms/LayoutToggle/layout-toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,32 @@ const LayoutToggle = ({ value, onChange }: LayoutToggleProps) => {

return (
<div className="flex h-8 border rounded-lg shadow-xs w-28 p-[1px] text-light-slate-9">
<div
<button
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
role="radio"
aria-checked={value === "list"}
name="layout"
onClick={() => handleToggle("list")}
role="toggle"
className={clsx(
"flex items-center cursor-pointer justify-center flex-1 transition rounded-lg",
value === "list" && "bg-light-slate-4 "
"flex items-center cursor-pointer justify-center flex-1 transition rounded-lg border border-transparent",
value === "list" && "bg-light-slate-4"
)}
>
<span className="sr-only">Contributor list view</span>
<BsListUl className="text-2xl" />
</div>
<div
</button>
<button
role="radio"
aria-checked={value === "grid"}
name="layout"
onClick={() => handleToggle("grid")}
role="toggle"
className={clsx(
"flex items-center justify-center flex-1 rounded-lg transition cursor-pointer",
value === "grid" && "bg-light-slate-4 "
"flex items-center justify-center flex-1 rounded-lg transition cursor-pointer border border-transparent",
value === "grid" && "bg-light-slate-4"
)}
>
<span className="sr-only">Contributor grid view</span>
<BiGridAlt className="text-2xl" />
</div>
</button>
</div>
);
};
Expand Down
4 changes: 4 additions & 0 deletions e2e/explore-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ test("Loads explore contributors page", async ({ page }) => {
await expect(page.getByRole("button", { name: "7d" })).toBeVisible();
await expect(page.getByRole("button", { name: "30d" })).toBeVisible();
await expect(page.getByRole("button", { name: "3m" })).toBeVisible();

await expect(page.getByRole("radio", { name: "Contributor list view" })).toBeVisible();
await expect(page.getByRole("radio", { name: "Contributor list view" })).toBeChecked();
await expect(page.getByRole("radio", { name: "Contributor grid view" })).toBeVisible();
});

test("Loads explore activity page", async ({ page }) => {
Expand Down
Loading