Skip to content
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
3c6d4d7
Create README.md
chazdean Jul 21, 2022
6213bdb
Add new Text component page
chazdean Jul 21, 2022
a766c83
Add Text component examples
chazdean Jul 21, 2022
f28e2b2
Add changeset
chazdean Jul 21, 2022
6a1df86
Use existing changeset
chazdean Jul 21, 2022
94d112f
Update Syntax
chazdean Jul 21, 2022
436d617
[Typography foundations] Update `<InlineCode>` styling for accessibil…
laurkim Jul 21, 2022
9bf69f2
[Typography foundations] Add fontweight to Text variants (#6698)
laurkim Jul 21, 2022
602fa58
Update polaris-readme-loader.js
chazdean Jul 22, 2022
5fcbf33
Update README.md
chazdean Jul 22, 2022
8548b86
Update text.md
chazdean Jul 22, 2022
d94efa7
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
8564b96
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
9446b0f
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
35b288c
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
7640389
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
5d51de8
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
220db37
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
6aebe0c
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
9afe6ca
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
0a9f134
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
3e4b4fc
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
e535ca8
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
a01b149
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
fc6f257
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
c7e1873
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
08688e6
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
5a146f3
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
56b86eb
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
d0ca2f9
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
f1f802f
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
d2d5bea
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
1bc5c59
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
7441d9f
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
adb290d
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
8a7481d
Update polaris.shopify.com/src/data/components.json
chazdean Jul 22, 2022
789fc04
Update component example titles
chazdean Jul 22, 2022
ca8e7e7
Update component example file names
chazdean Jul 22, 2022
7fd3fee
[Typography foundations] Refactor `display` variants to `heading2xl-4…
laurkim Jul 22, 2022
30e0fba
Create README.md
chazdean Jul 21, 2022
bbc4ea6
Add new Text component page
chazdean Jul 21, 2022
40883ad
Add Text component examples
chazdean Jul 21, 2022
2584d13
Add changeset
chazdean Jul 21, 2022
58ff72e
Use existing changeset
chazdean Jul 21, 2022
ebb07f8
Update Syntax
chazdean Jul 21, 2022
a8cb429
Update polaris-readme-loader.js
chazdean Jul 22, 2022
bcd48bd
Update README.md
chazdean Jul 22, 2022
f0ebfe4
Update text.md
chazdean Jul 22, 2022
142e00d
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
4ba615f
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
9099152
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
5d476e6
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
cee5c07
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
021b084
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
9594328
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
6504600
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
a0e2917
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
6af619f
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
c89e3fa
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
e9841ac
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
9238a21
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
06a8fc8
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
5a24d7b
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
360f5ac
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
9ead05d
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
15eebd7
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
cd495c0
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
4b7cf2b
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
bd0af6e
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
64ca7a3
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
b5e6792
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
677aee0
Update polaris-react/src/components/Text/README.md
chazdean Jul 22, 2022
c0aad00
Update polaris.shopify.com/src/data/components.json
chazdean Jul 22, 2022
104c391
Update component example titles
chazdean Jul 22, 2022
7863d57
Update component example file names
chazdean Jul 22, 2022
0f9033a
Refactor `display` variants to `heading2xl-4xl`
chazdean Jul 22, 2022
d425b36
Merge branch 'chaz/add-text-component-readme' of https://github.com/S…
chazdean Jul 22, 2022
79edf7e
Update polaris.shopify.com/src/pages/examples/text-heading-4xl.tsx
chazdean Jul 22, 2022
5bc6d29
Update polaris.shopify.com/src/pages/examples/text-heading-3xl.tsx
chazdean Jul 22, 2022
42a578b
Update polaris.shopify.com/src/pages/examples/text-heading-2xl.tsx
chazdean Jul 22, 2022
a9dfc80
Update polaris.shopify.com/src/pages/examples/text-heading-extra-larg…
chazdean Jul 22, 2022
56dfa77
Update polaris.shopify.com/src/pages/examples/text-heading-large.tsx
chazdean Jul 22, 2022
088fcc7
Update polaris.shopify.com/src/pages/examples/text-heading-medium.tsx
chazdean Jul 22, 2022
2e46ff0
Update polaris.shopify.com/src/pages/examples/text-heading-small.tsx
chazdean Jul 22, 2022
5fb16af
Remove Text Display examples
chazdean Jul 25, 2022
c9d1608
Merge branch 'chaz/add-text-component-readme' of https://github.com/S…
chazdean Jul 25, 2022
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
10 changes: 5 additions & 5 deletions polaris-react/src/components/InlineCode/InlineCode.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.Code {
background-color: var(--p-surface-subdued);
border-radius: var(--p-border-radius-base);
border: var(--p-border-base);
background-color: var(--p-surface-neutral);
border-radius: var(--p-border-radius-05);
font-family: var(--p-font-family-mono);
font-size: 0.9em;
padding: 0 var(--p-space-1);
font-size: 0.85em;
font-weight: var(--p-font-weight-medium);
padding: var(--p-space-025) var(--p-space-1);
Comment on lines 1 to +7
Copy link
Member

Choose a reason for hiding this comment

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

Should these changes be in this PR or should we just have changes for the site?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It feels like they shouldn't be 🤔 What do you think @laurkim?

Copy link
Contributor

Choose a reason for hiding this comment

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

These changes shouldn't be, I believe they are part of #6700
Not sure why they snuck in here.

}
48 changes: 27 additions & 21 deletions polaris-react/src/components/Text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,66 +31,72 @@ Typography helps establish hierarchy and communicate important content by creati

## Examples

### Display small
### Heading small

Use to create a small display text.
Use to create a small heading text.

```jsx
<Text variant="displaySm">Good evening, Dominic.</Text>
<Text variant="headingSm" as="h6">
Online store dashboard
</Text>
```

### Display medium
### Heading medium

Use to create a medium display text.
Use to create a medium heading text.

```jsx
<Text variant="displayMd">Good evening, Dominic.</Text>
<Text variant="headingMd" as="h6">
Online store dashboard
</Text>
```

### Display large
### Heading large

Use to create a large display text.
Use to create a large heading text.

```jsx
<Text variant="displayLg">Good evening, Dominic.</Text>
<Text variant="headingLg" as="h5">
Online store dashboard
</Text>
```

### Heading small
### Heading extra large

Use to create a small heading text.
Use to create an extra large heading text.

```jsx
<Text variant="headingSm" as="h6">
<Text variant="headingXl" as="h4">
Online store dashboard
</Text>
```

### Heading medium
### Heading 2xl

Use to create a medium heading text.
Use to create a 2xl heading text.

```jsx
<Text variant="headingMd" as="h5">
<Text variant="heading2xl" as="h3">
Online store dashboard
</Text>
```

### Heading large
### Heading 3xl

Use to create a large heading text.
Use to create a 3xl heading text.

```jsx
<Text variant="headingLg" as="h4">
<Text variant="heading3xl" as="h2">
Online store dashboard
</Text>
```

### Heading extra large
### Heading 4xl

Use to create an extra large heading text.
Use to create a 4xl heading text.

```jsx
<Text variant="headingXl" as="h3">
<Text variant="heading4xl" as="h1">
Online store dashboard
</Text>
```
Expand Down
31 changes: 15 additions & 16 deletions polaris-react/src/components/Text/Text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,6 @@
font-weight: var(--p-font-weight-bold);
}

.displaySm {
font-size: var(--p-font-size-75);
line-height: var(--p-font-line-height-5);
}

.displayMd {
font-size: var(--p-font-size-600);
line-height: var(--p-font-line-height-6);
}

.displayLg {
font-size: var(--p-font-size-700);
font-weight: var(--p-font-weight-semibold);
line-height: var(--p-font-line-height-7);
}

.headingSm {
font-size: var(--p-font-size-75);
line-height: var(--p-font-line-height-1);
Expand All @@ -103,6 +87,21 @@
line-height: var(--p-font-line-height-3);
}

.heading2xl {
font-size: var(--p-font-size-500);
line-height: var(--p-font-line-height-5);
}

.heading3xl {
font-size: var(--p-font-size-600);
line-height: var(--p-font-line-height-6);
}

.heading4xl {
font-size: var(--p-font-size-700);
line-height: var(--p-font-line-height-7);
}

.bodySm {
font-size: var(--p-font-size-75);
line-height: var(--p-font-line-height-1);
Expand Down
23 changes: 18 additions & 5 deletions polaris-react/src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import styles from './Text.scss';
type Element = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';

type Variant =
| 'displaySm'
| 'displayMd'
| 'displayLg'
| 'headingSm'
| 'headingMd'
| 'headingLg'
| 'headingXl'
| 'heading2xl'
| 'heading3xl'
| 'heading4xl'
| 'bodySm'
| 'bodyMd'
| 'bodyLg';
Expand All @@ -24,6 +24,19 @@ type FontWeight = 'regular' | 'medium' | 'semibold' | 'bold';

type Color = 'success' | 'critical' | 'warning' | 'subdued';

const VariantFontWeightMapping: {[V in Variant]: FontWeight} = {
headingSm: 'bold',
headingMd: 'semibold',
headingLg: 'semibold',
headingXl: 'semibold',
heading2xl: 'semibold',
heading3xl: 'semibold',
heading4xl: 'bold',
bodySm: 'regular',
bodyMd: 'regular',
bodyLg: 'regular',
};

export interface TextProps {
/** Adjust horizontal alignment of text */
alignment?: Alignment;
Expand All @@ -48,7 +61,7 @@ export const Text = ({
as,
children,
color,
fontWeight = 'regular',
fontWeight,
truncate = false,
variant,
visuallyHidden = false,
Expand All @@ -58,7 +71,7 @@ export const Text = ({
const className = classNames(
styles.root,
styles[variant],
fontWeight && styles[fontWeight],
fontWeight ? styles[fontWeight] : styles[VariantFontWeightMapping[variant]],
(alignment || truncate) && styles.block,
alignment && styles[alignment],
color && styles[color],
Expand Down
24 changes: 12 additions & 12 deletions polaris.shopify.com/content/components/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ status:
value: Alpha
message: This component is in development. There could be breaking changes made to it in a non-major release of Polaris. Please use with caution.
examples:
- fileName: text-display-small.tsx
title: Display small
description: >-
Use to create a small display text.
- fileName: text-display-medium.tsx
title: Display medium
description: >-
Use to create a medium display text.
- fileName: text-display-large.tsx
title: Display large
description: >-
Use to create a large display text.
- fileName: text-heading-small.tsx
title: Heading small
description: >-
Expand All @@ -50,6 +38,18 @@ examples:
title: Heading extra large
description: >-
Use to create an extra large heading text.
- fileName: text-heading-2xl.tsx
title: Heading 2xl
description: >-
Use to create a 2xl heading text.
- fileName: text-heading-3xl.tsx
title: Heading 3xl
description: >-
Use to create a 3xl heading text.
- fileName: text-heading-4xl.tsx
title: Heading 4xl
description: >-
Use to create a 4xl heading text.
- fileName: text-body-small.tsx
title: Body small
description: >-
Expand Down
14 changes: 14 additions & 0 deletions polaris.shopify.com/src/pages/examples/text-heading-2xl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Text } from "@shopify/polaris";
import React from "react";
import { withPolarisExample } from "../../components/PolarisExamplePage";

function TextExample() {
return (
<Text variant="heading2xl" as="h3">
{" "}
Online store dashboard
</Text>
);
}

export default withPolarisExample(TextExample);
14 changes: 14 additions & 0 deletions polaris.shopify.com/src/pages/examples/text-heading-3xl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Text } from "@shopify/polaris";
import React from "react";
import { withPolarisExample } from "../../components/PolarisExamplePage";

function TextExample() {
return (
<Text variant="heading3xl" as="h2">
{" "}
Online store dashboard
</Text>
);
}

export default withPolarisExample(TextExample);
14 changes: 14 additions & 0 deletions polaris.shopify.com/src/pages/examples/text-heading-4xl.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Text } from "@shopify/polaris";
import React from "react";
import { withPolarisExample } from "../../components/PolarisExamplePage";

function TextExample() {
return (
<Text variant="heading4xl" as="h1">
{" "}
Online store dashboard
</Text>
);
}

export default withPolarisExample(TextExample);
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { withPolarisExample } from "../../components/PolarisExamplePage";

function TextExample() {
return (
<Text variant="headingXl" as="h6">
<Text variant="headingXl" as="h4">
{" "}
Online store dashboard
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { withPolarisExample } from "../../components/PolarisExamplePage";

function TextExample() {
return (
<Text variant="headingLg" as="h6">
<Text variant="headingLg" as="h5">
{" "}
Online store dashboard
</Text>
Expand Down