Skip to content

Commit

Permalink
feat: Add 'medium' weight to Heading (#814)
Browse files Browse the repository at this point in the history
* feat: Add 'medium' weight to Heading

* Update changelog

* Bump version
  • Loading branch information
frankieyan authored Feb 20, 2024
1 parent 3366d1e commit c3ac8d1
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Reactist follows [semantic versioning](https://semver.org/) and doesn't introduce breaking changes (API-wise) in minor or patch releases. However, the appearance of a component might change in a minor or patch release so keep an eye on redesigns and make sure your app still looks and feels like you expect it.

# v23.2.0

- [Feat] Add `medium` as a `weight` option for `Header`.

# v23.1.0

- [Feat] Add `--reactist-font-family-monospace` with updated font family for monospace elements
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"email": "[email protected]",
"url": "http://doist.com"
},
"version": "23.1.0",
"version": "23.2.0",
"license": "MIT",
"homepage": "https://github.com/Doist/reactist#readme",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions src/heading/heading.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
font-family: var(--reactist-font-family);
}

.weight-medium {
font-weight: var(--reactist-font-weight-medium);
}

.weight-light {
font-weight: var(--reactist-font-weight-regular);
}
Expand Down
2 changes: 1 addition & 1 deletion src/heading/heading.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function HeadingPlaygroundStory(props: React.ComponentProps<typeof Headin
HeadingPlaygroundStory.argTypes = {
level: select(['1', '2', '3', '4', '5', '6'], '1'),
size: selectWithNone(['largest', 'larger', 'smaller'], 'none'),
weight: select(['regular', 'light'], 'regular'),
weight: select(['regular', 'medium', 'light'], 'regular'),
lineClamp: selectWithNone([1, 2, 3, 4, 5], 'none'),
tone: select(['normal', 'secondary', 'danger'], 'normal'),
align: selectWithNone(['start', 'center', 'end', 'justify'], 'none'),
Expand Down
7 changes: 7 additions & 0 deletions src/heading/heading.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ describe('Heading', () => {
expect(textElement).not.toHaveClass('weight-regular')
expect(textElement).not.toHaveClass('weight-light')

rerender(
<Heading level="1" data-testid="heading-element" weight="medium">
Heading
</Heading>,
)
expect(textElement).toHaveClass('weight-medium')

rerender(
<Heading level="1" data-testid="heading-element" weight="light">
Heading
Expand Down
4 changes: 2 additions & 2 deletions src/heading/heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ type HeadingProps = SupportedHeadingElementProps & {
*/
level: HeadingLevel
/**
* The weight of the heading. Used to de-emphasize the heading visually when using 'light'.
* The weight of the heading. Used to de-emphasize the heading visually when using 'medium' or 'light'.
*
* @default 'regular'
*/
weight?: 'regular' | 'light'
weight?: 'regular' | 'medium' | 'light'
/**
* Shifts the default heading visual text size up or down, depending on the original size
* imposed by the `level`. The heading continues to be semantically at the given level.
Expand Down

0 comments on commit c3ac8d1

Please sign in to comment.