-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExamples.tsx
78 lines (72 loc) · 2.39 KB
/
Examples.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
import * as React from 'react';
import { Switch, Route } from 'react-router-dom';
import { withRouter, useLocation } from 'react-router';
import { Grid, Tabs, Tab, Box } from '@material-ui/core';
import {
ReactPureExample,
ReactBaseExample,
ReactTasksQueueExample,
ReactSimpleGeneratorExample,
ReactInfGeneratorExample,
ReactFilesProcessingExample,
ReactBrainJsXORExample,
ReactPromiseResultExample
} from './React';
const Examples = (props) => {
const location = useLocation();
const [value, setValue] = React.useState<string>(location.pathname);
const handleChange = (event, newValue) => {
setValue(newValue);
props.history.push(newValue);
};
return (
<Grid container>
<Tabs
value={value}
onChange={handleChange}
orientation={'vertical'}
>
<Tab label={'Home'} value={'/'}/>
<Tab label={'React Pure'} value={'/react/pure'}/>
<Tab label={'React Base'} value={'/react/base'}/>
<Tab label={'React Tasks Queue'} value={'/react/tasks-queue'}/>
<Tab label={'React Simple Generator'} value={'/react/simple-generator'}/>
<Tab label={'React Infinity Generator'} value={'/react/inf-generator'}/>
<Tab label={'React Promise Result'} value={'/react/promise-result'}/>
<Tab label={'React Files Processing'} value={'/react/files-processing'}/>
<Tab label={'React Brain.js'} value={'/react/brain-js-xor'}/>
</Tabs>
<Box p={2}>
<Switch>
<Route path="/" exact>
</Route>
<Route path="/react/pure">
<ReactPureExample/>
</Route>
<Route path="/react/base">
<ReactBaseExample/>
</Route>
<Route path="/react/tasks-queue">
<ReactTasksQueueExample/>
</Route>
<Route path="/react/simple-generator">
<ReactSimpleGeneratorExample/>
</Route>
<Route path="/react/inf-generator">
<ReactInfGeneratorExample/>
</Route>
<Route path="/react/promise-result">
<ReactPromiseResultExample/>
</Route>
<Route path="/react/files-processing">
<ReactFilesProcessingExample/>
</Route>
<Route path="/react/brain-js-xor">
<ReactBrainJsXORExample/>
</Route>
</Switch>
</Box>
</Grid>
);
};
export default withRouter(Examples);