diff --git a/extensions/blocks/calendly/blockStylesPreviewAndSelector.js b/extensions/blocks/calendly/blockStylesPreviewAndSelector.js
deleted file mode 100644
index 5248c13e0d090..0000000000000
--- a/extensions/blocks/calendly/blockStylesPreviewAndSelector.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * External Dependencies
- */
-import classnames from 'classnames';
-
-/**
- * WordPress dependencies
- */
-import { getBlockType, cloneBlock, getBlockFromExample } from '@wordpress/blocks';
-import { BlockPreview } from '@wordpress/block-editor';
-import { useSelect } from '@wordpress/data';
-import { ENTER, SPACE } from '@wordpress/keycodes';
-
-export default function BlockStylesPreviewAndSelector( {
- attributes,
- clientId,
- styleOptions,
- onSelectStyle,
- activeStyle,
-} ) {
- const block = useSelect( select => {
- const { getBlock } = select( 'core/block-editor' );
- return getBlock( clientId );
- } );
-
- const type = getBlockType( block.name );
-
- return (
-
- { styleOptions.map( styleOption => {
- return (
-
{
- onSelectStyle( { style: styleOption.name } );
- } }
- onKeyDown={ event => {
- if ( ENTER === event.keyCode || SPACE === event.keyCode ) {
- event.preventDefault();
- onSelectStyle( { style: styleOption.name } );
- }
- } }
- role="button"
- tabIndex="0"
- aria-label={ styleOption.label }
- >
-
-
-
-
{ styleOption.label }
-
- );
- } ) }
-
- );
-}
diff --git a/extensions/blocks/calendly/edit.js b/extensions/blocks/calendly/edit.js
index 67ce1eb33db4b..0846673c11f8c 100644
--- a/extensions/blocks/calendly/edit.js
+++ b/extensions/blocks/calendly/edit.js
@@ -30,7 +30,7 @@ import attributeDetails from './attributes';
import { getValidatedAttributes } from '../../shared/get-validated-attributes';
import SubmitButton from '../../shared/submit-button';
import { getAttributesFromEmbedCode } from './utils';
-import BlockStylesPreviewAndSelector from './blockStylesPreviewAndSelector';
+import BlockStylesSelector from '../../shared/components/block-styles-selector';
export default function CalendlyEdit( { attributes, className, clientId, setAttributes } ) {
const validatedAttributes = getValidatedAttributes( attributeDetails, attributes );
@@ -179,8 +179,8 @@ export default function CalendlyEdit( { attributes, className, clientId, setAttr
};
const styleOptions = [
- { name: 'inline', label: __( 'Inline', 'jetpack' ) },
- { name: 'link', label: __( 'Link', 'jetpack' ) },
+ { value: 'inline', label: __( 'Inline', 'jetpack' ) },
+ { value: 'link', label: __( 'Link', 'jetpack' ) },
];
const blockControls = (
@@ -192,8 +192,8 @@ export default function CalendlyEdit( { attributes, className, clientId, setAttr
label={ __( 'Style', 'jetpack' ) }
controls={ styleOptions.map( styleOption => ( {
title: styleOption.label,
- isActive: styleOption.name === style,
- onClick: () => setAttributes( { style: styleOption.name } ),
+ isActive: styleOption.value === style,
+ onClick: () => setAttributes( { style: styleOption.value } ),
} ) ) }
popoverProps={ { className: 'is-calendly' } }
/>
@@ -204,15 +204,18 @@ export default function CalendlyEdit( { attributes, className, clientId, setAttr
const inspectorControls = (
{ url && (
-
-
-
+ <>
+
+
+
+ >
) }