-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
navigation-menu: rebase -> customization - first approach
- Loading branch information
Showing
3 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
packages/block-library/src/navigation-menu/block-colors-selector.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,69 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { PanelColorSettings } from '@wordpress/block-editor'; | ||
import { IconButton, Dropdown, Toolbar, PanelBody } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { DOWN } from '@wordpress/keycodes'; | ||
// import ColorPalette from '@wordpress/block-editor'; | ||
|
||
const BlockColorsStyleSelector = () => { | ||
const ColorSelectorIcon = () => | ||
<div className="block-editor-block-colors-selector__icon-container"> | ||
<div className="colors-selector__state-selection"> | ||
{ __( 'Aa' ) } | ||
</div> | ||
</div>; | ||
|
||
return ( | ||
<Dropdown | ||
position="bottom right" | ||
className="editor-block-colors-selector block-editor-block-colors-selector" | ||
contentClassName="editor-block-colors-selector__popover block-editor-block-colors-selector__popover" | ||
renderToggle={ ( { onToggle, isOpen } ) => { | ||
const openOnArrowDown = ( event ) => { | ||
if ( ! isOpen && event.keyCode === DOWN ) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
onToggle(); | ||
} | ||
}; | ||
|
||
return ( | ||
<Toolbar> | ||
<IconButton | ||
className="components-icon-button components-toolbar__control block-editor-block-colors-selector__toggle" | ||
label={ __( 'Open colors selector' ) } | ||
onClick={ onToggle } | ||
onKeyDown={ openOnArrowDown } | ||
icon={ <ColorSelectorIcon/> } | ||
/> | ||
</Toolbar> | ||
); | ||
} } | ||
renderContent={ ( { onClose } ) => ( | ||
<> | ||
<PanelColorSettings | ||
title={ __( 'Color Settings' ) } | ||
initialOpen={ true } | ||
colorSettings={ [ | ||
{ | ||
value: '#aaa', | ||
onChange: console.log, | ||
label: __( 'Background Color' ), | ||
}, | ||
{ | ||
value: '#bbb', | ||
onChange: console.log, | ||
label: __( 'Text Color' ), | ||
}, | ||
] } | ||
> | ||
</PanelColorSettings> | ||
</> | ||
) } | ||
/> | ||
); | ||
}; | ||
|
||
export default BlockColorsStyleSelector; |
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