|
1 | 1 | import 'babel-core/polyfill'; |
| 2 | + |
2 | 3 | import React from 'react'; |
3 | 4 | import ReactDOM from 'react-dom'; |
4 | | -import Header from './components/Header.js'; |
5 | | -import Footer from './components/Footer.js'; |
6 | | -import Tooltip from 'react-tooltip-component'; |
| 5 | +import {createHistory, useBasename} from 'history'; |
| 6 | +import Router from 'react-router'; |
| 7 | +import App from 'components/App.js'; |
| 8 | +import pkg from '../../package.json'; |
7 | 9 |
|
8 | | -import './bower_components/bootstrap-customize/css/bootstrap.css'; |
9 | | -//import 'react-tooltip-component/src/tooltip.scss'; |
10 | | -import './assets/styles/app.scss'; |
| 10 | +import 'assets/bower_components/bootstrap-customize/css/bootstrap.css'; |
| 11 | +import 'react-tooltip-component/src/tooltip.scss'; |
| 12 | +import 'assets/styles/app.scss'; |
11 | 13 |
|
12 | | -class App extends React.Component { |
13 | | - render() { |
14 | | - return ( |
15 | | - <div className='layout-page'> |
16 | | - <Header/> |
17 | | - <main className='layout-main'> |
18 | | - <div className='container'> |
19 | | - <div className='tooltips-example'> |
20 | | - <Tooltip title='Tooltip on top' position='top'> |
21 | | - <button className='btn btn-default'>Tooltip on top</button> |
22 | | - </Tooltip> |
23 | | - <Tooltip title='Tooltip on bottom' position='bottom'> |
24 | | - <button className='btn btn-default'>Tooltip on bottom</button> |
25 | | - </Tooltip> |
26 | | - <Tooltip title='Tooltip on left' position='left'> |
27 | | - <button className='btn btn-default'>Tooltip on left</button> |
28 | | - </Tooltip> |
29 | | - <Tooltip title='Tooltip on right' position='right'> |
30 | | - <button className='btn btn-default'>Tooltip on right</button> |
31 | | - </Tooltip> |
32 | | - </div> |
33 | | - <hr/> |
34 | | - <div className='tooltips-example'> |
35 | | - <Tooltip title='Tooltip on top' position='top' fixed={false}> |
36 | | - <button className='btn btn-default btn-lg'> |
37 | | - Tooltip on top [fixed=false] |
38 | | - </button> |
39 | | - </Tooltip> |
40 | | - <Tooltip title='Tooltip on bottom' position='bottom' |
41 | | - fixed={false}> |
42 | | - <button className='btn btn-default btn-lg'> |
43 | | - Tooltip on bottom [fixed=false] |
44 | | - </button> |
45 | | - </Tooltip> |
46 | | - <Tooltip title='Tooltip on left' position='left' fixed={false}> |
47 | | - <button className='btn btn-default btn-lg'> |
48 | | - Tooltip on left [fixed=false] |
49 | | - </button> |
50 | | - </Tooltip> |
51 | | - <Tooltip title='Tooltip on right' position='right' fixed={false}> |
52 | | - <button className='btn btn-default btn-lg'> |
53 | | - Tooltip on right [fixed=false] |
54 | | - </button> |
55 | | - </Tooltip> |
56 | | - </div> |
57 | | - <hr/> |
58 | | - <div className='tooltips-example'> |
59 | | - <Tooltip title='Tooltip on bottom' position='bottom' space={10}> |
60 | | - <button className='btn btn-default'> |
61 | | - Tooltip on bottom [space=10] |
62 | | - </button> |
63 | | - </Tooltip> |
64 | | - <Tooltip title='Tooltip on bottom' position='bottom' space={20}> |
65 | | - <button className='btn btn-default'> |
66 | | - Tooltip on bottom [space=20] |
67 | | - </button> |
68 | | - </Tooltip> |
69 | | - <Tooltip title='Tooltip on bottom' position='bottom' space={30}> |
70 | | - <button className='btn btn-default'> |
71 | | - Tooltip on bottom [space=30] |
72 | | - </button> |
73 | | - </Tooltip> |
74 | | - <Tooltip title='Tooltip on bottom' position='bottom' space={40}> |
75 | | - <button className='btn btn-default'> |
76 | | - Tooltip on bottom [space=40] |
77 | | - </button> |
78 | | - </Tooltip> |
79 | | - </div> |
80 | | - </div> |
81 | | - </main> |
82 | | - <Footer/> |
83 | | - </div> |
84 | | - ); |
85 | | - } |
86 | | -} |
| 14 | +const routes = { |
| 15 | + path: '/', |
| 16 | + component: App, |
| 17 | + indexRoute: { |
| 18 | + component: require('./components/pages/PageHome') |
| 19 | + }, |
| 20 | + childRoutes: [ |
| 21 | + require('./routes/Example1Route'), |
| 22 | + require('./routes/Example2Route') |
| 23 | + ] |
| 24 | +}; |
87 | 25 |
|
88 | | -function run() { |
89 | | - ReactDOM.render(<App />, document.getElementById('app')); |
90 | | -} |
| 26 | +const DEV = process && process.env && process.env.NODE_ENV === 'development'; |
| 27 | +const history = useBasename(createHistory)({ |
| 28 | + basename: '/' + (DEV ? '' : pkg.name) |
| 29 | +}); |
| 30 | + |
| 31 | +const run = () => { |
| 32 | + ReactDOM.render( |
| 33 | + <Router routes={routes} history={history}/>, |
| 34 | + document.getElementById('app') |
| 35 | + ); |
| 36 | +}; |
91 | 37 |
|
92 | 38 | if (window.addEventListener) { |
93 | 39 | window.addEventListener('DOMContentLoaded', run); |
|
0 commit comments