Skip to content

Commit 113d2e4

Browse files
committed
Pagination uses disabled prop rather than a disabled wrapper
1 parent bef4432 commit 113d2e4

File tree

2 files changed

+19
-35
lines changed

2 files changed

+19
-35
lines changed

apps/webapp/app/components/primitives/LinkWithDisabled.tsx

Lines changed: 0 additions & 19 deletions
This file was deleted.

apps/webapp/app/components/primitives/Pagination.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { ChevronRightIcon } from "@heroicons/react/24/outline";
22
import { ChevronLeftIcon } from "@heroicons/react/24/solid";
33
import { Link, useLocation } from "@remix-run/react";
44
import { cn } from "~/utils/cn";
5-
import { ButtonContent } from "./Buttons";
6-
import { LinkDisabled } from "./LinkWithDisabled";
5+
import { LinkButton } from "./Buttons";
76

87
export function PaginationControls({
98
currentPage,
@@ -21,33 +20,37 @@ export function PaginationControls({
2120

2221
return (
2322
<nav className="flex items-center gap-0.5" aria-label="Pagination">
24-
<LinkDisabled
23+
<LinkButton
2524
to={pageUrl(location, currentPage - 1)}
26-
className={currentPage > 1 ? "group" : ""}
25+
variant="minimal/small"
26+
LeadingIcon={ChevronLeftIcon}
27+
shortcut={{ key: "j" }}
28+
showTooltip
29+
tooltipDescription="Previous"
2730
disabled={currentPage === 1}
28-
disabledClassName="opacity-30 cursor-default"
31+
className={currentPage > 1 ? "group" : ""}
2932
>
30-
<ButtonContent variant="minimal/small" LeadingIcon={ChevronLeftIcon}>
31-
Prev
32-
</ButtonContent>
33-
</LinkDisabled>
33+
Prev
34+
</LinkButton>
3435

3536
{showPageNumbers
3637
? calculatePageLinks(currentPage, totalPages).map((page, i) => (
3738
<PageLinkComponent page={page} key={i} location={location} />
3839
))
3940
: null}
4041

41-
<LinkDisabled
42+
<LinkButton
4243
to={pageUrl(location, currentPage + 1)}
43-
className={currentPage !== totalPages ? "group" : ""}
44+
variant="minimal/small"
45+
TrailingIcon={ChevronRightIcon}
46+
shortcut={{ key: "k" }}
47+
showTooltip
48+
tooltipDescription="Next"
4449
disabled={currentPage === totalPages}
45-
disabledClassName="opacity-30 cursor-default"
50+
className={currentPage !== totalPages ? "group" : ""}
4651
>
47-
<ButtonContent variant="minimal/small" TrailingIcon={ChevronRightIcon}>
48-
Next
49-
</ButtonContent>
50-
</LinkDisabled>
52+
Next
53+
</LinkButton>
5154
</nav>
5255
);
5356
}

0 commit comments

Comments
 (0)