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

Components: Add Heading #29592

Merged
merged 6 commits into from
Mar 16, 2021
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
264 changes: 134 additions & 130 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"@wordpress/primitives": "file:../primitives",
"@wordpress/rich-text": "file:../rich-text",
"@wordpress/warning": "file:../warning",
"@wp-g2/components": "^0.0.159",
"@wp-g2/context": "^0.0.159",
"@wp-g2/styles": "^0.0.159",
"@wp-g2/utils": "^0.0.159",
"@wp-g2/components": "^0.0.160",
"@wp-g2/context": "^0.0.160",
"@wp-g2/styles": "^0.0.160",
"@wp-g2/utils": "^0.0.160",
"classnames": "^2.2.5",
"dom-scroll-into-view": "^1.2.1",
"downshift": "^6.0.15",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,8 @@ exports[`props should render mixed control types 1`] = `
color: var(--wp-g2-color-text);
line-height: 1.2;
line-height: var(--wp-g2-font-line-height-base);
font-size: calc(1 * 13px);
font-size: calc(1 * var(--wp-g2-font-size));
font-size: calc((13 / 13) * 13px);
font-size: calc((13 / 13) * var(--wp-g2-font-size));
font-weight: normal;
font-weight: var(--wp-g2-font-weight);
display: block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ exports[`props should render correctly 1`] = `
color: var(--wp-g2-color-text);
line-height: 1.2;
line-height: var(--wp-g2-font-line-height-base);
font-size: calc(1 * 13px);
font-size: calc(1 * var(--wp-g2-font-size));
font-size: calc((13 / 13) * 13px);
font-size: calc((13 / 13) * var(--wp-g2-font-size));
font-weight: normal;
font-weight: var(--wp-g2-font-weight);
display: inline-block;
Expand Down Expand Up @@ -105,8 +105,8 @@ exports[`props should render no truncate 1`] = `
color: var(--wp-g2-color-text);
line-height: 1.2;
line-height: var(--wp-g2-font-line-height-base);
font-size: calc(1 * 13px);
font-size: calc(1 * var(--wp-g2-font-size));
font-size: calc((13 / 13) * 13px);
font-size: calc((13 / 13) * var(--wp-g2-font-size));
font-weight: normal;
font-weight: var(--wp-g2-font-weight);
display: inline-block;
Expand Down Expand Up @@ -181,8 +181,8 @@ exports[`props should render size 1`] = `
color: var(--wp-g2-color-text);
line-height: 1.2;
line-height: var(--wp-g2-font-line-height-base);
font-size: calc(1 * 13px);
font-size: calc(1 * var(--wp-g2-font-size));
font-size: calc((13 / 13) * 13px);
font-size: calc((13 / 13) * var(--wp-g2-font-size));
font-weight: normal;
font-weight: var(--wp-g2-font-weight);
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ exports[`props should render alignLabel 1`] = `
color: var(--wp-g2-color-text);
line-height: 1.2;
line-height: var(--wp-g2-font-line-height-base);
font-size: calc(1 * 13px);
font-size: calc(1 * var(--wp-g2-font-size));
font-size: calc((13 / 13) * 13px);
font-size: calc((13 / 13) * var(--wp-g2-font-size));
font-weight: normal;
font-weight: var(--wp-g2-font-weight);
text-align: right;
Expand Down Expand Up @@ -165,8 +165,8 @@ exports[`props should render vertically 1`] = `
color: var(--wp-g2-color-text);
line-height: 1.2;
line-height: var(--wp-g2-font-line-height-base);
font-size: calc(1 * 13px);
font-size: calc(1 * var(--wp-g2-font-size));
font-size: calc((13 / 13) * 13px);
font-size: calc((13 / 13) * var(--wp-g2-font-size));
font-weight: normal;
font-weight: var(--wp-g2-font-weight);
text-align: left;
Expand Down
24 changes: 24 additions & 0 deletions packages/components/src/ui/heading/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Heading

`Heading` renders headings and titles using the library's typography system.

## Usage

```jsx
import { Heading } from '@wordpress/components/ui';

function Example() {
return <Heading>Code is Poetry</Heading>;
}
```

## Props


`Heading` uses `Text` underneath, so we have access to all of `Text`'s props except for `size` which is replaced by `level`. For a complete list of those props, check out [`Text`](../text/#props).

##### level

**Type**: `1 | 2 | 3 | 4 | 5 | 6`

Passing any of the heading levels to `level` will both render the correct typographic text size as well as the semantic element corresponding to the level (`h1` for `1` for example).
Loading