-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmenu.tsx
More file actions
29 lines (27 loc) · 942 Bytes
/
menu.tsx
File metadata and controls
29 lines (27 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { Box, Flex, Link } from '@radix-ui/themes';
import NextLink from 'next/link';
import { usePathname } from 'next/navigation';
import { ReactNode } from 'react';
function MenuItem({ href, children }: { href: string; children: ReactNode }) {
const pathname = usePathname();
const isActive = pathname === href;
return (
<Box pb="1">
<Link asChild color={isActive ? 'blue' : 'gray'}>
<NextLink href={href}>{children}</NextLink>
</Link>
</Box>
);
}
export function Menu() {
return (
<Flex direction={'column'} p="4">
<MenuItem href="/hello-world">Hello World</MenuItem>
<MenuItem href="/hello-world-vanilla">Hello World Vanilla</MenuItem>
<MenuItem href="/radix-inputs">Radix Inputs</MenuItem>
<MenuItem href="/todo-list">Todo List</MenuItem>
<MenuItem href="/starter">Starter</MenuItem>
<MenuItem href="/layout-test">Layout Test</MenuItem>
</Flex>
);
}