Skip to content

Commit

Permalink
Add is-small style options
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed Dec 17, 2024
1 parent 4cf587e commit 818abe5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mu-plugins/blocks/modal/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ function Edit( {
clientId,
} ) {
const [ isModalPreview, setIsModalPreview ] = useState( false );
const [ buttonStyles, setButtonStyles ] = useState( [] );
const [ buttonStyleOptions, setButtonStyleOptions ] = useState( [] );
const { customBackgroundColor, customCloseButtonColor, customTextColor, customOverlayColor } = attributes;
const colorGradientSettings = useMultipleOriginColorsAndGradients();

useSelect( ( select ) => {
const { getBlockStyles } = select( blocksStore );
setButtonStyles( getBlockStyles( 'core/button' ) );
const styles = getBlockStyles( 'core/button' );
const options = styles.map( ( item ) => ( { label: item.label, value: item.name } ) );
// Add the same options with the `is-small` modifier.
styles.forEach( ( item ) => {
options.push( { label: `${item.label} (small)`, value: `${item.name} is-small` } );

Check failure on line 52 in mu-plugins/blocks/modal/src/index.js

View workflow job for this annotation

GitHub Actions / Lint everything

Replace `item.label}·(small)`,·value:·`${item.name` with `·item.label·}·(small)`,·value:·`${·item.name·`
} );
setButtonStyleOptions( options );
}, [] );

const classes = [];
Expand Down Expand Up @@ -158,7 +164,7 @@ function Edit( {
setAttributes( { buttonStyle: newValue } );
} }
value={ attributes.buttonStyle }
options={ buttonStyles.map( ( item ) => ( { label: item.label, value: item.name } ) ) }
options={ buttonStyleOptions }
/>
</PanelBody>
</InspectorControls>
Expand Down

0 comments on commit 818abe5

Please sign in to comment.