Skip to content

Commit

Permalink
Add page component
Browse files Browse the repository at this point in the history
  • Loading branch information
bearcanrun committed Dec 5, 2018
1 parent 0000bd5 commit 149a3c4
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 7 deletions.
90 changes: 84 additions & 6 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"react-apollo": "^2.3.1",
"react-dom": "^16.6.1",
"react-dropzone": "^5.1.0",
"react-image-cropper": "^1.3.0"
"react-helmet": "^5.2.0",
"react-image-cropper": "^1.3.0",
"react-router": "^4.3.1"
},
"devDependencies": {
"@babel/cli": "^7.1.5",
Expand Down
45 changes: 45 additions & 0 deletions src/page/index.js
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)
11 changes: 11 additions & 0 deletions src/page/stories/page.stories.js
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')} />)

0 comments on commit 149a3c4

Please sign in to comment.