Skip to content

Commit

Permalink
Fix: Categories block: add custom classes only to wrapper (#13439)
Browse files Browse the repository at this point in the history
* add wp-block-categories as prefix

* render class names only on the block wrapper

* review changes
  • Loading branch information
Soean authored Jan 24, 2019
1 parent 0259f7b commit 9a35324
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/block-library/src/categories/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ class CategoriesEdit extends Component {
}

getCategoryListClassName( level ) {
const { className } = this.props;
return `${ className }__list ${ className }__list-level-${ level }`;
return `wp-block-categories__list wp-block-categories__list-level-${ level }`;
}

renderCategoryName( category ) {
Expand Down Expand Up @@ -89,7 +88,7 @@ class CategoriesEdit extends Component {
<li key={ category.id }>
<a href={ category.link } target="_blank">{ this.renderCategoryName( category ) }</a>
{ showPostCounts &&
<span className={ `${ this.props.className }__post-count` }>
<span className="wp-block-categories__post-count">
{ ' ' }({ category.count })
</span>
}
Expand All @@ -107,7 +106,7 @@ class CategoriesEdit extends Component {
}

renderCategoryDropdown() {
const { showHierarchy, instanceId, className } = this.props;
const { showHierarchy, instanceId } = this.props;
const parentId = showHierarchy ? 0 : null;
const categories = this.getCategories( parentId );
const selectId = `blocks-category-select-${ instanceId }`;
Expand All @@ -116,7 +115,7 @@ class CategoriesEdit extends Component {
<label htmlFor={ selectId } className="screen-reader-text">
{ __( 'Categories' ) }
</label>
<select id={ selectId } className={ `${ className }__dropdown` }>
<select id={ selectId } className="wp-block-categories__dropdown">
{ categories.map( ( category ) => this.renderCategoryDropdownItem( category, 0 ) ) }
</select>
</Fragment>
Expand Down

0 comments on commit 9a35324

Please sign in to comment.