Files
frontend/apps/cs/app/(with-base-layout)/layout.tsx
T
2025-03-31 18:03:48 +09:00

28 lines
770 B
TypeScript

"use client";
import { usePathname, useRouter } from "next/navigation";
import type { MenuItem } from "@common/components/api";
import { BaseLayout } from "@common/components/ui";
import { MenuWrapper } from "@/entities/menu";
import { useMenuStore } from "@/shared/lib";
export default function WithBaseLayout({
children,
}: {
children: React.ReactNode;
}) {
const router = useRouter();
const pathname = usePathname();
const { setCurrentMenuInfo } = useMenuStore((state) => state);
const handleMenuClick = (item: MenuItem) => {
setCurrentMenuInfo(item);
router.push(item.urlPath);
};
return (
<BaseLayout currentPath={pathname ?? ""} handleMenuClick={handleMenuClick}>
<MenuWrapper>{children}</MenuWrapper>
</BaseLayout>
);
}