-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e559113
commit 1074e6d
Showing
3 changed files
with
34 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 8 additions & 49 deletions
57
packages/electrode-webpack-reporter/client/components/home.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,14 @@ | ||
import React, {PropTypes} from "react"; | ||
import MuiThemeProvider from "material-ui/styles/MuiThemeProvider"; | ||
import darkBaseTheme from "material-ui/styles/baseThemes/darkBaseTheme"; | ||
import getMuiTheme from "material-ui/styles/getMuiTheme"; | ||
import {Tabs, Tab} from "material-ui/Tabs"; | ||
import WarningsErrors from "./warnings-errors"; | ||
import WebpackInfo from "./webpack-info"; | ||
import Legacy from "./legacy"; | ||
import {connect} from "react-redux"; | ||
import styles from "../styles/base.css"; | ||
import Electrify from "electrode-electrify-react-component"; | ||
import Navbar from "./navbar"; | ||
|
||
const Home = (props) => { | ||
return ( | ||
<div className={styles.container}> | ||
<MuiThemeProvider muiTheme={getMuiTheme(darkBaseTheme)}> | ||
<Tabs> | ||
<Tab label="Report"> | ||
<WebpackInfo {...props.info} /> | ||
<WarningsErrors errors={props.errors} warnings={props.warnings} /> | ||
<Electrify | ||
assets={props.assets} | ||
modulesByPkg={props.modulesByPkg} | ||
totalSizeByPkg={props.totalSizeByPkg} | ||
modules={props.modules} | ||
/> | ||
</Tab> | ||
<Tab label="Legacy"> | ||
<div style={ {background: "black", color: "gray", padding: "10px"} }> | ||
<Legacy legacy={props.legacy}/> | ||
</div> | ||
</Tab> | ||
</Tabs> | ||
</MuiThemeProvider> | ||
</div> | ||
); | ||
}; | ||
const Home = (props) => ( | ||
<div> | ||
<Navbar /> | ||
{props.children} | ||
</div>); | ||
|
||
Home.propTypes = { | ||
info: PropTypes.object, | ||
assets: PropTypes.array, | ||
modulesByPkg: PropTypes.object, | ||
warnings: PropTypes.array, | ||
errors: PropTypes.array, | ||
legacy: PropTypes.string, | ||
totalSizeByPkg: PropTypes.number, | ||
modules: PropTypes.array | ||
children: PropTypes.array | ||
}; | ||
|
||
const mapStateToProps = (state) => state; | ||
|
||
export default connect( | ||
mapStateToProps | ||
)(Home); | ||
|
||
export default Home; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
import React from "react"; | ||
import {Route} from "react-router"; | ||
import React, {PropTypes} from "react"; | ||
import {connect} from "react-redux"; | ||
import {Router, Route, browserHistory, IndexRoute} from "react-router"; | ||
import Home from "./components/home"; | ||
import Report from "./components/report"; | ||
import Legacy from "./components/legacy"; | ||
|
||
export const routes = ( | ||
<Route path="/" component={Home}/> | ||
); | ||
const Routes = (props) => ( | ||
<Router history={browserHistory}> | ||
<Route path="/reporter" component={Home}> | ||
<IndexRoute component={() => (<Report webpackInfo={props}/>)}/> | ||
<Route path="/reporter/report" component={() => (<Report webpackInfo={props}/>)}/> | ||
<Route path="/reporter/legacy" component={() => (<Legacy legacy={props.legacy}/>)}/> | ||
</Route> | ||
</Router>); | ||
|
||
const mapStateToProps = (state) => state; | ||
|
||
Routes.propTypes = { | ||
legacy: PropTypes.object | ||
}; | ||
|
||
|
||
export default connect( | ||
mapStateToProps | ||
)(Routes); |