Skip to content

Commit

Permalink
Move getResponsiveHelp function in EmbedControls
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhun committed Jul 23, 2021
1 parent 5359651 commit 3e77c78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 29 deletions.
11 changes: 0 additions & 11 deletions packages/block-library/src/embed/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ import { useBlockProps } from '@wordpress/block-editor';
import { store as coreStore } from '@wordpress/core-data';
import { View } from '@wordpress/primitives';

function getResponsiveHelp( checked ) {
return checked
? __(
'This embed will preserve its aspect ratio when the browser is resized.'
)
: __(
'This embed may not preserve its aspect ratio when the browser is resized.'
);
}

const EmbedEdit = ( props ) => {
const {
attributes: {
Expand Down Expand Up @@ -242,7 +232,6 @@ const EmbedEdit = ( props ) => {
themeSupportsResponsive={ themeSupportsResponsive }
blockSupportsResponsive={ responsive }
allowResponsive={ allowResponsive }
getResponsiveHelp={ getResponsiveHelp }
toggleResponsive={ toggleResponsive }
switchBackToURLInput={ () => setIsEditingURL( true ) }
/>
Expand Down
13 changes: 1 addition & 12 deletions packages/block-library/src/embed/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import EmbedBottomSheet from './embed-bottom-sheet';
/**
* WordPress dependencies
*/
import { __, _x } from '@wordpress/i18n';
import { _x } from '@wordpress/i18n';
import { useState, useEffect } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import {
Expand All @@ -26,16 +26,6 @@ import {
import { store as coreStore } from '@wordpress/core-data';
import { View } from '@wordpress/primitives';

function getResponsiveHelp( checked ) {
return checked
? __(
'This embed will preserve its aspect ratio when the browser is resized.'
)
: __(
'This embed may not preserve its aspect ratio when the browser is resized.'
);
}

const EmbedEdit = ( props ) => {
const {
attributes: { providerNameSlug, responsive, url: attributesUrl },
Expand Down Expand Up @@ -224,7 +214,6 @@ const EmbedEdit = ( props ) => {
themeSupportsResponsive={ themeSupportsResponsive }
blockSupportsResponsive={ responsive }
allowResponsive={ allowResponsive }
getResponsiveHelp={ getResponsiveHelp }
toggleResponsive={ toggleResponsive }
switchBackToURLInput={ () => setIsEditingURL( true ) }
/>
Expand Down
17 changes: 11 additions & 6 deletions packages/block-library/src/embed/embed-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ import {
import { BlockControls, InspectorControls } from '@wordpress/block-editor';
import { edit } from '@wordpress/icons';

function getResponsiveHelp( checked ) {
return checked
? __(
'This embed will preserve its aspect ratio when the browser is resized.'
)
: __(
'This embed may not preserve its aspect ratio when the browser is resized.'
);
}

const EmbedControls = ( {
blockSupportsResponsive,
showEditButton,
themeSupportsResponsive,
allowResponsive,
getResponsiveHelp,
toggleResponsive,
switchBackToURLInput,
} ) => (
Expand All @@ -25,7 +34,6 @@ const EmbedControls = ( {
<ToolbarGroup>
{ showEditButton && (
<ToolbarButton
className="components-toolbar__control"
label={ __( 'Edit URL' ) }
icon={ edit }
onClick={ switchBackToURLInput }
Expand All @@ -35,10 +43,7 @@ const EmbedControls = ( {
</BlockControls>
{ themeSupportsResponsive && blockSupportsResponsive && (
<InspectorControls>
<PanelBody
title={ __( 'Media settings' ) }
className="blocks-responsive"
>
<PanelBody title={ __( 'Media settings' ) }>
<ToggleControl
label={ __( 'Resize for smaller devices' ) }
checked={ allowResponsive }
Expand Down

0 comments on commit 3e77c78

Please sign in to comment.