Skip to content

Commit

Permalink
[Dialog] merge title style when it's a node, fixes mui#3373
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinerousseau committed Apr 20, 2016
1 parent f34ddf0 commit 86b5894
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 86b5894

Please sign in to comment.