Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CardHeader] Make avatar prop optional #2397

Merged
merged 1 commit into from Dec 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/src/app/components/pages/components/cards.jsx
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
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