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 c843297a67398..00fb623f5475e 100644
--- a/packages/edit-site/src/components/global-styles/screen-colors.js
+++ b/packages/edit-site/src/components/global-styles/screen-colors.js
@@ -12,7 +12,6 @@ import ScreenHeader from './header';
import Palette from './palette';
import { unlock } from '../../lock-unlock';
import ColorVariations from './variations/variations-color';
-import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
const {
useGlobalStyle,
@@ -31,12 +30,6 @@ function ScreenColors() {
const [ rawSettings ] = useGlobalSetting( '' );
const settings = useSettingsForBlockElement( rawSettings );
- const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
- property: 'color',
- filter: ( variation ) =>
- variation?.settings?.color &&
- Object.keys( variation?.settings?.color ).length,
- } );
return (
<>
- { !! colorVariations?.length && (
-
- ) }
-
+
-
- variation?.settings?.typography?.fontFamilies &&
- Object.keys( variation?.settings?.typography?.fontFamilies )
- .length,
- } );
return (
<>
@@ -40,9 +31,7 @@ function ScreenTypography() {
/>
- { !! typographyVariations?.length && (
-
- ) }
+
{ ! window.__experimentalDisableFontLibrary && (
{ fontLibraryEnabled && }
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 b12236fd26e5c..dae63441fb23c 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
@@ -13,13 +13,25 @@ import { __ } from '@wordpress/i18n';
import Subtitle from '../subtitle';
import Variation from './variation';
import StylesPreviewColors from '../preview-colors';
+import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
+
+export default function ColorVariations() {
+ const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
+ property: 'color',
+ filter: ( variation ) =>
+ variation?.settings?.color &&
+ Object.keys( variation?.settings?.color ).length,
+ } );
+
+ if ( ! colorVariations.length ) {
+ return null;
+ }
-export default function ColorVariations( { variations } ) {
return (
{ __( 'Presets' ) }
- { variations.map( ( variation, index ) => (
+ { 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 f6c9c1bec7ac8..786713d743dd3 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
@@ -35,6 +35,10 @@ export default function TypographyVariations() {
const { base } = useContext( GlobalStylesContext );
+ if ( ! typographyVariations.length ) {
+ return null;
+ }
+
/*
* Filter duplicate variations based on the font families used in the variation.
*/