mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Fixed 'use client' usage.
This commit is contained in:
parent
be5592446a
commit
f7151a880e
208 changed files with 323 additions and 385 deletions
24
src/components/layout/MenuLayout.tsx
Normal file
24
src/components/layout/MenuLayout.tsx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import { ReactNode } from 'react';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import SideNav from 'components/layout/SideNav';
|
||||
import styles from './MenuLayout.module.css';
|
||||
|
||||
export function MenuLayout({ items = [], children }: { items: any[]; children: ReactNode }) {
|
||||
const pathname = usePathname();
|
||||
const cloudMode = !!process.env.cloudMode;
|
||||
|
||||
const getKey = () => items.find(({ url }) => pathname === url)?.key;
|
||||
|
||||
return (
|
||||
<div className={styles.layout}>
|
||||
{!cloudMode && (
|
||||
<div className={styles.menu}>
|
||||
<SideNav items={items} shallow={true} selectedKey={getKey()} />
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.content}>{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default MenuLayout;
|
||||
Loading…
Add table
Add a link
Reference in a new issue