-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add select icon for Navigation Block's menu button (#43674)
* Add select option to choose an icon for navigation button * Fix unit test and linting
- Loading branch information
1 parent
5b48607
commit cee488e
Showing
9 changed files
with
118 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
packages/block-library/src/navigation/edit/overlay-menu-preview.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { | ||
ToggleControl, | ||
__experimentalToggleGroupControl as ToggleGroupControl, | ||
__experimentalToggleGroupControlOption as ToggleGroupControlOption, | ||
} from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import OverlayMenuIcon from './overlay-menu-icon'; | ||
|
||
export default function OverlayMenuPreview( { setAttributes, hasIcon, icon } ) { | ||
return ( | ||
<> | ||
<ToggleControl | ||
label={ __( 'Show icon button' ) } | ||
help={ __( | ||
'Configure the visual appearance of the button opening the overlay menu.' | ||
) } | ||
onChange={ ( value ) => setAttributes( { hasIcon: value } ) } | ||
checked={ hasIcon } | ||
/> | ||
|
||
<ToggleGroupControl | ||
label={ __( 'Icon' ) } | ||
value={ icon } | ||
help={ __( 'Choose an icon or add your own.' ) } | ||
onChange={ ( value ) => setAttributes( { icon: value } ) } | ||
> | ||
<ToggleGroupControlOption | ||
value="handle" | ||
aria-label={ __( 'handle' ) } | ||
label={ <OverlayMenuIcon icon="handle" /> } | ||
className="wp-block-navigation__icon-button" | ||
/> | ||
<ToggleGroupControlOption | ||
value="menu" | ||
aria-label={ __( 'menu' ) } | ||
label={ <OverlayMenuIcon icon="menu" /> } | ||
className="wp-block-navigation__icon-button" | ||
/> | ||
<ToggleGroupControlOption | ||
value="more-vertical" | ||
aria-label={ __( 'more vertical' ) } | ||
label={ <OverlayMenuIcon icon="more-vertical" /> } | ||
className="wp-block-navigation__icon-button" | ||
/> | ||
<ToggleGroupControlOption | ||
value="more-horizontal" | ||
aria-label={ __( 'more horizontal' ) } | ||
label={ <OverlayMenuIcon icon="more-horizontal" /> } | ||
className="wp-block-navigation__icon-button" | ||
/> | ||
</ToggleGroupControl> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters