Skip to content

Commit

Permalink
Filtering for settings before showing titles.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd authored and scruffian committed Mar 15, 2024
1 parent c9b7390 commit cdf5af9
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ function SidebarNavigationScreenGlobalStylesContent() {

const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( {
property: 'color',
filter: ( variation ) => !! variation?.settings?.color,
} );

const typographyVariations =
useCurrentMergeThemeStyleVariationsWithUserConfig( {
property: 'typography',
filter: ( variation ) =>
!! variation?.settings?.typography?.fontFamilies,
} );

// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
Expand All @@ -100,15 +103,15 @@ function SidebarNavigationScreenGlobalStylesContent() {
className="edit-site-global-styles-variation-container"
>
<StyleVariationsContainer />
{ colorVariations && (
{ colorVariations?.length && (
<div>
<h3 className="edit-site-global-styles-variation-title">
{ __( 'Colors' ) }
</h3>
<ColorVariations />
</div>
) }
{ typographyVariations && (
{ typographyVariations?.length && (
<div>
<h3 className="edit-site-global-styles-variation-title">
{ __( 'Typography' ) }
Expand Down

0 comments on commit cdf5af9

Please sign in to comment.