forked from solidjs/solid-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.ts
117 lines (115 loc) · 3.32 KB
/
routes.ts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import { Component, lazy } from 'solid-js';
import { RouteDefinition, Navigate, RouteSectionProps } from '@solidjs/router';
import { ContributorsData } from './pages/Contributors.data';
import { BenchmarkData } from './pages/Benchmarks.data';
import { DocsData } from './pages/Docs.data';
import { GuideData } from './pages/Guide.data';
import { TutorialData } from './pages/Tutorial.data';
import { PackagesData } from './pages/Packages.data';
import { ResourcesData } from './pages/Resources.data';
import { ExamplesData } from './pages/Examples.data';
import { StoreData } from './pages/Store.data';
import { BlogData } from './pages/Blog.data';
import { BlogArticleData } from './pages/BlogArticle.data';
export const routes: RouteDefinition[] = [
{
path: '/',
component: lazy(() => import('./pages/Home')) as Component<RouteSectionProps>,
load: () => ({
benchmarks: BenchmarkData(),
}),
},
{
path: '/guides/:id',
component: lazy(() => import('./pages/Docs')) as Component<RouteSectionProps>,
load: GuideData,
},
{
path: '/hack',
component: () => {
typeof window !== 'undefined' && (window.location.href = 'https://hack.solidjs.com');
return null;
},
},
{
path: '/guide',
component: () => Navigate({ href: '/guides/getting-started' }),
load: GuideData,
},
{
path: '/guides',
component: () => Navigate({ href: '/guides/getting-started' }),
load: GuideData,
},
{
path: '/blog/:slug',
component: lazy(() => import('./pages/BlogArticle')) as Component<RouteSectionProps>,
load: BlogArticleData,
},
{
path: '/blog',
component: lazy(() => import('./pages/Blog')) as Component<RouteSectionProps>,
load: BlogData,
},
{
path: '/docs',
component: lazy(() => import('./pages/Docs')) as Component<RouteSectionProps>,
children: [
{
path: '/:version',
component: lazy(() => import('./pages/Docs')) as Component<RouteSectionProps>,
},
{
path: '/*all',
component: lazy(() => import('./pages/Docs')) as Component<RouteSectionProps>,
},
],
load: DocsData,
},
{
path: '/tutorial/:id',
component: lazy(() => import('./pages/Tutorial')) as Component<RouteSectionProps>,
load: TutorialData,
},
{
path: '/tutorial',
component: () => Navigate({ href: '/tutorial/introduction_basics' }),
},
{
path: '/examples/:id',
component: lazy(() => import('./pages/Examples')) as Component<RouteSectionProps>,
load: ExamplesData,
},
{
path: '/examples',
component: () => Navigate({ href: '/examples/counter' }),
},
{
path: '/contributors',
component: lazy(() => import('./pages/Contributors')) as Component<RouteSectionProps>,
load: ContributorsData,
},
{
path: '/ecosystem',
component: lazy(() => import('./pages/Packages')) as Component<RouteSectionProps>,
load: PackagesData,
},
{
path: '/resources',
component: lazy(() => import('./pages/Resources')) as Component<RouteSectionProps>,
load: ResourcesData,
},
{
path: '/media',
component: lazy(() => import('./pages/Media')),
},
{
path: '/store',
component: lazy(() => import('./pages/Store')) as Component<RouteSectionProps>,
load: StoreData,
},
{
path: '/*all',
component: lazy(() => import('./pages/404')),
},
];