From abb39072983bf78942d499887ed1f8f530608cc0 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:14:05 +0900 Subject: [PATCH] Font Library: Group fonts by source (#63211) * Font Library Sidebar: Group fonts by source * Render text as paragraph * Change "User" to "Custom" Co-authored-by: t-hamano Co-authored-by: afercia Co-authored-by: matiasbenedetto Co-authored-by: jasmussen Co-authored-by: getdave Co-authored-by: colorful-tones --- .../components/global-styles/font-families.js | 64 ++++++++++--------- .../font-library-modal/installed-fonts.js | 12 ++-- .../src/components/global-styles/style.scss | 1 - 3 files changed, 41 insertions(+), 36 deletions(-) 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 cbb6b7828c72ee..309bd8a9dc81fe 100644 --- a/packages/edit-site/src/components/global-styles/font-families.js +++ b/packages/edit-site/src/components/global-styles/font-families.js @@ -3,6 +3,7 @@ */ import { __ } from '@wordpress/i18n'; import { + __experimentalText as Text, __experimentalItemGroup as ItemGroup, __experimentalVStack as VStack, Button, @@ -48,48 +49,53 @@ function FontFamilies() { /> ) } - - { __( 'Fonts' ) } - { hasFonts ? ( - <> + + { themeFonts.length > 0 && ( + + { __( 'Theme Fonts' ) } - { customFonts.map( ( font ) => ( + { themeFonts.map( ( font ) => ( ) ) } - { themeFonts.map( ( font ) => ( + + + ) } + { customFonts.length > 0 && ( + + + { __( 'Custom fonts' ) } + + + { customFonts.map( ( font ) => ( ) ) } - - - ) : ( - <> - { __( 'No fonts installed.' ) } - - + + ) } + { ! hasFonts && ( + + { __( 'Fonts' ) } + { __( '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 7d3fa0cd703b64..564f972ce10f0a 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 @@ -169,10 +169,10 @@ function InstalledFonts() { { notice.message } ) } - { baseCustomFonts.length > 0 && ( + { baseThemeFonts.length > 0 && (

- { __( 'Installed Fonts' ) } + { __( 'Theme Fonts' ) }

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

    - { __( 'Theme Fonts' ) } + { __( 'Custom fonts' ) }

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