-
Notifications
You must be signed in to change notification settings - Fork 0
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
0000bd5
commit 149a3c4
Showing
4 changed files
with
143 additions
and
7 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,45 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import Typography from '@material-ui/core/Typography' | ||
import { withStyles } from '@material-ui/core/styles' | ||
|
||
import Card from '@material-ui/core/Card' | ||
import CardContent from '@material-ui/core/CardContent' | ||
|
||
const styles = theme => ({ | ||
card: { | ||
display: 'flex', | ||
width: '100%', | ||
margin: '1.5em', | ||
padding: '3em' | ||
}, | ||
cardDetails: { | ||
display: 'flex', | ||
flex: 1 | ||
}, | ||
cardContent: { | ||
flex: 1 | ||
} | ||
}) | ||
|
||
export const MessageCard = ({ classes, message, children }) => ( | ||
<Card className={classes.card}> | ||
<div className={classes.cardDetails}> | ||
<CardContent className={classes.cardContent}> | ||
<Typography variant='h5' align='center' gutterBottom> | ||
{message} | ||
</Typography> | ||
{children} | ||
</CardContent> | ||
</div> | ||
</Card> | ||
) | ||
|
||
MessageCard.propTypes = { | ||
children: PropTypes.node, | ||
classes: PropTypes.object.isRequired, | ||
message: PropTypes.string | ||
} | ||
|
||
export default withStyles(styles)(MessageCard) |
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,11 @@ | ||
/* eslint react/prop-types: 0 */ | ||
import React from 'react' | ||
|
||
import { storiesOf } from '@storybook/react' | ||
import { withKnobs, text } from '@storybook/addon-knobs' | ||
|
||
import MessageCard from '../index' | ||
|
||
storiesOf('MessageCard', module) | ||
.addDecorator(withKnobs) | ||
.add('with text', () => <MessageCard message={text('Message', 'This is a message')} />) |