Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Library: Replace manage fonts icon with button with visible text #58158

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions packages/edit-site/src/components/global-styles/font-families.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ import { __ } from '@wordpress/i18n';
import {
__experimentalItemGroup as ItemGroup,
__experimentalVStack as VStack,
__experimentalHStack as HStack,
Button,
Tooltip,
} from '@wordpress/components';
import { typography } from '@wordpress/icons';
import { useContext } from '@wordpress/element';

/**
Expand Down Expand Up @@ -38,21 +35,7 @@ function FontFamilies() {
) }

<VStack spacing={ 3 }>
<HStack justify="space-between">
<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
<HStack justify="flex-end">
<Tooltip text={ __( 'Manage fonts' ) }>
<Button
onClick={ () =>
toggleModal( 'installed-fonts' )
}
aria-label={ __( 'Manage fonts' ) }
icon={ typography }
size={ 'small' }
/>
</Tooltip>
</HStack>
</HStack>
<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
{ hasFonts ? (
<ItemGroup isBordered isSeparated>
{ customFonts.map( ( font ) => (
Expand All @@ -65,6 +48,14 @@ function FontFamilies() {
) : (
<>{ __( 'No fonts installed.' ) }</>
) }
<Button
className="edit-site-global-styles-font-families__manage-fonts-button"
variant="secondary"
onClick={ () => toggleModal( 'installed-fonts' ) }
size={ 'compact' }
>
{ __( 'Manage all fonts' ) }
</Button>
</VStack>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
}
}

.edit-site-global-styles-font-families__manage-fonts-button {
justify-content: center;
}

.edit-site-global-styles-icon-with-current-color {
fill: currentColor;
}
Expand Down
16 changes: 8 additions & 8 deletions test/e2e/specs/site-editor/font-library.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ test.describe( 'Font Library', () => {
await page
.getByRole( 'button', { name: /typography styles/i } )
.click();
const manageFontsIcon = page.getByRole( 'button', {
name: /manage fonts/i,
const manageFontsButton = page.getByRole( 'button', {
name: /Manage all fonts/i,
} );
await expect( manageFontsIcon ).toBeVisible();
await expect( manageFontsButton ).toBeVisible();
} );
} );

Expand All @@ -41,10 +41,10 @@ test.describe( 'Font Library', () => {
await page
.getByRole( 'button', { name: /typography styles/i } )
.click();
const manageFontsIcon = page.getByRole( 'button', {
name: /manage fonts/i,
const manageFontsButton = page.getByRole( 'button', {
name: /Manage all fonts/i,
} );
await expect( manageFontsIcon ).toBeVisible();
await expect( manageFontsButton ).toBeVisible();
} );

test( 'should open the "Manage Fonts" modal when clicking the "Manage Fonts" icon', async ( {
Expand All @@ -56,7 +56,7 @@ test.describe( 'Font Library', () => {
.click();
await page
.getByRole( 'button', {
name: /manage fonts/i,
name: /Manage all fonts/i,
} )
.click();
await expect( page.getByRole( 'dialog' ) ).toBeVisible();
Expand All @@ -74,7 +74,7 @@ test.describe( 'Font Library', () => {
.click();
await page
.getByRole( 'button', {
name: /manage fonts/i,
name: /Manage all fonts/i,
} )
.click();
await page.getByRole( 'button', { name: /system font/i } ).click();
Expand Down
Loading