UNPKG

@gechiui/block-editor

Version:
36 lines (28 loc) 857 B
/** * GeChiUI dependencies */ import { createSlotFill, ToolbarButton } from '@gechiui/components'; import { __ } from '@gechiui/i18n'; import { withDispatch } from '@gechiui/data'; import { cog } from '@gechiui/icons'; const { Fill, Slot } = createSlotFill( 'SettingsToolbarButton' ); const SettingsButton = ( { openGeneralSidebar } ) => ( <ToolbarButton title={ __( 'Open Settings' ) } icon={ cog } onClick={ openGeneralSidebar } /> ); const SettingsButtonFill = ( props ) => ( <Fill> <SettingsButton { ...props } /> </Fill> ); const SettingsToolbarButton = withDispatch( ( dispatch ) => { const { openGeneralSidebar } = dispatch( 'core/edit-post' ); return { openGeneralSidebar: () => openGeneralSidebar( 'edit-post/block' ), }; } )( SettingsButtonFill ); SettingsToolbarButton.Slot = Slot; export default SettingsToolbarButton;