Skip to content

Commit 4db4417

Browse files
authored
[polaris.shopify.com] Replace typography with Text component (#7634)
### WHY are these changes introduced? Resolves #6588. ### WHAT is this pull request doing? Replaces usage of legacy typography components in the style guide to use the new `<Text />` component with the polaris migrator: ```sh polaris-migrator replace-text-component "./polaris.shopify.com/pages/**/*.tsx" ``` <!-- ℹ️ Delete the following for small / trivial changes --> ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [x] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
1 parent b7b0ef5 commit 4db4417

File tree

73 files changed

+335
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+335
-377
lines changed

.changeset/blue-tools-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'polaris.shopify.com': patch
3+
---
4+
5+
Replaced usage of typography components (`DisplayText`, `Heading`, `Subheading`, `Caption`, `VisuallyHidden`, `TextStyle`) with the new `Text` component

polaris.shopify.com/pages/examples/app-provider-default.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Card,
55
ResourceList,
66
Avatar,
7-
TextStyle,
7+
Text,
88
} from '@shopify/polaris';
99
import React from 'react';
1010
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -53,9 +53,9 @@ function AppProviderExample() {
5353

5454
return (
5555
<ResourceList.Item id={id} url={url} media={media}>
56-
<h3>
57-
<TextStyle variation="strong">{name}</TextStyle>
58-
</h3>
56+
<Text variant="bodyMd" fontWeight="bold" as="h3">
57+
{name}
58+
</Text>
5959
<div>{location}</div>
6060
</ResourceList.Item>
6161
);

polaris.shopify.com/pages/examples/app-provider-with-i18n.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Card,
55
ResourceList,
66
Avatar,
7-
TextStyle,
7+
Text,
88
} from '@shopify/polaris';
99
import React from 'react';
1010
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -53,9 +53,9 @@ function AppProviderI18NExample() {
5353

5454
return (
5555
<ResourceList.Item id={id} url={url} media={media}>
56-
<h3>
57-
<TextStyle variation="strong">{name}</TextStyle>
58-
</h3>
56+
<Text variant="bodyMd" fontWeight="bold" as="h3">
57+
{name}
58+
</Text>
5959
<div>{location}</div>
6060
</ResourceList.Item>
6161
);

polaris.shopify.com/pages/examples/card-with-custom-react-node-title.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Card, Stack, Icon, Subheading, List} from '@shopify/polaris';
1+
import {Card, Stack, Icon, List, Text} from '@shopify/polaris';
22
import {ProductsMajor} from '@shopify/polaris-icons';
33
import React from 'react';
44
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -10,7 +10,9 @@ function CardExample() {
1010
title={
1111
<Stack>
1212
<Icon source={ProductsMajor} />
13-
<Subheading>New Products</Subheading>
13+
<Text variant="headingXs" as="h3">
14+
New Products
15+
</Text>
1416
</Stack>
1517
}
1618
>

polaris.shopify.com/pages/examples/combobox-with-multi-select-and-vertical-content.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {
2-
TextStyle,
32
Stack,
43
Tag,
54
Listbox,
65
EmptySearchResult,
76
Combobox,
7+
Text,
88
} from '@shopify/polaris';
99
import {useState, useCallback, useMemo} from 'react';
1010
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -68,7 +68,9 @@ function MultiselectTagComboboxExample() {
6868
return (
6969
<p>
7070
{start}
71-
<TextStyle variation="strong">{highlight}</TextStyle>
71+
<Text variant="bodyMd" fontWeight="bold" as="span">
72+
{highlight}
73+
</Text>
7274
{end}
7375
</p>
7476
);

polaris.shopify.com/pages/examples/drop-zone-accepts-only-svg-files.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
Stack,
3-
Thumbnail,
4-
Caption,
5-
Banner,
6-
List,
7-
DropZone,
8-
} from '@shopify/polaris';
1+
import {Stack, Thumbnail, Banner, List, DropZone, Text} from '@shopify/polaris';
92
import {useState, useCallback} from 'react';
103
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
114

@@ -32,7 +25,10 @@ function DropZoneAcceptingSVGFilesExample() {
3225
source={window.URL.createObjectURL(file)}
3326
/>
3427
<div>
35-
{file.name} <Caption>{file.size} bytes</Caption>
28+
{file.name}{' '}
29+
<Text variant="bodySm" as="p">
30+
{file.size} bytes
31+
</Text>
3632
</div>
3733
</Stack>
3834
))}

polaris.shopify.com/pages/examples/drop-zone-default.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {DropZone, Stack, Thumbnail, Caption} from '@shopify/polaris';
1+
import {DropZone, Stack, Thumbnail, Text} from '@shopify/polaris';
22
import {NoteMinor} from '@shopify/polaris-icons';
33
import {useState, useCallback} from 'react';
44
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -30,7 +30,10 @@ function DropZoneExample() {
3030
}
3131
/>
3232
<div>
33-
{file.name} <Caption>{file.size} bytes</Caption>
33+
{file.name}{' '}
34+
<Text variant="bodySm" as="p">
35+
{file.size} bytes
36+
</Text>
3437
</div>
3538
</Stack>
3639
))}

polaris.shopify.com/pages/examples/drop-zone-nested.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {DropZone, Stack, Thumbnail, Caption, Card} from '@shopify/polaris';
1+
import {DropZone, Stack, Thumbnail, Card, Text} from '@shopify/polaris';
22
import {NoteMinor} from '@shopify/polaris-icons';
33
import {useState, useCallback} from 'react';
44
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -29,7 +29,10 @@ function NestedDropZoneExample() {
2929
}
3030
/>
3131
<div>
32-
{file.name} <Caption>{file.size} bytes</Caption>
32+
{file.name}{' '}
33+
<Text variant="bodySm" as="p">
34+
{file.size} bytes
35+
</Text>
3336
</div>
3437
</Stack>
3538
))}

polaris.shopify.com/pages/examples/drop-zone-with-custom-file-dialog-trigger.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Stack, Thumbnail, Caption, Card, DropZone} from '@shopify/polaris';
1+
import {Stack, Thumbnail, Card, DropZone, Text} from '@shopify/polaris';
22
import {NoteMinor} from '@shopify/polaris-icons';
33
import {useState, useCallback} from 'react';
44
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -33,7 +33,10 @@ function DropZoneWithCustomFileDialogExample() {
3333
}
3434
/>
3535
<div>
36-
{file.name} <Caption>{file.size} bytes</Caption>
36+
{file.name}{' '}
37+
<Text variant="bodySm" as="p">
38+
{file.size} bytes
39+
</Text>
3740
</div>
3841
</Stack>
3942
))}

polaris.shopify.com/pages/examples/drop-zone-with-custom-file-upload-text.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {DropZone, Stack, Thumbnail, Caption} from '@shopify/polaris';
1+
import {DropZone, Stack, Thumbnail, Text} from '@shopify/polaris';
22
import {NoteMinor} from '@shopify/polaris-icons';
33
import {useState, useCallback} from 'react';
44
import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
@@ -32,7 +32,10 @@ function DropZoneExample() {
3232
}
3333
/>
3434
<div>
35-
{file.name} <Caption>{file.size} bytes</Caption>
35+
{file.name}{' '}
36+
<Text variant="bodySm" as="p">
37+
{file.size} bytes
38+
</Text>
3639
</div>
3740
</Stack>
3841
))}

0 commit comments

Comments
 (0)