fix: links instead of buttons for navigation

This commit is contained in:
2025-08-27 15:24:45 +04:00
parent a280f7ad12
commit e9b8cdb010
2 changed files with 10 additions and 16 deletions

View File

@ -1,8 +1,8 @@
"use client"; "use client";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { usePathname, useRouter } from "next/navigation"; import Link from "next/link";
import { UnstyledButton } from "@mantine/core"; import { usePathname } from "next/navigation";
import styles from "./Footer.module.css"; import styles from "./Footer.module.css";
type Props = { type Props = {
@ -12,17 +12,14 @@ type Props = {
const FooterClickable = ({ children, href }: Props) => { const FooterClickable = ({ children, href }: Props) => {
const pathname = usePathname(); const pathname = usePathname();
const router = useRouter();
const onClick = () => router.push(href);
return ( return (
<UnstyledButton <Link
onClick={onClick} href={href}
className={styles.link} className={styles.link}
data-active={pathname === href || undefined}> data-active={pathname === href || undefined}>
{children} {children}
</UnstyledButton> </Link>
); );
}; };

View File

@ -1,8 +1,8 @@
"use client"; "use client";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { usePathname, useRouter } from "next/navigation"; import Link from "next/link";
import { UnstyledButton } from "@mantine/core"; import { usePathname } from "next/navigation";
import styles from "./Navbar.module.css"; import styles from "./Navbar.module.css";
type Props = { type Props = {
@ -13,17 +13,14 @@ type Props = {
const NavbarClickable = ({ children, href, active = false }: Props) => { const NavbarClickable = ({ children, href, active = false }: Props) => {
const pathname = usePathname(); const pathname = usePathname();
const router = useRouter();
const onClick = () => router.push(href);
return ( return (
<UnstyledButton <Link
onClick={onClick} href={href}
className={styles.link} className={styles.link}
data-active={active || pathname === href || undefined}> data-active={active || pathname === href || undefined}>
{children} {children}
</UnstyledButton> </Link>
); );
}; };