Skip to content

Commit

Permalink
Theme Sheet: Hide Features Card if no features are found
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Dec 9, 2016
1 parent 738baab commit 8cbee7e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client/my-sites/theme/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import React from 'react';
import { connect } from 'react-redux';
import i18n from 'i18n-calypso';
import titlecase from 'to-title-case';
import { isArray } from 'lodash';

/**
* Internal dependencies
Expand Down Expand Up @@ -320,8 +321,11 @@ const ThemeSheet = React.createClass( {

renderFeaturesCard() {
const { isJetpack, siteSlug, taxonomies } = this.props;
const themeFeatures = taxonomies && taxonomies.theme_feature instanceof Array
? taxonomies.theme_feature.map( function( item ) {
if ( ! taxonomies || ! isArray( taxonomies.theme_feature ) ) {
return null;
}

const themeFeatures = taxonomies.theme_feature.map( function( item ) {
const term = isValidTerm( item.slug ) ? item.slug : `feature:${ item.slug }`;
return (
<li key={ 'theme-features-item-' + item.slug }>
Expand All @@ -331,7 +335,7 @@ const ThemeSheet = React.createClass( {
}
</li>
);
} ) : [];
} );

return (
<div>
Expand Down

0 comments on commit 8cbee7e

Please sign in to comment.