Skip to content

Commit

Permalink
Merge pull request mui#4033 from antoinerousseau/dialog-title-style
Browse files Browse the repository at this point in the history
[Dialog] Merge title style when title it a node
  • Loading branch information
oliviertassinari committed Apr 21, 2016
2 parents be3615f + 86b5894 commit 9baaf7e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/Dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,19 @@ class DialogInline extends React.Component {
</div>
);

const titleElement = typeof title === 'string' ?
<h3 className={titleClassName} style={prepareStyles(styles.title)}>
{title}
</h3> : title;
let titleElement = title;
if (React.isValidElement(title)) {
titleElement = React.cloneElement(title, {
className: title.props.className || titleClassName,
style: prepareStyles(Object.assign(styles.title, title.props.style)),
});
} else if (typeof title === 'string') {
titleElement = (
<h3 className={titleClassName} style={prepareStyles(styles.title)}>
{title}
</h3>
);
}

return (
<div className={className} style={prepareStyles(styles.root)}>
Expand Down

0 comments on commit 9baaf7e

Please sign in to comment.