Skip to content

Commit

Permalink
Menu granular subcomponents: Refactor global styles sidebar wrapper p…
Browse files Browse the repository at this point in the history
…review menu (#67644)

* Refactor global styles sidebar wrapper preview menu

* Update packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js

Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>

---------

Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
  • Loading branch information
ciampo and tyxla committed Dec 12, 2024
1 parent 08abefc commit e79e041
Showing 1 changed file with 35 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,42 @@ const GlobalStylesPageActions = ( {
setIsStyleBookOpened,
} ) => {
return (
<Menu
trigger={
<Button __next40pxDefaultSize variant="tertiary" size="compact">
{ __( 'Preview' ) }
</Button>
}
>
<Menu.RadioItem
value
checked={ isStyleBookOpened }
name="styles-preview-actions"
onChange={ () => setIsStyleBookOpened( true ) }
defaultChecked
>
<Menu.ItemLabel>{ __( 'Style book' ) }</Menu.ItemLabel>
<Menu.ItemHelpText>
{ __( 'Preview blocks and styles.' ) }
</Menu.ItemHelpText>
</Menu.RadioItem>
<Menu.RadioItem
value={ false }
checked={ ! isStyleBookOpened }
name="styles-preview-actions"
onChange={ () => setIsStyleBookOpened( false ) }
<Menu>
<Menu.TriggerButton
render={
<Button
variant="tertiary"
size="compact"
/>
}
>
<Menu.ItemLabel>{ __( 'Site' ) }</Menu.ItemLabel>
<Menu.ItemHelpText>
{ __( 'Preview your site.' ) }
</Menu.ItemHelpText>
</Menu.RadioItem>
{ __( 'Preview' ) }
</Menu.TriggerButton>
<Menu.Popover>
<Menu.RadioItem
value
checked={ isStyleBookOpened }
name="styles-preview-actions"
onChange={ () => setIsStyleBookOpened( true ) }
defaultChecked
>
<Menu.ItemLabel>{ __( 'Style book' ) }</Menu.ItemLabel>
<Menu.ItemHelpText>
{ __( 'Preview blocks and styles.' ) }
</Menu.ItemHelpText>
</Menu.RadioItem>
<Menu.RadioItem
value={ false }
checked={ ! isStyleBookOpened }
name="styles-preview-actions"
onChange={ () => setIsStyleBookOpened( false ) }
>
<Menu.ItemLabel>{ __( 'Site' ) }</Menu.ItemLabel>
<Menu.ItemHelpText>
{ __( 'Preview your site.' ) }
</Menu.ItemHelpText>
</Menu.RadioItem>
</Menu.Popover>
</Menu>
);
};
Expand Down

0 comments on commit e79e041

Please sign in to comment.