diff --git a/packages/edit-site/src/components/global-styles/font-families.js b/packages/edit-site/src/components/global-styles/font-families.js index 6a554b136317dd..cbb6b7828c72ee 100644 --- a/packages/edit-site/src/components/global-styles/font-families.js +++ b/packages/edit-site/src/components/global-styles/font-families.js @@ -1,9 +1,8 @@ /** * WordPress dependencies */ -import { __, _x } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { - __experimentalText as Text, __experimentalItemGroup as ItemGroup, __experimentalVStack as VStack, Button, @@ -26,14 +25,8 @@ import { unlock } from '../../lock-unlock'; const { useGlobalSetting } = unlock( blockEditorPrivateApis ); function FontFamilies() { - const { baseCustomFonts, modalTabOpen, setModalTabOpen } = - useContext( FontLibraryContext ); + const { modalTabOpen, setModalTabOpen } = useContext( FontLibraryContext ); const [ fontFamilies ] = useGlobalSetting( 'typography.fontFamilies' ); - const [ baseFontFamilies ] = useGlobalSetting( - 'typography.fontFamilies', - undefined, - 'base' - ); const themeFonts = fontFamilies?.theme ? fontFamilies.theme .map( ( f ) => setUIValuesNeeded( f, { source: 'theme' } ) ) @@ -46,11 +39,6 @@ function FontFamilies() { : []; const hasFonts = 0 < customFonts.length || 0 < themeFonts.length; - const hasInstalledFonts = - hasFonts || - baseFontFamilies?.theme?.length > 0 || - baseCustomFonts?.length > 0; - return ( <> { !! modalTabOpen && ( @@ -60,69 +48,48 @@ function FontFamilies() { /> ) } - - { themeFonts.length > 0 && ( - - - { - /* translators: Heading for a list of fonts provided by the theme. */ - _x( 'Theme', 'font source' ) - } - - - { themeFonts.map( ( font ) => ( + + { __( 'Fonts' ) } + { hasFonts ? ( + <> + + { customFonts.map( ( font ) => ( ) ) } - - - ) } - { customFonts.length > 0 && ( - - - { - /* translators: Heading for a list of fonts installed by the user. */ - _x( 'Custom', 'font source' ) - } - - - { customFonts.map( ( font ) => ( + { themeFonts.map( ( font ) => ( ) ) } - - ) } - { ! hasFonts && ( - - { __( 'Fonts' ) } - - { hasInstalledFonts - ? __( 'No fonts activated.' ) - : __( 'No fonts installed.' ) } - - + + + ) : ( + <> + { __( 'No fonts installed.' ) } + + ) } - ); diff --git a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js index 8cb023fff08e96..d6f066dce5a364 100644 --- a/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js +++ b/packages/edit-site/src/components/global-styles/font-library-modal/installed-fonts.js @@ -21,7 +21,7 @@ import { import { useEntityRecord, store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; import { useContext, useEffect, useState } from '@wordpress/element'; -import { __, _x, sprintf, isRTL } from '@wordpress/i18n'; +import { __, sprintf, isRTL } from '@wordpress/i18n'; import { chevronLeft, chevronRight } from '@wordpress/icons'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; @@ -224,7 +224,6 @@ function InstalledFonts() { } }; - const hasFonts = baseThemeFonts.length > 0 || baseCustomFonts.length > 0; return (
{ isResolvingLibrary && ( @@ -250,18 +249,10 @@ function InstalledFonts() { { notice.message } ) } - { ! hasFonts && ( - - { __( 'No fonts installed.' ) } - - ) } - { baseThemeFonts.length > 0 && ( + { baseCustomFonts.length > 0 && (

- { - /* translators: Heading for a list of fonts provided by the theme. */ - _x( 'Theme', 'font source' ) - } + { __( 'Installed Fonts' ) }

{ /* * Disable reason: The `list` ARIA role is redundant but @@ -272,7 +263,7 @@ function InstalledFonts() { role="list" className="font-library-modal__fonts-list" > - { baseThemeFonts.map( ( font ) => ( + { baseCustomFonts.map( ( font ) => (
  • ) } - { baseCustomFonts.length > 0 && ( + { baseThemeFonts.length > 0 && (

    - { - /* translators: Heading for a list of fonts installed by the user. */ - _x( 'Custom', 'font source' ) - } + { __( 'Theme Fonts' ) }

    { /* * Disable reason: The `list` ARIA role is redundant but @@ -313,7 +301,7 @@ function InstalledFonts() { role="list" className="font-library-modal__fonts-list" > - { baseCustomFonts.map( ( font ) => ( + { baseThemeFonts.map( ( font ) => (