aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/routes.ts
blob: dc351e04b20459f9eb56f9c0693934fd210b8e0e (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { ClipboardTextIcon, HouseIcon, InfoIcon, SquaresFourIcon, UserIcon } from '@phosphor-icons/react'
import type { Icon } from '@phosphor-icons/react'
import type { RouteObject } from 'react-router'
import App from './page-home.tsx'
import About from './page-about.tsx'
import Me from './page-about-me.tsx'

export type PageRoute = RouteObject & {
  handle?: { title: string; icon: Icon }
  children?: PageRoute[]
}

export const pageRoutes = [
  {
    id: 'home',
    index: true,
    Component: App,
    handle: { title: '首页', icon: HouseIcon },
  },
  {
    id: 'form',
    path: '/form',
    lazy: async () => ({ Component: (await import('./page-form.tsx')).default }),
    handle: { title: '表单示例', icon: ClipboardTextIcon },
  },
  {
    id: 'ui-kit',
    path: '/ui-kit',
    lazy: async () => ({ Component: (await import('./page-ui-kit.tsx')).default }),
    handle: { title: 'UI Kit', icon: SquaresFourIcon },
  },
  {
    id: 'about',
    path: '/about',
    handle: { title: '关于', icon: InfoIcon },
    children: [
      {
        id: 'about-index',
        index: true,
        Component: About,
        handle: { title: '关于概览', icon: InfoIcon },
      },
      {
        id: 'about-me',
        path: 'me',
        Component: Me,
        handle: { title: '关于我', icon: UserIcon },
      },
    ],
  },
] satisfies PageRoute[]