Skip to content

Commit

Permalink
Merge paragraph text settings into typography panel
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Nov 9, 2021
1 parent 0a0e0ca commit 5813ec9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/block-library/src/paragraph/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import classnames from 'classnames';
import { __, _x, isRTL } from '@wordpress/i18n';
import {
ToolbarDropdownMenu,
PanelBody,
ToggleControl,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import {
AlignmentControl,
Expand Down Expand Up @@ -81,8 +81,16 @@ function ParagraphBlock( {
/>
</BlockControls>
{ isDropCapFeatureEnabled && (
<InspectorControls>
<PanelBody title={ __( 'Text settings' ) }>
<InspectorControls __experimentalGroup="typography">
<ToolsPanelItem
hasValue={ () => !! dropCap }
label={ __( 'Drop cap' ) }
onDeselect={ () =>
setAttributes( { dropCap: undefined } )
}
resetAllFilter={ () => ( { dropCap: undefined } ) }
panelId={ clientId }
>
<ToggleControl
label={ __( 'Drop cap' ) }
checked={ !! dropCap }
Expand All @@ -97,7 +105,7 @@ function ParagraphBlock( {
)
}
/>
</PanelBody>
</ToolsPanelItem>
</InspectorControls>
) }
<RichText
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/tools-panel/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export const ToolsPanelItem = css`
/* Remove BaseControl components margins and leave spacing to grid layout */
&& ${ BaseControlWrapper } {
margin-bottom: 0;
/* The following allows controls with help text to maintain spacing. */
/* e.g. ToggleControls. */
display: flex;
flex-direction: column;
row-gap: ${ space( 3 ) };
${ BaseControlField } {
margin-bottom: 0;
Expand Down

0 comments on commit 5813ec9

Please sign in to comment.