/
index.tsx
93 lines (87 loc) · 2.77 KB
/
index.tsx
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
import React, { Component, Fragment } from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import Header from './Header';
import Footer from './Footer';
// import NoMatch from '../NoMatch';
import {
AppContainer,
AppContent,
PageContent,
PrimaryNav,
PrimaryNavItem,
ScrollRestoration,
} from './components';
import Section from './Section';
import PageNav from './PageNav';
import Tests from '../Tests';
const sections = [
{ label: 'Home', path: '/home' },
{ label: 'Props', path: '/props' },
{ label: 'Styles', path: '/styles' },
{ label: 'Components', path: '/components' },
{ label: 'Async', path: '/async' },
{ label: 'Creatable', path: '/creatable' },
{ label: 'Advanced', path: '/advanced' },
{ label: 'TypeScript', path: '/typescript' },
{ label: 'Upgrading', path: '/upgrade' },
];
export default class App extends Component {
render() {
return (
<BrowserRouter>
<Switch>
<Route exact path="/cypress-tests" component={Tests} />
<Route>
<div>
<Header>
<Route
render={({ location }) => (
<PrimaryNav>
{sections.map((l) => {
const selected = location.pathname.includes(l.path);
return (
<PrimaryNavItem
key={l.path}
selected={selected}
to={l.path}
>
{l.label}
</PrimaryNavItem>
);
})}
</PrimaryNav>
)}
/>
</Header>
<ScrollRestoration>
<AppContainer>
<Helmet>
<title>React Select</title>
<meta
name="description"
content="A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete, async and creatable support."
/>
</Helmet>
<Route
render={(props) => (
<Fragment>
<PageNav {...props} />
<AppContent>
<PageContent>
<Section {...props} />
</PageContent>
</AppContent>
</Fragment>
)}
/>
</AppContainer>
</ScrollRestoration>
<Footer />
</div>
</Route>
</Switch>
</BrowserRouter>
);
}
}