Skip to content

Commit

Permalink
Merge pull request #18 from ranjithprabhuk/development
Browse files Browse the repository at this point in the history
Development -> Master
  • Loading branch information
ranjithprabhuk authored Jul 5, 2018
2 parents b7e9583 + 702bb93 commit d7c495e
Show file tree
Hide file tree
Showing 24 changed files with 1,670 additions and 116 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<link href='https://fonts.googleapis.com/icon?family=Material+Icons' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="app"></div>
<div id="material-magic"></div>
</body>
</html>
46 changes: 29 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
"webpack-hot-middleware": "^2.18.0"
},
"dependencies": {
"@material-ui/core": "^1.2.1",
"@material-ui/icons": "^1.0.0",
"@material-ui/core": "^1.3.0",
"@material-ui/icons": "^2.0.0-beta.1",
"@types/classnames": "^2.2.4",
"@types/recharts": "^1.0.21",
"html-loader": "^0.5.4",
Expand Down
88 changes: 88 additions & 0 deletions src/app/charts/Charts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import * as React from 'react';
import { withStyles } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
import { homeStyles } from './charts.styles';
import { IChartProps, IChartState } from './ICharts';

import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
import { Paper } from '@material-ui/core';
const data = [
{ name: 'Page A', uv: 4000, pv: 2400, amt: 2400 },
{ name: 'Page B', uv: 3000, pv: 1398, amt: 2210 },
{ name: 'Page C', uv: 2000, pv: 9800, amt: 2290 },
{ name: 'Page D', uv: 2780, pv: 3908, amt: 2000 },
{ name: 'Page E', uv: 1890, pv: 4800, amt: 2181 },
{ name: 'Page F', uv: 2390, pv: 3800, amt: 2500 },
{ name: 'Page G', uv: 3490, pv: 4300, amt: 2100 },
];

class Charts extends React.Component<IChartProps, IChartState> {
public render(): React.ReactElement<Charts> {
const { classes } = this.props;

return (
<div className={classes.root}>
<Grid container spacing={8}>
<Grid item sm={12} md={6}>
<Paper>
<ResponsiveContainer width='100%' height={300}>
<AreaChart data={data}
margin={{ top: 20, right: 20, left: 20, bottom: 20 }}>
<CartesianGrid strokeDasharray='3 3' />
<XAxis dataKey='name' />
<YAxis />
<Tooltip />
<Area type='monotone' dataKey='uv' stroke='#8884d8' fill='#8884d8' />
</AreaChart>
</ResponsiveContainer>
</Paper>
</Grid>
<Grid item sm={12} md={6}>
<Paper>
<ResponsiveContainer width='100%' height={300}>
<AreaChart data={data}
margin={{ top: 20, right: 20, left: 20, bottom: 20 }}>
<CartesianGrid strokeDasharray='3 3' />
<XAxis dataKey='name' />
<YAxis />
<Tooltip />
<Area type='monotone' dataKey='uv' stroke='#8884d8' fill='#8884d8' />
</AreaChart>
</ResponsiveContainer>
</Paper>
</Grid>
<Grid item sm={12} md={6}>
<Paper>
<ResponsiveContainer width='100%' height={300}>
<AreaChart data={data}
margin={{ top: 20, right: 20, left: 20, bottom: 20 }}>
<CartesianGrid strokeDasharray='3 3' />
<XAxis dataKey='name' />
<YAxis />
<Tooltip />
<Area type='monotone' dataKey='uv' stroke='#8884d8' fill='#8884d8' />
</AreaChart>
</ResponsiveContainer>
</Paper>
</Grid>
<Grid item sm={12} md={6}>
<Paper>
<ResponsiveContainer width='100%' height={300}>
<AreaChart data={data}
margin={{ top: 20, right: 20, left: 20, bottom: 20 }}>
<CartesianGrid strokeDasharray='3 3' />
<XAxis dataKey='name' />
<YAxis />
<Tooltip />
<Area type='monotone' dataKey='uv' stroke='#8884d8' fill='#8884d8' />
</AreaChart>
</ResponsiveContainer>
</Paper>
</Grid>
</Grid>
</div >
);
}
}

export default withStyles(homeStyles)(Charts);
14 changes: 14 additions & 0 deletions src/app/charts/ICharts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Theme } from '@material-ui/core';

interface IChartOwnProps {
classes: any;
}
interface IChartStateProps {
theme: Theme;
}

export type IChartProps = IChartOwnProps & IChartStateProps;

export interface IChartState {
open: boolean;
}
54 changes: 1 addition & 53 deletions src/app/charts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1 @@
import * as React from 'react';
import { withStyles } from '@material-ui/core/styles';
import Grid from '@material-ui/core/Grid';
import { homeStyles } from './charts.styles';
import { IHomeProps, IHomeState } from './charts.interface';

