fix: links instead of buttons for navigation
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { ReactNode } from "react";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { UnstyledButton } from "@mantine/core";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import styles from "./Footer.module.css";
|
||||
|
||||
type Props = {
|
||||
@ -12,17 +12,14 @@ type Props = {
|
||||
|
||||
const FooterClickable = ({ children, href }: Props) => {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
|
||||
const onClick = () => router.push(href);
|
||||
|
||||
return (
|
||||
<UnstyledButton
|
||||
onClick={onClick}
|
||||
<Link
|
||||
href={href}
|
||||
className={styles.link}
|
||||
data-active={pathname === href || undefined}>
|
||||
{children}
|
||||
</UnstyledButton>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { ReactNode } from "react";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { UnstyledButton } from "@mantine/core";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import styles from "./Navbar.module.css";
|
||||
|
||||
type Props = {
|
||||
@ -13,17 +13,14 @@ type Props = {
|
||||
|
||||
const NavbarClickable = ({ children, href, active = false }: Props) => {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
|
||||
const onClick = () => router.push(href);
|
||||
|
||||
return (
|
||||
<UnstyledButton
|
||||
onClick={onClick}
|
||||
<Link
|
||||
href={href}
|
||||
className={styles.link}
|
||||
data-active={active || pathname === href || undefined}>
|
||||
{children}
|
||||
</UnstyledButton>
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user