Skip to content

Commit

Permalink
Update docstrings to reflect refactor into dimensions feature
Browse files Browse the repository at this point in the history
Some docstrings still referred to the block support as just width
support, and needed to be updated after refactoring into a larger
dimensions feature.
  • Loading branch information
Staci Cooper authored and Staci Cooper committed Oct 21, 2020
1 parent bcade7c commit 6f37465
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
6 changes: 3 additions & 3 deletions lib/block-supports/dimensions.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Width block support flag.
* Dimensions block support flag.
*
* @package gutenberg
*/

/**
* Registers the style and width block attributes for block types that
* support it.
* Ensures the style attribute required by the dimensions feature is registered,
* for block types that support the feature.
*
* @param WP_Block_Type $block_type Block Type.
*/
Expand Down
34 changes: 19 additions & 15 deletions packages/block-editor/src/components/width-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
* WordPress dependencies
*/
import { Button, ButtonGroup } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Control to facilitate width selections.
*
* @param {Object} props Component props.
* @param {string} props.value Currently selected text decoration.
* @param {string} props.value Currently selected width.
* @param {Array} props.widthOptions Width options available for selection.
* @param {Function} props.onChange Handles change in width selection.
* @return {WPElement} Width control.
Expand Down Expand Up @@ -40,19 +41,22 @@ export default function WidthControl( {
};

return (
<ButtonGroup>
{ widthOptions.map( ( widthOption ) => {
return (
<Button
key={ widthOption.slug }
isSmall
isPrimary={ selectedWidth === widthOption.slug }
onClick={ () => handleChange( widthOption.slug ) }
>
{ widthOption.value }
</Button>
);
} ) }
</ButtonGroup>
<>
<p>{ __( 'Width' ) }</p>
<ButtonGroup>
{ widthOptions.map( ( widthOption ) => {
return (
<Button
key={ widthOption.slug }
isSmall
isPrimary={ selectedWidth === widthOption.slug }
onClick={ () => handleChange( widthOption.slug ) }
>
{ widthOption.value }
</Button>
);
} ) }
</ButtonGroup>
</>
);
}
4 changes: 2 additions & 2 deletions packages/block-editor/src/hooks/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import WidthControl from '../components/width-control';

/**
* Key within block settings' supports array indicating support for
* width, e.g. settings found in 'block.json'.
* dimensions including width, e.g. settings found in 'block.json'.
*/
export const DIMENSIONS_SUPPORT_KEY = '__experimentalDimensions';

Expand Down Expand Up @@ -51,7 +51,7 @@ export function DimensionsPanel( props ) {

return (
<InspectorControls>
<PanelBody title={ __( 'Width Settings' ) }>
<PanelBody title={ __( 'Dimensions' ) }>
<WidthControl
value={ selectedWidth }
widthOptions={ widthOptions }
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const withBlockControls = createHigherOrderComponent(
return [
<TypographyPanel key="typography" { ...props } />,
<ColorEdit key="colors" { ...props } />,
<DimensionsPanel key="width" { ...props } />,
<DimensionsPanel key="dimensions" { ...props } />,
<BlockEdit key="edit" { ...props } />,
hasSpacingSupport && (
<SpacingPanelControl key="spacing">
Expand Down

0 comments on commit 6f37465

Please sign in to comment.