Skip to content

Commit 98f3f6a

Browse files
ndiegoramonjdkevin940726aferciacarolinan
authored
Revert the manage fonts button. (#66107)
Co-authored-by: ndiego <[email protected]> Co-authored-by: ramonjd <[email protected]> Co-authored-by: kevin940726 <[email protected]> Co-authored-by: afercia <[email protected]> Co-authored-by: carolinan <[email protected]> Co-authored-by: colorful-tones <[email protected]> Co-authored-by: richtabor <[email protected]>
1 parent 43417f3 commit 98f3f6a

File tree

2 files changed

+38
-31
lines changed

2 files changed

+38
-31
lines changed

packages/edit-site/src/components/global-styles/font-families.js

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import {
66
__experimentalText as Text,
77
__experimentalItemGroup as ItemGroup,
88
__experimentalVStack as VStack,
9+
__experimentalHStack as HStack,
910
Button,
1011
} from '@wordpress/components';
1112
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
13+
import { settings } from '@wordpress/icons';
1214
import { useContext } from '@wordpress/element';
1315

1416
/**
@@ -67,10 +69,18 @@ function FontFamilies() {
6769
/>
6870
) }
6971

70-
<VStack spacing={ 4 }>
72+
<VStack spacing={ 2 }>
73+
<HStack justify="space-between">
74+
<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
75+
<Button
76+
onClick={ () => setModalTabOpen( 'installed-fonts' ) }
77+
label={ __( 'Manage fonts' ) }
78+
icon={ settings }
79+
size="small"
80+
/>
81+
</HStack>
7182
{ activeFonts.length > 0 && (
7283
<>
73-
<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
7484
<ItemGroup size="large" isBordered isSeparated>
7585
{ activeFonts.map( ( font ) => (
7686
<FontFamilyItem
@@ -82,31 +92,30 @@ function FontFamilies() {
8292
</>
8393
) }
8494
{ ! hasFonts && (
85-
<VStack>
86-
<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
95+
<>
8796
<Text as="p">
8897
{ hasInstalledFonts
8998
? __( 'No fonts activated.' )
9099
: __( 'No fonts installed.' ) }
91100
</Text>
92-
</VStack>
101+
<Button
102+
className="edit-site-global-styles-font-families__manage-fonts"
103+
variant="secondary"
104+
__next40pxDefaultSize
105+
onClick={ () => {
106+
setModalTabOpen(
107+
hasInstalledFonts
108+
? 'installed-fonts'
109+
: 'upload-fonts'
110+
);
111+
} }
112+
>
113+
{ hasInstalledFonts
114+
? __( 'Manage fonts' )
115+
: __( 'Add fonts' ) }
116+
</Button>
117+
</>
93118
) }
94-
<Button
95-
className="edit-site-global-styles-font-families__manage-fonts"
96-
variant="secondary"
97-
__next40pxDefaultSize
98-
onClick={ () => {
99-
setModalTabOpen(
100-
hasInstalledFonts
101-
? 'installed-fonts'
102-
: 'upload-fonts'
103-
);
104-
} }
105-
>
106-
{ hasInstalledFonts
107-
? __( 'Manage fonts' )
108-
: __( 'Add fonts' ) }
109-
</Button>
110119
</VStack>
111120
</>
112121
);

test/e2e/specs/site-editor/font-library.spec.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ test.describe( 'Font Library', () => {
3838
).toBeVisible();
3939
} );
4040

41-
test( 'should display the "Add fonts" button', async ( { page } ) => {
41+
test( 'should display the "Manage fonts" icon', async ( { page } ) => {
4242
await page
4343
.getByRole( 'region', { name: 'Editor top bar' } )
4444
.getByRole( 'button', { name: 'Styles' } )
4545
.click();
4646
await page
4747
.getByRole( 'button', { name: 'Typography Styles' } )
4848
.click();
49-
const addFontsButton = page.getByRole( 'button', {
50-
name: 'Add fonts',
49+
const manageFontsIcon = page.getByRole( 'button', {
50+
name: 'Manage fonts',
5151
} );
52-
await expect( addFontsButton ).toBeVisible();
52+
await expect( manageFontsIcon ).toBeVisible();
5353
} );
5454
} );
5555

@@ -66,23 +66,21 @@ test.describe( 'Font Library', () => {
6666
} );
6767
} );
6868

69-
test( 'should display the "Manage fonts" button', async ( {
70-
page,
71-
} ) => {
69+
test( 'should display the "Manage fonts" icon', async ( { page } ) => {
7270
await page
7371
.getByRole( 'region', { name: 'Editor top bar' } )
7472
.getByRole( 'button', { name: 'Styles' } )
7573
.click();
7674
await page
7775
.getByRole( 'button', { name: 'Typography Styles' } )
7876
.click();
79-
const manageFontsButton = page.getByRole( 'button', {
77+
const manageFontsIcon = page.getByRole( 'button', {
8078
name: 'Manage fonts',
8179
} );
82-
await expect( manageFontsButton ).toBeVisible();
80+
await expect( manageFontsIcon ).toBeVisible();
8381
} );
8482

85-
test( 'should open the "Manage fonts" modal when clicking the "Manage fonts" button', async ( {
83+
test( 'should open the "Manage fonts" modal when clicking the "Manage fonts" icon', async ( {
8684
page,
8785
} ) => {
8886
await page

0 commit comments

Comments
 (0)