Skip to content

Commit

Permalink
Display guidance text when there is no font (#56825)
Browse files Browse the repository at this point in the history
* #56734 When there is no font, the border should not appear. Display further guidance text.

* update text

* Fix formatting in font-families.js

* Improve readability

---------

Co-authored-by: Matias Benedetto <matias.benedetto@gmail.com>
Co-authored-by: Sarah Norris <sarah@sekai.co.uk>
  • Loading branch information
3 people authored Jan 11, 2024
1 parent cd548af commit ea90b75
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages/edit-site/src/components/global-styles/font-families.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ function FontFamilies() {
const { modalTabOpen, toggleModal, themeFonts, customFonts } =
useContext( FontLibraryContext );

const hasFonts = 0 < customFonts.length || 0 < themeFonts.length;

return (
<>
{ !! modalTabOpen && (
Expand All @@ -51,14 +53,18 @@ function FontFamilies() {
</Tooltip>
</HStack>
</HStack>
<ItemGroup isBordered isSeparated>
{ customFonts.map( ( font ) => (
<FontFamilyItem key={ font.slug } font={ font } />
) ) }
{ themeFonts.map( ( font ) => (
<FontFamilyItem key={ font.slug } font={ font } />
) ) }
</ItemGroup>
{ hasFonts ? (
<ItemGroup isBordered isSeparated>
{ customFonts.map( ( font ) => (
<FontFamilyItem key={ font.slug } font={ font } />
) ) }
{ themeFonts.map( ( font ) => (
<FontFamilyItem key={ font.slug } font={ font } />
) ) }
</ItemGroup>
) : (
<>{ __( 'No fonts installed.' ) }</>
) }
</VStack>
</>
);
Expand Down

1 comment on commit ea90b75

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in ea90b75.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7491462968
📝 Reported issues:

Please sign in to comment.