blob: e637e68b43cd780561ea1a68b481225b2c42185f (
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
|
import React from 'react';
import ReactDOM from 'react-dom';
import 'tailwindcss/tailwind.css';
import {
BrowserRouter as Router,
Switch,
Route,
} from 'react-router-dom';
import Header from './components/Header';
import Home from './containers/Home';
import Service from './containers/Service/Service';
import { ServiceProvider } from './containers/Service/ServiceContext';
import services from './services';
import WaybillForm from './containers/WaybillForm';
import ContractorForm from './containers/ContractorForm';
import ProductForm from './containers/ProductForm';
services[0].Form = ProductForm;
services[1].Form = ContractorForm;
services[2].Form = WaybillForm;
const navigation = [
{ name: 'Главная', route: '/' },
...services.map(({ name, route }) => ({ name, route: `/${route}` })),
];
const App: React.FC = () => (
<Router>
<Header navigation={navigation} />
<Switch>
<Route exact path="/" component={Home} />
{services.map(service => (
<Route path={`/${service.route}`} key={service.route}>
<ServiceProvider value={service}>
<Service />
</ServiceProvider>
</Route>
))}
</Switch>
</Router>
);
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root'),
);
|