Skip to content

Commit

Permalink
fix changes suggested
Browse files Browse the repository at this point in the history
  • Loading branch information
syrok94 committed Oct 3, 2024
1 parent 47b11dc commit 6d37e0d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
6 changes: 2 additions & 4 deletions src/components/navbar/NavItem.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { Link, usePathname } from "@/i18n/routing";
import { twMerge } from "tailwind-merge";
import { InteractiveIcon } from "../timer/InteractiveIcon";
import { useTranslations } from "next-intl";

interface NavItem {
path: string;
icon: React.ReactNode;
toolTipMessage:any;
toolTipMessage:string;
}

export function NavItem({ path, icon , toolTipMessage}: NavItem) {
const pathname = usePathname();
const t = useTranslations();
return (
<>
<li className="grow first:rounded-s-md last:rounded-e-md overflow-hidden">
Expand All @@ -27,7 +25,7 @@ export function NavItem({ path, icon , toolTipMessage}: NavItem) {
<InteractiveIcon
icon={icon}
animation={false}
message={t(toolTipMessage)}
message={toolTipMessage}
/>
</Link>
</li>
Expand Down
49 changes: 26 additions & 23 deletions src/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,7 @@ import {
CubeIcon,
StackIcon,
} from "@radix-ui/react-icons";

const navigation: Navigation = [
{
path: "/",
icon: <ClockIcon />,
toolTipMessage: "Index.HomePage.title",
},
{
path: "/solves",
icon: <StackIcon />,
toolTipMessage: "Index.SolvesPage.title",
},
{
path: "/stats",
icon: <BarChartIcon />,
toolTipMessage: "Index.StatsPage.title",
},
{
path: "/cubes",
icon: <CubeIcon />,
toolTipMessage: "Index.CubesPage.title",
},
];
import { useTranslations } from "next-intl";

type Navigation = NavItem[];

Expand All @@ -39,6 +17,31 @@ interface NavItem {
}

export default function Navbar() {

const t = useTranslations("Index");

const navigation: Navigation = [
{
path: "/",
icon: <ClockIcon />,
toolTipMessage: t("HomePage.title"),
},
{
path: "/solves",
icon: <StackIcon />,
toolTipMessage: t("SolvesPage.title"),
},
{
path: "/stats",
icon: <BarChartIcon />,
toolTipMessage: t("StatsPage.title"),
},
{
path: "/cubes",
icon: <CubeIcon />,
toolTipMessage: t("CubesPage.title"),
},
];
return (
<NavContainer>
{navigation.map((item: NavItem) => {
Expand Down

0 comments on commit 6d37e0d

Please sign in to comment.