Skip to content

Commit

Permalink
Merge pull request mui#2104 from manuelmazzuola/issue#2104
Browse files Browse the repository at this point in the history
[Snackbar] add bodyStyle property
  • Loading branch information
oliviertassinari committed Nov 10, 2015
2 parents 615c4eb + 369021d commit 4769528
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions docs/src/app/components/pages/components/snackbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ export default class SnackbarPage extends React.Component {
header: 'optional',
desc: 'Override the inline-styles of the Snackbar\'s root element.',
},
{
name: 'bodyStyle',
type: 'object',
header: 'optional',
desc: 'Override the inline-styles of the Snackbar\'s body element.',
},
],
},
{
Expand Down
6 changes: 5 additions & 1 deletion src/snackbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const Snackbar = React.createClass({
onDismiss: React.PropTypes.func,
openOnMount: React.PropTypes.bool,
style: React.PropTypes.object,
bodyStyle: React.PropTypes.object,
},

//for passing default theme context to children
Expand Down Expand Up @@ -215,6 +216,7 @@ const Snackbar = React.createClass({
const {
onActionTouchTap,
style,
bodyStyle,
...others,
} = this.props;
const styles = this.getStyles();
Expand All @@ -239,11 +241,13 @@ const Snackbar = React.createClass({
);
}

const mergedBodyStyle = this.mergeStyles(styles.body, bodyStyle);

const contentStyle = open ? this.mergeStyles(styles.content, styles.contentWhenOpen) : styles.content;

return (
<div {...others} style={rootStyles}>
<div style={styles.body}>
<div style={mergedBodyStyle}>
<div style={contentStyle}>
<span>{message}</span>
{actionButton}
Expand Down

0 comments on commit 4769528

Please sign in to comment.