Skip to content

Commit

Permalink
Switch to less hacky version of getting the default class name
Browse files Browse the repository at this point in the history
  • Loading branch information
Glen Davies committed Feb 19, 2020
1 parent 026095b commit fa55f5e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions extensions/blocks/google-calendar/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '@wordpress/components';
import { BlockIcon, InspectorControls } from '@wordpress/block-editor';
import { withViewportMatch } from '@wordpress/viewport';
import { getBlockDefaultClassName } from '@wordpress/blocks';

/**
* Internal dependencies
Expand Down Expand Up @@ -108,8 +109,8 @@ class GoogleCalendarEdit extends Component {
* @returns {object} The UI displayed when user edits this block.
*/
render() {
const { attributes, className } = this.props;
const primaryClass = className ? className.split( ' ', 1 )[ 0 ] : '';
const { attributes, className, name } = this.props;
const defaultClassName = getBlockDefaultClassName( name );
const { url } = attributes;
const { editedEmbed, interactive, editingUrl } = this.state;

Expand All @@ -127,7 +128,7 @@ class GoogleCalendarEdit extends Component {
<>
<InspectorControls>
<PanelBody title={ __( 'Calendar Settings', 'jetpack' ) } initialOpen={ false }>
{ this.getEditForm( `${ primaryClass }-embed-form-sidebar`, editedEmbed ) }
{ this.getEditForm( `${ defaultClassName }-embed-form-sidebar`, editedEmbed ) }
</PanelBody>
</InspectorControls>
</>
Expand All @@ -154,7 +155,7 @@ class GoogleCalendarEdit extends Component {
)
}
>
<ol className={ `${ primaryClass }-placeholder-instructions` }>
<ol className={ `${ defaultClassName }-placeholder-instructions` }>
<li>{ permissionsLink }</li>
<li>
{ __(
Expand All @@ -163,8 +164,8 @@ class GoogleCalendarEdit extends Component {
) }
</li>
</ol>
{ this.getEditForm( `${ primaryClass }-embed-form-editor`, editedEmbed ) }
<div className={ `${ primaryClass }-placeholder-links` }>
{ this.getEditForm( `${ defaultClassName }-embed-form-editor`, editedEmbed ) }
<div className={ `${ defaultClassName }-placeholder-links` }>
<ExternalLink href={ supportLink }>{ __( 'Learn more', 'jetpack' ) }</ExternalLink>
</div>
</Placeholder>
Expand Down

0 comments on commit fa55f5e

Please sign in to comment.