From 5b6ad2773e184908e9f67bc8fcc6d21333455c26 Mon Sep 17 00:00:00 2001 From: scruffian Date: Tue, 5 Mar 2024 13:08:34 +0000 Subject: [PATCH 1/8] Global Styles: Try presets in Site View --- .../variations/variations-typography.js | 1 + .../index.js | 35 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) 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 ebbdb0ec015d7..45f1684cd8f85 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 @@ -18,6 +18,7 @@ import TypographyExample from '../typography-example'; import PreviewIframe from '../preview-iframe'; import { getFontFamilies } from '../utils'; import Variation from './variation'; +import PreviewIframe from '../preview-iframe'; const { GlobalStylesContext } = unlock( blockEditorPrivateApis ); 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 a064e9f587853..3e4283b87abb1 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 @@ -5,7 +5,10 @@ import { __ } from '@wordpress/i18n'; import { edit, seen } from '@wordpress/icons'; import { useSelect, useDispatch } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; -import { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components'; +import { + __experimentalNavigatorButton as NavigatorButton, + __experimentalVStack as VStack, +} from '@wordpress/components'; import { useViewportMatch } from '@wordpress/compose'; import { BlockEditorProvider } from '@wordpress/block-editor'; import { useCallback } from '@wordpress/element'; @@ -24,6 +27,8 @@ import SidebarNavigationItem from '../sidebar-navigation-item'; import StyleBook from '../style-book'; import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions'; import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer'; +import ColorVariations from '../global-styles/variations/variations-color'; +import TypographyVariations from '../global-styles/variations/variations-typography'; const noop = () => {}; @@ -80,7 +85,33 @@ function SidebarNavigationScreenGlobalStylesContent() { onChange={ noop } onInput={ noop } > - + + +
+

+ { __( 'Colors' ) } +

+ +
+
+

+ { __( 'Typography' ) } +

+ +
+
); } From a929d6f130aaf1c4925e0a414f40f2a532c25a5b Mon Sep 17 00:00:00 2001 From: scruffian Date: Thu, 7 Mar 2024 12:57:53 +0000 Subject: [PATCH 2/8] get typography working in mobile --- .../global-styles/typography-example.js | 2 -- .../variations/variations-typography.js | 22 ++++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/typography-example.js b/packages/edit-site/src/components/global-styles/typography-example.js index 45eb23aa0d6a5..dfb8920fb5ea2 100644 --- a/packages/edit-site/src/components/global-styles/typography-example.js +++ b/packages/edit-site/src/components/global-styles/typography-example.js @@ -50,8 +50,6 @@ export default function PreviewTypography( { fontSize, variation } ) { type: 'tween', } } style={ { - fontSize: '22px', - lineHeight: '44px', textAlign: 'center', } } > 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 45f1684cd8f85..3355f304b2f08 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 @@ -4,6 +4,7 @@ import { useContext } from '@wordpress/element'; import { __experimentalGrid as Grid, + __experimentalVStack as HStack, __experimentalVStack as VStack, } from '@wordpress/components'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; @@ -18,7 +19,6 @@ import TypographyExample from '../typography-example'; import PreviewIframe from '../preview-iframe'; import { getFontFamilies } from '../utils'; import Variation from './variation'; -import PreviewIframe from '../preview-iframe'; const { GlobalStylesContext } = unlock( blockEditorPrivateApis ); @@ -75,11 +75,21 @@ export default function TypographyVariations() { label={ variation?.title } isFocused={ isFocused } > - { ( { key } ) => ( - + { ( { ratio, key } ) => ( + + + ) } ) } From 6546d51c65120d7838a75fa77cb50974555fd203 Mon Sep 17 00:00:00 2001 From: scruffian Date: Thu, 7 Mar 2024 13:10:00 +0000 Subject: [PATCH 3/8] add border radius --- .../edit-site/src/components/global-styles/preview-iframe.js | 1 - packages/edit-site/src/components/global-styles/style.scss | 5 ++++- .../global-styles/variations/variations-typography.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/preview-iframe.js b/packages/edit-site/src/components/global-styles/preview-iframe.js index ea4207e35a113..e830accf6d939 100644 --- a/packages/edit-site/src/components/global-styles/preview-iframe.js +++ b/packages/edit-site/src/components/global-styles/preview-iframe.js @@ -118,7 +118,6 @@ export default function PreviewIframe( {