Skip to content

Commit

Permalink
Merge pull request #2397 from subjectix/card-header-optional-avatar
Browse files Browse the repository at this point in the history
[CardHeader] Make avatar prop optional
  • Loading branch information
oliviertassinari committed Dec 6, 2015
2 parents 0749065 + ee0d16c commit 28a309f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions docs/src/app/components/pages/components/cards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,8 @@ export default class CardPage extends React.Component {
<br />
<Card initiallyExpanded={true}>
<CardHeader
title="Title"
title="Without Avatar"
subtitle="Subtitle"
avatar={<Avatar style={{color:'red'}}>A</Avatar>}
actAsExpander={true}
showExpandableButton={true} />
<CardText expandable={true}>
Expand Down
4 changes: 3 additions & 1 deletion src/card/card-header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const CardHeader = React.createClass({
return {
titleColor: Styles.Colors.darkBlack,
subtitleColor: Styles.Colors.lightBlack,
avatar: null,
};
},

Expand Down Expand Up @@ -103,8 +104,9 @@ const CardHeader = React.createClass({
let avatarMergedStyle = this.mergeStyles(styles.avatar, avatar.props.style);
avatar = React.cloneElement(avatar, {style:avatarMergedStyle});
}
else
else if (avatar !== null) {
avatar = <Avatar src={this.props.avatar} style={styles.avatar}/>;
}

return (
<div {...this.props} style={rootStyle}>
Expand Down

0 comments on commit 28a309f

Please sign in to comment.