Skip to content

Commit

Permalink
refactor: Update NavArrows component to use IconButton
Browse files Browse the repository at this point in the history
  • Loading branch information
luis-herasme committed Sep 4, 2024
1 parent e8c8747 commit af00b62
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions apps/web/src/components/NavArrows.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useRouter } from "next/router";
import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/24/outline";

import { IconButton } from "./IconButton";

export function NavArrows({ next, prev }: { next?: string; prev?: string }) {
return (
<div className="flex items-center justify-center gap-1">
Expand All @@ -14,30 +16,31 @@ function NavArrow({ type, href }: { type: "next" | "prev"; href?: string }) {
const router = useRouter();

return (
<button
<IconButton
onClick={() => {
if (href) {
router.push(href);
}
}}
className={`
dark:bg-neutral-850
bg-border-border-dark
rounded-md
border
border-border-light
bg-white
p-1
dark:border-border-dark
dark:bg-border-dark
${href ? "" : "cursor-default opacity-50"}
`}
dark:bg-neutral-850
bg-border-border-dark
rounded-md
border
border-border-light
bg-white
p-1
dark:border-border-dark
dark:bg-border-dark
${href ? "" : "cursor-default opacity-50"}
`}
disabled={!href}
>
{type === "next" ? (
<ChevronRightIcon className="h-4 w-4" />
) : (
<ChevronLeftIcon className="h-4 w-4" />
)}
</button>
</IconButton>
);
}

0 comments on commit af00b62

Please sign in to comment.