Open History to see the last commit
1import * as React from 'react'
2import { Link, Outlet, createFileRoute } from '@tanstack/react-router'
3β
4export const Route = createFileRoute('/dashboard')({
5 component: DashboardComponent,
6})
7β
8function DashboardComponent() {
9 return (
10 <>
11 <div className="flex items-center border-b">
12 <h2 className="text-xl p-2">Dashboard</h2>
13 <Link
14 to="/dashboard/posts/$postId"
15 params={{
16 postId: '3',
17 }}
18 className="py-1 px-2 text-xs bg-blue-500 text-white rounded-full"
19 >
20 1 New Invoice
21 </Link>
22 </div>
23 <div className="flex flex-wrap divide-x">
24 {(
25 [
26 ['.', 'Summary'],
27 ['/dashboard/posts', 'Posts'],
28 ] as const
29 ).map(([to, label]) => {
30 return (
31 <Link
32 from={Route.fullPath}
33 key={to}
34 to={to}
35 activeOptions={{ exact: to === '.' }}
36 activeProps={{ className: `font-bold` }}
37 className="p-2"
38 >
39 {label}
40 </Link>
41 )
42 })}
43 </div>
44 <hr />
45 <Outlet />
46 </>
47 )
48}