Skip to content

Commit

Permalink
Eventbrite Block: refactor Edit component to function (#36739)
Browse files Browse the repository at this point in the history
* Eventbrite Block: refactor Edit component to function

* Add missing export
  • Loading branch information
monsieur-z authored Apr 5, 2024
1 parent 4473145 commit 1475c2a
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 244 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Eventbrite Block: refactor Edit component to function
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, _x } from '@wordpress/i18n';
import BlockStylesSelector from '../../shared/components/block-styles-selector';
import EventbriteInPageExample from './eventbrite-in-page-example.png';

const embedTypes = [
{
value: 'inline',
label: __( 'In-page Embed', 'jetpack' ),
preview: (
<div className="block-editor-block-preview__container">
<img
src={ EventbriteInPageExample }
alt={ __( 'In page Eventbrite checkout example', 'jetpack' ) }
/>
</div>
),
},
{
value: 'modal',
label: __( 'Button & Modal', 'jetpack' ),
},
];

export const ToolbarControls = ( { setEditingUrl } ) => (
<ToolbarGroup>
Expand All @@ -11,3 +32,19 @@ export const ToolbarControls = ( { setEditingUrl } ) => (
/>
</ToolbarGroup>
);

export const InspectorControls = ( { attributes, clientId, setAttributes } ) => (
<BlockStylesSelector
title={ _x(
'Embed Type',
'option for how the embed displays on a page, e.g. inline or as a modal',
'jetpack'
) }
clientId={ clientId }
styleOptions={ embedTypes }
onSelectStyle={ setAttributes }
activeStyle={ attributes.style }
attributes={ attributes }
viewportWidth={ 130 }
/>
);
Loading

0 comments on commit 1475c2a

Please sign in to comment.