-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ranjithprabhuk/development
Development -> Master
- Loading branch information
Showing
23 changed files
with
579 additions
and
99 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as React from 'react'; | ||
import { Theme, withStyles, CircularProgress } from '@material-ui/core'; | ||
|
||
interface IAsyncComponentOwnProps { | ||
moduleProvider: any; | ||
classes: any; | ||
} | ||
|
||
interface IAsyncComponentState { | ||
Component: any; | ||
} | ||
|
||
interface IAsyncComponentStateProps { | ||
theme?: Theme; | ||
} | ||
|
||
type IAsyncComponentProps = IAsyncComponentOwnProps & IAsyncComponentStateProps; | ||
|
||
export const styles = (theme: Theme): any => ({ | ||
loader: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
width: '100vw', | ||
height: '100vh', | ||
}, | ||
progress: { | ||
margin: theme.spacing.unit * 2, | ||
}, | ||
}); | ||
|
||
class AsyncComponent extends React.PureComponent<IAsyncComponentProps, IAsyncComponentState> { | ||
constructor(props: IAsyncComponentProps) { | ||
super(props); | ||
this.state = { | ||
Component: null, | ||
}; | ||
} | ||
|
||
public componentWillMount(): any { | ||
if (!this.state.Component) { | ||
this.props.moduleProvider().then((data: any) => this.setState({ Component: data.default })); | ||
} | ||
} | ||
|
||
public renderLoader(): any { | ||
const {classes} = this.props; | ||
return ( | ||
<div className={classes.loader}> | ||
<CircularProgress className={classes.progress} /> | ||
</div> | ||
); | ||
} | ||
|
||
public render(): any { | ||
const { Component } = this.state; | ||
return Component ? <Component /> : this.renderLoader(); | ||
} | ||
} | ||
|
||
export default withStyles(styles)(AsyncComponent); |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import * as React from 'react'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import { buttonStyles } from './buttons.styles'; | ||
import { IButtonProps, IButtonState } from './IButtons'; | ||
import { Button, CardContent } from '@material-ui/core'; | ||
import { CollapsiblePanel } from '../components'; | ||
import { ButtonProps } from '@material-ui/core/Button'; | ||
|
||
class Buttons extends React.Component<IButtonProps, IButtonState> { | ||
public renderButtons(headerText: string, buttonVariant: ButtonProps['variant']): any { | ||
const { classes } = this.props; | ||
return ( | ||
<Grid item xs={12}> | ||
<CollapsiblePanel className={classes.panelHeader} header={headerText} autoOpen> | ||
<CardContent style={{ paddingBottom: 0 }}> | ||
<Grid container className={classes.gridContainer}> | ||
<Button variant={buttonVariant} className={classes.button}>Default</Button> | ||
<Button color='primary' className={classes.button}> | ||
Primary | ||
</Button> | ||
<Button variant={buttonVariant} color='secondary' className={classes.button}> | ||
Secondary | ||
</Button> | ||
<Button variant={buttonVariant} disabled className={classes.button}> | ||
Disabled | ||
</Button> | ||
<Button variant={buttonVariant} href='/#/dashboard' className={classes.button}> | ||
Link | ||
</Button> | ||
<input accept='image/*' className={classes.input} id='flat-button-file' multiple type='file' /> | ||
<label htmlFor='flat-button-file'> | ||
<Button variant={buttonVariant} component='span' className={classes.button}> | ||
Upload | ||
</Button> | ||
</label> | ||
</Grid> | ||
</CardContent> | ||
</CollapsiblePanel> | ||
</Grid> | ||
); | ||
} | ||
public render(): React.ReactElement<Buttons> { | ||
const { classes } = this.props; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Grid container spacing={8}> | ||
{this.renderButtons('Text Buttons', 'text')} | ||
{this.renderButtons('Outline Buttons', 'outlined')} | ||
{this.renderButtons('Contained Buttons', 'contained')} | ||
{this.renderButtons('Raised Buttons', 'raised')} | ||
{this.renderButtons('Raised Buttons', 'flat')} | ||
{this.renderButtons('Raised Buttons', 'fab')} | ||
</Grid> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default withStyles(buttonStyles)(Buttons); |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Theme } from '@material-ui/core'; | ||
|
||
interface IButtonOwnProps { | ||
classes: any; | ||
} | ||
interface IButtonStateProps { | ||
theme: Theme; | ||
} | ||
|
||
export type IButtonProps = IButtonOwnProps & IButtonStateProps; | ||
|
||
export interface IButtonState { | ||
} |
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,12 +1,19 @@ | ||
import { Theme } from '@material-ui/core'; | ||
|
||
export const homeStyles = (theme: Theme): any => ({ | ||
export const buttonStyles = (theme: Theme): any => ({ | ||
root: { | ||
flexGrow: 1, | ||
}, | ||
paper: { | ||
padding: theme.spacing.unit * 2, | ||
textAlign: 'center', | ||
color: theme.palette.text.secondary, | ||
gridContainer: { | ||
justifyContent: 'center', | ||
}, | ||
panelHeader: { | ||
backgroundColor: theme.palette.grey[200], | ||
}, | ||
button: { | ||
margin: theme.spacing.unit, | ||
}, | ||
input: { | ||
display: 'none', | ||
}, | ||
}); |
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,37 +1 @@ | ||
import * as React from 'react'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import { homeStyles } from './buttons.styles'; | ||
import { IHomeProps, IHomeState } from './buttons.interface'; | ||
import { Card, Button } from '@material-ui/core'; | ||
|
||
class Buttons extends React.Component<IHomeProps, IHomeState> { | ||
public render(): React.ReactElement<Buttons> { | ||
const { classes } = this.props; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Grid container spacing={8}> | ||
<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 item sm={12} md={6}> | ||
<Card> | ||
<div><Button variant='flat'>Flat Button</Button></div> | ||
<div><Button variant='contained' color='primary'>Contained Button</Button></div> | ||
<div><Button variant='flat' color='primary'>Contained Button</Button></div> | ||
<div><Button variant='raised'>Raised Button</Button></div> | ||
<div><Button variant='fab'>Fab Button</Button></div> | ||
</Card> | ||
</Grid> | ||
</Grid> | ||
</div > | ||
); | ||
} | ||
} | ||
|
||
export default withStyles(homeStyles)(Buttons); | ||
export { default } from './Buttons'; |
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
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
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
Oops, something went wrong.