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 and henningmu committed Feb 20, 2024
1 parent 0352954 commit 60e7a2d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Reactist follows [semantic versioning](https://semver.org/) and doesn't introduc

- [BREAKING] Upgrade Ariakit from legacy package to the newer @ariakit/react

# 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: 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 60e7a2d

Please sign in to comment.