Skip to content

Commit

Permalink
Hotfix navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
slhmy authored Feb 4, 2024
1 parent e0cbf40 commit e51b0a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/layouts/PageMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { useNavigate } from "react-router-dom";

interface PageMenuProps {
navigation: Array<{ name: string; href: string; icon: JSX.Element }>;
}

const PageMenu: React.FC<PageMenuProps> = (props) => {
const navigate = useNavigate();

return (
<ul className="menu menu-horizontal rounded-box bg-base-200">
{props.navigation.map((item, index) => (
<li key={index}>
<a href={item.href}>
<div onClick={() => navigate(item.href)}>
{item.icon}
<div className="hidden md:block">{item.name}</div>
</a>
</div>
</li>
))}
</ul>
Expand Down
6 changes: 4 additions & 2 deletions src/layouts/adminLayout/Drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Bars3Icon, HomeIcon, UsersIcon } from "@heroicons/react/24/outline";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";

const iconPath = `${import.meta.env.BASE_URL}images/oj-lab-icon.svg`;

Expand All @@ -10,6 +11,7 @@ const navigation = [

export const Drawer: React.FC = () => {
const { t } = useTranslation();
const navigate = useNavigate();

return (
<div className="drawer z-[1] w-fit lg:drawer-open">
Expand All @@ -36,10 +38,10 @@ export const Drawer: React.FC = () => {
<ul className="menu min-h-full w-80 bg-base-200 p-4 text-base-content">
{navigation.map((item) => (
<li key={item.name}>
<a href={item.href}>
<div onClick={() => navigate(item.href)}>
<item.icon className="h-6 w-6 shrink-0" />
{t(item.name)}
</a>
</div>
</li>
))}
</ul>
Expand Down

0 comments on commit e51b0a0

Please sign in to comment.