Skip to content
Merged
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
7 changes: 7 additions & 0 deletions .changeset/weak-turkeys-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@shopify/polaris': minor
'polaris.shopify.com': patch
---

Added support for `bodyXs` variant and fixed font weight for `headingLg` variant in `Text` component.
Updated references to font tokens from Polaris v11 to v12 in `Text` component documentation
8 changes: 7 additions & 1 deletion polaris-react/src/components/Text/Text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
.headingLg {
font-size: var(--p-font-size-500);
line-height: var(--p-font-line-height-600);
font-weight: var(--p-font-weight-bold);
font-weight: var(--p-font-weight-semibold);

@media (--p-breakpoints-md-up) {
font-size: var(--p-text-heading-lg-font-size);
Expand Down Expand Up @@ -120,6 +120,12 @@
@include _heading3xl;
}

.bodyXs {
font-size: var(--p-text-body-xs-font-size);
font-weight: var(--p-text-body-xs-font-weight);
line-height: var(--p-text-body-xs-font-line-height);
}

.bodySm {
font-size: var(--p-text-body-sm-font-size);
font-weight: var(--p-text-body-sm-font-weight);
Expand Down
3 changes: 3 additions & 0 deletions polaris-react/src/components/Text/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const Variants = () => (
<Text as="p" variant="bodySm">
Text with BodySm variant
</Text>
<Text as="p" variant="bodyXs">
Text with BodyXs variant
</Text>
<Text as="strong" variant="bodySm">
Text as a strong tag
</Text>
Expand Down
1 change: 1 addition & 0 deletions polaris-react/src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Variant =
| 'headingXl'
| 'heading2xl'
| 'heading3xl'
| 'bodyXs'
| 'bodySm'
| 'bodyMd'
| 'bodyLg';
Expand Down
19 changes: 10 additions & 9 deletions polaris.shopify.com/content/components/typography/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,16 @@ Each variant uses a predetermined combination of the [font tokens](/tokens/font)

| Variant | Font size token | px value | rem value | Font line height token | Font weight token | Reponsive |
| ------------ | ------------------- | -------- | --------- | ---------------------- | -------------------------- | --------- |
| `heading3xl` | `--p-font-size-600` | 32 | 2 | `--p-line-height-6` | `--p-font-weight-semibold` | Yes |
| `heading2xl` | `--p-font-size-500` | 28 | 1.75 | `--p-line-height-5` | `--p-font-weight-semibold` | Yes |
| `headingXl` | `--p-font-size-400` | 24 | 1.5 | `--p-line-height-4` | `--p-font-weight-semibold` | Yes |
| `headingLg` | `--p-font-size-300` | 20 | 1.25 | `--p-line-height-3` | `--p-font-weight-semibold` | Yes |
| `headingMd` | `--p-font-size-200` | 16 | 1 | `--p-line-height-3` | `--p-font-weight-semibold` | No |
| `headingSm` | `--p-font-size-100` | 14 | 0.875 | `--p-line-height-2` | `--p-font-weight-semibold` | No |
| `bodyLg` | `--p-font-size-200` | 16 | 1 | `--p-line-height-2` | `--p-font-weight-regular` | No |
| `bodyMd` | `--p-font-size-100` | 14 | 0.875 | `--p-line-height-2` | `--p-font-weight-regular` | No |
| `bodySm` | `--p-font-size-75` | 12 | 0.75 | `--p-line-height-1` | `--p-font-weight-regular` | No |
| `heading3xl` | `--p-font-size-900` | 36 | 2.25 | `--p-line-height-1200` | `--p-font-weight-bold` | Yes |
| `heading2xl` | `--p-font-size-750` | 30 | 1.875 | `--p-line-height-1000` | `--p-font-weight-bold` | Yes |
| `headingXl` | `--p-font-size-600` | 24 | 1.5 | `--p-line-height-800` | `--p-font-weight-bold` | Yes |
| `headingLg` | `--p-font-size-500` | 20 | 1.25 | `--p-line-height-600` | `--p-font-weight-semibold` | Yes |
| `headingMd` | `--p-font-size-350` | 14 | 0.875 | `--p-line-height-500` | `--p-font-weight-semibold` | No |
| `headingSm` | `--p-font-size-325` | 13 | 0.8125 | `--p-line-height-500` | `--p-font-weight-semibold` | No |
| `bodyLg` | `--p-font-size-350` | 14 | 0.875 | `--p-line-height-500` | `--p-font-weight-regular` | No |
| `bodyMd` | `--p-font-size-325` | 13 | 0.8125 | `--p-line-height-500` | `--p-font-weight-regular` | No |
| `bodySm` | `--p-font-size-300` | 12 | 0.75 | `--p-line-height-400` | `--p-font-weight-regular` | No |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `bodySm` | `--p-font-size-300` | 12 | 0.75 | `--p-line-height-400` | `--p-font-weight-regular` | No |
| `bodySm` | `--p-font-size-300` | 12 | 0.75 | `--p-line-height-400` | `--p-font-weight-regular` | No |
| `bodyXs` | `--p-font-size-275` | 11 | 0.6875 | `--p-line-height-300` | `--p-font-weight-regular` | No |

Copy link
Contributor Author

@laurkim laurkim Nov 2, 2023

Choose a reason for hiding this comment

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

@sarahill we don't support bodyXs as a variant in Text right now.
Is that something that should be added in?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yea that should be added to the Text component. We must have just missed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha, will add in this PR 👍

| `bodyXs` | `--p-font-size-275` | 11 | 0.6875 | `--p-line-height-300` | `--p-font-weight-regular` | No |

---

Expand Down
8 changes: 6 additions & 2 deletions polaris.shopify.com/pages/examples/text-body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ function TextExample() {
Shopify POS is the easiest way to sell your products in person.
Available for iPad, iPhone, and Android.
</Text>
<p>
<Text variant="bodyMd" as="p">
Shopify POS is the easiest way to sell your products in person.
Available for iPad, iPhone, and Android.
</p>
</Text>
<Text variant="bodySm" as="p">
Shopify POS is the easiest way to sell your products in person.
Available for iPad, iPhone, and Android.
</Text>
<Text variant="bodyXs" as="p">
Shopify POS is the easiest way to sell your products in person.
Available for iPad, iPhone, and Android.
</Text>
</LegacyStack>
);
}
Expand Down