From d1f767ee25395910b8923d8ffb912b28243250e1 Mon Sep 17 00:00:00 2001 From: Spencer James Date: Wed, 14 Oct 2015 11:17:04 -0400 Subject: [PATCH] Make avatar prop optional for CardHeader CardHeader shouldn't be required to have an Avatar. The avatar should be blank if no prop is assigned. --- src/card/card-header.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/card/card-header.jsx b/src/card/card-header.jsx index 9d68f8220b6857..a04ef0c6fdc3a0 100644 --- a/src/card/card-header.jsx +++ b/src/card/card-header.jsx @@ -94,14 +94,15 @@ const CardHeader = React.createClass({ let titleStyle = this.prepareStyles(styles.title, this.props.titleStyle); let subtitleStyle = this.prepareStyles(styles.subtitle, this.props.subtitleStyle); - let avatar = this.props.avatar; + let avatar = this.props.avatar || null; if (React.isValidElement(this.props.avatar)) { let avatarMergedStyle = this.mergeStyles(styles.avatar, avatar.props.style); avatar = React.cloneElement(avatar, {style:avatarMergedStyle}); } - else + else if (avatar !== null) { avatar = ; - + } + return (
{avatar}