diff --git a/packages/block-editor/src/components/global-styles/color-panel.js b/packages/block-editor/src/components/global-styles/color-panel.js index 13f61ec56a8520..9b6f9bcede9a85 100644 --- a/packages/block-editor/src/components/global-styles/color-panel.js +++ b/packages/block-editor/src/components/global-styles/color-panel.js @@ -123,10 +123,11 @@ function ColorToolsPanel( { return ( ) } - + { __( 'Fonts' ) } diff --git a/packages/edit-site/src/components/global-styles/palette.js b/packages/edit-site/src/components/global-styles/palette.js index dc73f54a1701a8..3d35397a63b0a0 100644 --- a/packages/edit-site/src/components/global-styles/palette.js +++ b/packages/edit-site/src/components/global-styles/palette.js @@ -87,7 +87,9 @@ function Palette( { name } ) { ) ) } - { paletteButtonText } + + { paletteButtonText } + diff --git a/packages/edit-site/src/components/global-styles/preview-colors.js b/packages/edit-site/src/components/global-styles/preview-colors.js index 08a372ed83cf90..2bead7ad2460b3 100644 --- a/packages/edit-site/src/components/global-styles/preview-colors.js +++ b/packages/edit-site/src/components/global-styles/preview-colors.js @@ -40,7 +40,7 @@ const StylesPreviewColors = ( { label, isFocused, withHoverView } ) => { } } > { } } > diff --git a/packages/edit-site/src/components/global-styles/screen-colors.js b/packages/edit-site/src/components/global-styles/screen-colors.js index a24fc7d34a295f..2083b5d708e09b 100644 --- a/packages/edit-site/src/components/global-styles/screen-colors.js +++ b/packages/edit-site/src/components/global-styles/screen-colors.js @@ -35,12 +35,12 @@ function ScreenColors() { -
- - +
+ + -
- - - { ! window.__experimentalDisableFontLibrary && ( - - { fontLibraryEnabled && } - - ) } +
+ + + { ! window.__experimentalDisableFontLibrary && + fontLibraryEnabled && }
diff --git a/packages/edit-site/src/components/global-styles/style-variations-container.js b/packages/edit-site/src/components/global-styles/style-variations-container.js index 69aff3e5be415a..5ce6ce25a0fb1d 100644 --- a/packages/edit-site/src/components/global-styles/style-variations-container.js +++ b/packages/edit-site/src/components/global-styles/style-variations-container.js @@ -13,7 +13,7 @@ import { __ } from '@wordpress/i18n'; import PreviewStyles from './preview-styles'; import Variation from './variations/variation'; -export default function StyleVariationsContainer() { +export default function StyleVariationsContainer( { gap = 2 } ) { const variations = useSelect( ( select ) => { return select( coreStore @@ -39,6 +39,7 @@ export default function StyleVariationsContainer() { { withEmptyVariation.map( ( variation, index ) => ( diff --git a/packages/edit-site/src/components/global-styles/style.scss b/packages/edit-site/src/components/global-styles/style.scss index 547656667f55fc..0606d558319494 100644 --- a/packages/edit-site/src/components/global-styles/style.scss +++ b/packages/edit-site/src/components/global-styles/style.scss @@ -7,9 +7,9 @@ } .edit-site-global-styles-preview__iframe { - border-radius: $radius-block-ui; - display: block; + border-radius: $radius-block-ui + 1px; // Visually resembles the $radius-block-ui. max-width: 100%; + display: block; width: 100%; } @@ -29,9 +29,8 @@ max-width: 100%; } -.edit-site-global-styles-screen-typography, -.edit-site-global-styles-screen-css { - margin: $grid-unit-20; +.edit-site-global-styles-screen { + margin: $grid-unit-15 $grid-unit-20 $grid-unit-20; } .edit-site-global-styles-screen-typography__indicator { @@ -52,14 +51,16 @@ justify-content: center; } -.edit-site-global-styles-screen-colors { - margin: $grid-unit-20; +.edit-site-global-styles-screen-colors .color-block-support-panel { + padding-left: 0; + padding-right: 0; + padding-top: 0; + border-top: none; + row-gap: calc(#{$grid-unit-05} * 3); +} - .color-block-support-panel { - padding-left: 0; - padding-right: 0; - border-top: none; - } +.edit-site-global-styles-screen-colors__palette-count { + color: $gray-700; } .edit-site-global-styles-header__description { @@ -115,6 +116,7 @@ flex: 1 1 auto; display: flex; flex-direction: column; + margin: $grid-unit-20; .components-v-stack { flex: 1 1 auto; diff --git a/packages/edit-site/src/components/global-styles/variations/style.scss b/packages/edit-site/src/components/global-styles/variations/style.scss index 6022aa7f648814..a0e18c40cc69d3 100644 --- a/packages/edit-site/src/components/global-styles/variations/style.scss +++ b/packages/edit-site/src/components/global-styles/variations/style.scss @@ -5,34 +5,49 @@ cursor: pointer; .edit-site-global-styles-variations_item-preview { - padding: $border-width * 2; border-radius: $radius-block-ui; - box-shadow: 0 0 0 $border-width $gray-200; // Shown in Windows 10 high contrast mode. outline: 1px solid transparent; + position: relative; + // Add the same transition that block style variations and other buttons have. + transition: box-shadow 0.1s linear; + @include reduce-motion("transition"); + + &::after { + content: ""; + position: absolute; + top: -$border-width; + left: -$border-width; + bottom: -$border-width; + right: -$border-width; + // Visually resembles the $radius-block-ui. + border-radius: $radius-block-ui + $border-width; + box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.2); + // Show a thin outline in Windows high contrast mode, otherwise the button is invisible. + border: $border-width solid transparent; + box-sizing: inherit; + // Add the same transition that block style variations and other buttons have. + transition: box-shadow 0.1s linear; + @include reduce-motion("transition"); + } .edit-site-global-styles-color-variations & { padding: $grid-unit-10; } } - &.is-active .edit-site-global-styles-variations_item-preview { - box-shadow: 0 0 0 $border-width $gray-900; - // Shown in Windows 10 high contrast mode. - outline-width: 3px; - } - - &:hover .edit-site-global-styles-variations_item-preview { - box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color); + &:not(.is-active):hover .edit-site-global-styles-variations_item-preview::after { + box-shadow: inset 0 0 0 $border-width rgba(0, 0, 0, 0.4); } - &:focus .edit-site-global-styles-variations_item-preview { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); - } - - &:focus-visible { + &.is-active .edit-site-global-styles-variations_item-preview, + &:focus-visible .edit-site-global-styles-variations_item-preview { + box-shadow: inset 0 0 0 $border-width $white, 0 0 0 var(--wp-admin-border-width-focus) $gray-900; // Shown in Windows 10 high contrast mode. - outline: 3px solid transparent; - outline-offset: 0; + outline-width: 3px; + + &::after { + box-shadow: inset 0 0 0 1px $white; + } } } diff --git a/packages/edit-site/src/components/global-styles/variations/variations-color.js b/packages/edit-site/src/components/global-styles/variations/variations-color.js index f3555ec8f2228a..cd90872f20da81 100644 --- a/packages/edit-site/src/components/global-styles/variations/variations-color.js +++ b/packages/edit-site/src/components/global-styles/variations/variations-color.js @@ -12,8 +12,9 @@ import { import Variation from './variation'; import StylesPreviewColors from '../preview-colors'; import { useColorVariations } from '../hooks'; +import Subtitle from '../subtitle'; -export default function ColorVariations() { +export default function ColorVariations( { title, gap = 2 } ) { const colorVariations = useColorVariations(); if ( ! colorVariations?.length ) { @@ -22,7 +23,8 @@ export default function ColorVariations() { return ( - + { title && { title } } + { colorVariations.map( ( variation, index ) => ( { () => } diff --git a/packages/edit-site/src/components/global-styles/variations/variations-typography.js b/packages/edit-site/src/components/global-styles/variations/variations-typography.js index fc7c0ac871fc12..6ee7be561e6114 100644 --- a/packages/edit-site/src/components/global-styles/variations/variations-typography.js +++ b/packages/edit-site/src/components/global-styles/variations/variations-typography.js @@ -14,8 +14,9 @@ import { useTypographyVariations } from '../hooks'; import TypographyExample from '../typography-example'; import PreviewIframe from '../preview-iframe'; import Variation from './variation'; +import Subtitle from '../subtitle'; -export default function TypographyVariations() { +export default function TypographyVariations( { title, gap = 2 } ) { const typographyVariations = useTypographyVariations(); if ( ! typographyVariations?.length ) { @@ -24,8 +25,10 @@ export default function TypographyVariations() { return ( + { title && { title } } { typographyVariations && diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js index 37d67e8fcad430..87ab8095ed8275 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js @@ -80,6 +80,7 @@ function SidebarNavigationScreenGlobalStylesContent() { const colorVariations = useColorVariations(); const typographyVariations = useTypographyVariations(); + const gap = 3; // Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are // loaded. This is necessary because the Iframe component waits until @@ -96,22 +97,15 @@ function SidebarNavigationScreenGlobalStylesContent() { spacing={ 10 } className="edit-site-global-styles-variation-container" > - + { colorVariations?.length && ( -
-

- { __( 'Colors' ) } -

- -
+ ) } { typographyVariations?.length && ( -
-

- { __( 'Typography' ) } -

- -
+ ) }
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss index ed1f682255f017..c315d77d35b595 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss +++ b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss @@ -99,18 +99,21 @@ font-weight: 500; } -.edit-site-sidebar-navigation-screen__content .edit-site-global-styles-style-variations-container { +.edit-site-sidebar-navigation-screen__content .edit-site-global-styles-variations_item { .edit-site-global-styles-variations_item-preview { box-shadow: 0 0 0 $border-width $gray-900; } - .edit-site-global-styles-variations_item.is-active .edit-site-global-styles-variations_item-preview { - box-shadow: 0 0 0 $border-width $gray-100; - } - .edit-site-global-styles-variations_item:hover .edit-site-global-styles-variations_item-preview { - box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color); - } - .edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview { - box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); + + &:focus .edit-site-global-styles-variations_item-preview, + &.is-active .edit-site-global-styles-variations_item-preview { + box-shadow: inset 0 0 0 $border-width $gray-900, 0 0 0 var(--wp-admin-border-width-focus) $white; + + // Shown in Windows 10 high contrast mode. + outline-width: 3px; + + &::after { + box-shadow: inset 0 0 0 1px $gray-900; + } } }