Skip to content

Commit

Permalink
Fix Global styles panel header buttons text overlap for 'Show button …
Browse files Browse the repository at this point in the history
…text labels' (#63243)

* Use compact variant for close butotn in complementary area.

* Fix global styles header buttons when they show text.

* Improve flexbox layout.

* Adjust gap.

* Set button size to small.

* Remove no longer necessary margins.

Co-authored-by: afercia <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: aaronrobertshaw <[email protected]>
  • Loading branch information
6 people authored Oct 22, 2024
1 parent 3705cf8 commit 0711717
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 34 deletions.
66 changes: 37 additions & 29 deletions packages/edit-site/src/components/global-styles-sidebar/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { FlexItem, FlexBlock, Flex, Button } from '@wordpress/components';
import { FlexItem, Flex, Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { styles, seen, backup } from '@wordpress/icons';
import { useSelect, useDispatch } from '@wordpress/data';
Expand Down Expand Up @@ -130,38 +130,46 @@ export default function GlobalStylesSidebar() {
className="edit-site-global-styles-sidebar__header"
gap={ 1 }
>
<FlexBlock style={ { minWidth: 'min-content' } }>
<FlexItem>
<h2 className="edit-site-global-styles-sidebar__header-title">
{ __( 'Styles' ) }
</h2>
</FlexBlock>
<FlexItem>
<Button
icon={ seen }
label={ __( 'Style Book' ) }
isPressed={
isStyleBookOpened || isRevisionsStyleBookOpened
}
accessibleWhenDisabled
disabled={ shouldClearCanvasContainerView }
onClick={ toggleStyleBook }
size="compact"
/>
</FlexItem>
<FlexItem>
<Button
label={ __( 'Revisions' ) }
icon={ backup }
onClick={ toggleRevisions }
accessibleWhenDisabled
disabled={ ! hasRevisions }
isPressed={
isRevisionsOpened || isRevisionsStyleBookOpened
}
size="compact"
/>
</FlexItem>
<GlobalStylesMenuSlot />
<Flex
justify="flex-end"
gap={ 1 }
className="edit-site-global-styles-sidebar__header-actions"
>
<FlexItem>
<Button
icon={ seen }
label={ __( 'Style Book' ) }
isPressed={
isStyleBookOpened ||
isRevisionsStyleBookOpened
}
accessibleWhenDisabled
disabled={ shouldClearCanvasContainerView }
onClick={ toggleStyleBook }
size="compact"
/>
</FlexItem>
<FlexItem>
<Button
label={ __( 'Revisions' ) }
icon={ backup }
onClick={ toggleRevisions }
accessibleWhenDisabled
disabled={ ! hasRevisions }
isPressed={
isRevisionsOpened ||
isRevisionsStyleBookOpened
}
size="compact"
/>
</FlexItem>
<GlobalStylesMenuSlot />
</Flex>
</Flex>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
margin: 0;
}

.edit-site-global-styles-sidebar .edit-site-global-styles-sidebar__header-actions {
flex: 1;
}

.edit-site-global-styles-sidebar .components-navigation__menu-title-heading {
font-size: $default-font-size * 1.2;
font-weight: 500;
Expand Down Expand Up @@ -75,6 +79,8 @@
.show-icon-labels {
.edit-site-global-styles-sidebar__header {
.components-button.has-icon {
width: auto;

// Hide the button icons when labels are set to display...
svg {
display: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@

.components-button.has-icon {
display: none;
margin-left: auto;

~ .components-button {
margin-left: 0;
}

@include break-medium() {
display: flex;
Expand Down

0 comments on commit 0711717

Please sign in to comment.