feat(app): simplify navigation links
This commit is contained in:
parent
873d0009d4
commit
db3667c024
@ -7,7 +7,8 @@ import {
|
|||||||
CardTitle,
|
CardTitle,
|
||||||
} from '@boring.tools/ui'
|
} from '@boring.tools/ui'
|
||||||
import { Link } from '@tanstack/react-router'
|
import { Link } from '@tanstack/react-router'
|
||||||
import { BellIcon, HomeIcon } from 'lucide-react'
|
import { BellIcon } from 'lucide-react'
|
||||||
|
import { NavigationRoutes } from '../utils/navigation-routes'
|
||||||
|
|
||||||
export const Navigation = () => {
|
export const Navigation = () => {
|
||||||
return (
|
return (
|
||||||
@ -24,14 +25,17 @@ export const Navigation = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<nav className="grid items-start px-2 text-sm font-medium lg:px-4">
|
<nav className="grid items-start px-2 text-sm font-medium lg:px-4">
|
||||||
<Link
|
{NavigationRoutes.map((route) => (
|
||||||
to="/"
|
<Link
|
||||||
className="flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary"
|
key={route.to}
|
||||||
activeProps={{ className: 'bg-muted text-primary' }}
|
to={route.to}
|
||||||
>
|
className="flex items-center gap-3 rounded-lg px-3 py-2 transition-all hover:text-primary"
|
||||||
<HomeIcon className="h-4 w-4" />
|
activeProps={{ className: 'bg-muted text-primary' }}
|
||||||
Dashboard
|
>
|
||||||
</Link>
|
<route.icon className="h-4 w-4" />
|
||||||
|
{route.name}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-auto p-4">
|
<div className="mt-auto p-4">
|
||||||
@ -39,8 +43,8 @@ export const Navigation = () => {
|
|||||||
<CardHeader className="p-2 pt-0 md:p-4">
|
<CardHeader className="p-2 pt-0 md:p-4">
|
||||||
<CardTitle>More Infos</CardTitle>
|
<CardTitle>More Infos</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
If you want more informations about boring.tools, visit our
|
If you want more information about boring.tools, visit our
|
||||||
documenation!
|
documentation!
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="p-2 pt-0 md:p-4 md:pt-0">
|
<CardContent className="p-2 pt-0 md:p-4 md:pt-0">
|
||||||
|
@ -10,7 +10,8 @@ import {
|
|||||||
SheetTrigger,
|
SheetTrigger,
|
||||||
} from '@boring.tools/ui'
|
} from '@boring.tools/ui'
|
||||||
import { Link } from '@tanstack/react-router'
|
import { Link } from '@tanstack/react-router'
|
||||||
import { HomeIcon, MenuIcon } from 'lucide-react'
|
import { MenuIcon } from 'lucide-react'
|
||||||
|
import { NavigationRoutes } from '../utils/navigation-routes'
|
||||||
|
|
||||||
export const NavigationMobile = () => {
|
export const NavigationMobile = () => {
|
||||||
return (
|
return (
|
||||||
@ -29,24 +30,27 @@ export const NavigationMobile = () => {
|
|||||||
>
|
>
|
||||||
<span className="sr-only">boring.tools</span>
|
<span className="sr-only">boring.tools</span>
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
{NavigationRoutes.map((route) => (
|
||||||
to="/"
|
<Link
|
||||||
className="mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground"
|
key={route.to}
|
||||||
activeProps={{
|
to={route.to}
|
||||||
className: 'bg-muted text-foreground',
|
className="mx-[-0.65rem] flex items-center gap-4 rounded-xl px-3 py-2 hover:text-foreground"
|
||||||
}}
|
activeProps={{
|
||||||
>
|
className: 'bg-muted text-foreground',
|
||||||
<HomeIcon className="h-5 w-5" />
|
}}
|
||||||
Dashboard
|
>
|
||||||
</Link>
|
<route.icon className="h-5 w-5" />
|
||||||
|
{route.name}
|
||||||
|
</Link>
|
||||||
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
<div className="mt-auto">
|
<div className="mt-auto">
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="p-2 pt-0 md:p-4">
|
<CardHeader className="p-2 pt-0 md:p-4">
|
||||||
<CardTitle>More Infos</CardTitle>
|
<CardTitle>More Infos</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
If you want more informations about boring.tools, visit our
|
If you want more information about boring.tools, visit our
|
||||||
documenation!
|
documentation!
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="p-2 pt-0 md:p-4 md:pt-0">
|
<CardContent className="p-2 pt-0 md:p-4 md:pt-0">
|
||||||
|
9
apps/app/src/utils/navigation-routes.ts
Normal file
9
apps/app/src/utils/navigation-routes.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { HouseIcon } from 'lucide-react'
|
||||||
|
|
||||||
|
export const NavigationRoutes = [
|
||||||
|
{
|
||||||
|
name: 'Dashboard',
|
||||||
|
to: '/',
|
||||||
|
icon: HouseIcon,
|
||||||
|
},
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user