import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
import { Card, Button, Paper } from '@material-ui/core';
const data = [
{ name: 'Page A', uv: 4000, pv: 2400, amt: 2400 },
{ name: 'Page B', uv: 3000, pv: 1398, amt: 2210 },
{ name: 'Page C', uv: 2000, pv: 9800, amt: 2290 },
{ name: 'Page D', uv: 2780, pv: 3908, amt: 2000 },
{ name: 'Page E', uv: 1890, pv: 4800, amt: 2181 },
{ name: 'Page F', uv: 2390, pv: 3800, amt: 2500 },
{ name: 'Page G', uv: 3490, pv: 4300, amt: 2100 },
];

class Charts extends React.Component<IHomeProps, IHomeState> {
public render(): React.ReactElement<Charts> {
const { classes } = this.props;

return (
<div className={classes.root}>
<Grid container spacing={8}>
<Grid item sm={12} md={6}>
<Paper>
<ResponsiveContainer width='100%' height={300}>
<AreaChart data={data}
margin={{ top: 20, right: 20, left: 20, bottom: 20 }}>
<CartesianGrid strokeDasharray='3 3' />
<XAxis dataKey='name' />
<YAxis />
<Tooltip />
<Area type='monotone' dataKey='uv' stroke='#8884d8' fill='#8884d8' />
</AreaChart>
</ResponsiveContainer>
</Paper>
</Grid>
<Grid item sm={12} md={6}>
<Card>
<Button color='primary'>Primary</Button>
<Button color='default'>Default</Button>
<Button color='secondary'>Secondary</Button>
</Card>
</Grid>
</Grid>
</div >
);
}
}

export default withStyles(homeStyles)(Charts);
export { default } from './Charts';
23 changes: 14 additions & 9 deletions src/app/components/panel/CollapsiblePanel/CollapsiblePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import {Card, Typography} from '@material-ui/core';
import CardActions from '@material-ui/core/CardActions';
import Collapse from '@material-ui/core/Collapse';
import IconButton from '@material-ui/core/IconButton';
import FavoriteIcon from '@material-ui/icons/Favorite';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import { flexDirection } from '../../../../theme';

const styles = (theme: Theme) => ({
const styles = (theme: Theme): any => ({
actions: {
display: 'flex',
padding: '0px 12px',
flexDirection,
},
expand: {
transform: 'rotate(0deg)',
Expand All @@ -28,28 +29,32 @@ const styles = (theme: Theme) => ({
class CollapsiblePanel extends React.Component<any, any> {
public state: any = { expanded: false };

public componentDidMount(): void {
if (this.props.autoOpen) {
this.handleExpandClick();
}
}

public handleExpandClick = () => {
this.setState({ expanded: !this.state.expanded });
}

public render(): any {
const { classes, header } = this.props;
const { classes, header, customheader, className } = this.props;
console.log('cjeckdfd', this.props);

return (
<div>
<Card>
<CardActions className={classes.actions} disableActionSpacing>
<IconButton aria-label='Add to favorites'>
<FavoriteIcon />
</IconButton>
<Typography paragraph variant='body2'>{header}</Typography>
<CardActions className={classnames(classes.actions, className)} disableActionSpacing>
{customheader ? customheader : <Typography variant='body2'>{header}</Typography>}
<IconButton
className={classnames(classes.expand, {
[classes.expandOpen]: this.state.expanded,
})}
onClick={this.handleExpandClick}
aria-expanded={this.state.expanded}
aria-label='Show more'
aria-label={this.state.expand ? 'Hide' : 'Show More'}
>
<ExpandMoreIcon />
</IconButton>
Expand Down
7 changes: 6 additions & 1 deletion src/app/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ import { IDashboardProps, IDashboardState } from './IDashboard';
import Home from '../home';
import Charts from '../charts';
import Buttons from '../buttons';
import Icons from '../icons';
import Forms from '../forms';
import { Route, Switch, Redirect } from 'react-router-dom';
import Sidebar from './SideBar';
import Header from './Header';


class Dashboard extends React.Component<IDashboardProps, IDashboardState> {
constructor(props: IDashboardProps, context: any) {
super(props, context);
Expand Down Expand Up @@ -39,7 +42,9 @@ class Dashboard extends React.Component<IDashboardProps, IDashboardState> {
<Route exact path='/dashboard/home' component={Home} />
<Route exact path='/dashboard/charts' component={Charts} />
<Route exact path='/dashboard/buttons' component={Buttons} />
<Route exact path='/dashboard/widgets/stats' component={Home} />
<Route exact path='/dashboard/icons' component={Icons} />
<Route exact path='/dashboard/widgets' component={Home} />
<Route exact path='/dashboard/form-elements/forms' component={Forms} />
<Redirect path='/dashboard' to='/dashboard/home' />
</Switch>
</div>
Expand Down
Loading

0 comments on commit d7c495e

Please sign in to comment.