-
Notifications
You must be signed in to change notification settings - Fork 674
refactor(Heading): update component to CSS Modules #4819
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
696000e
refactor(Heading): update component to CSS Modules
joshblack 35fdfc4
test(e2e): add feature flags for Heading test
joshblack 3ce9bf1
chore: fix stylelint errors
joshblack c1594e4
Merge branch 'main' of github.com:primer/react into 3716-refactor-hea…
joshblack 1a715d0
test(e2e): update snapshots for Heading
joshblack 2b865b1
refactor(Heading): incorporate variant features into CSS Modules
joshblack c467fc3
chore: add changeset
joshblack 933dadb
test(e2e): remove theme testing
joshblack d6eca99
Fix props here
jonrohan 9224646
Merge branch 'main' into 3716-refactor-heading-to-css-modules
jonrohan b91afd1
Remove examples/nextjs
jonrohan 61e16dd
Clean up css
jonrohan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@primer/react': minor | ||
| --- | ||
|
|
||
| Update Heading component to use CSS Modules behind feature flag |
Binary file removed
BIN
-10.8 KB
.../components/Heading.test.ts-snapshots/Heading-Default-dark-colorblind-linux.png
Binary file not shown.
Binary file removed
BIN
-10.8 KB
...hots/components/Heading.test.ts-snapshots/Heading-Default-dark-dimmed-linux.png
Binary file not shown.
Binary file removed
BIN
-10.7 KB
...mponents/Heading.test.ts-snapshots/Heading-Default-dark-high-contrast-linux.png
Binary file not shown.
Binary file removed
BIN
-10.8 KB
...t/snapshots/components/Heading.test.ts-snapshots/Heading-Default-dark-linux.png
Binary file not shown.
Binary file removed
BIN
-10.8 KB
.../components/Heading.test.ts-snapshots/Heading-Default-dark-tritanopia-linux.png
Binary file not shown.
Binary file removed
BIN
-10.7 KB
...components/Heading.test.ts-snapshots/Heading-Default-light-colorblind-linux.png
Binary file not shown.
Binary file removed
BIN
-10.6 KB
...ponents/Heading.test.ts-snapshots/Heading-Default-light-high-contrast-linux.png
Binary file not shown.
Binary file removed
BIN
-10.7 KB
.../snapshots/components/Heading.test.ts-snapshots/Heading-Default-light-linux.png
Binary file not shown.
Binary file removed
BIN
-10.7 KB
...components/Heading.test.ts-snapshots/Heading-Default-light-tritanopia-linux.png
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,69 @@ | ||
| import {test, expect} from '@playwright/test' | ||
| import {visit} from '../test-helpers/storybook' | ||
|
|
||
| test.describe('Heading', () => { | ||
| test.describe('Default', () => { | ||
| test('default @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading--default', | ||
| }) | ||
|
|
||
| // Default state | ||
| expect(await page.screenshot()).toMatchSnapshot(`Heading.Default.png`) | ||
| }) | ||
|
|
||
| test('axe @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading--default', | ||
| }) | ||
| await expect(page).toHaveNoViolations() | ||
| }) | ||
| }) | ||
|
|
||
| test.describe('Small', () => { | ||
| test('default @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading-features--small', | ||
| }) | ||
| const stories = [ | ||
| { | ||
| title: 'Default', | ||
| id: 'components-heading--default', | ||
| }, | ||
| { | ||
| title: 'Small', | ||
| id: 'components-heading-features--small', | ||
| }, | ||
| { | ||
| title: 'Medium', | ||
| id: 'components-heading-features--medium', | ||
| }, | ||
| { | ||
| title: 'Large', | ||
| id: 'components-heading-features--large', | ||
| }, | ||
| ] as const | ||
|
|
||
| expect(await page.screenshot()).toMatchSnapshot(`Heading.Small.png`) | ||
| }) | ||
| test.describe('Heading', () => { | ||
| for (const story of stories) { | ||
| test.describe(story.title, () => { | ||
| test('default @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: story.id, | ||
| globals: { | ||
| featureFlags: { | ||
| primer_react_css_modules: true, | ||
| }, | ||
| }, | ||
| }) | ||
|
|
||
| test('axe @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading-features--small', | ||
| // Default state | ||
| expect(await page.screenshot()).toMatchSnapshot(`Heading.${story.title}.png`) | ||
| }) | ||
| await expect(page).toHaveNoViolations() | ||
| }) | ||
| }) | ||
|
|
||
| test.describe('Medium', () => { | ||
| test('default @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading-features--medium', | ||
| }) | ||
| test('default (styled-components) @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: story.id, | ||
| }) | ||
|
|
||
| expect(await page.screenshot()).toMatchSnapshot(`Heading.Medium.png`) | ||
| }) | ||
|
|
||
| test('axe @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading-features--medium', | ||
| // Default state | ||
| expect(await page.screenshot()).toMatchSnapshot(`Heading.${story.title}.png`) | ||
| }) | ||
| await expect(page).toHaveNoViolations() | ||
| }) | ||
| }) | ||
|
|
||
| test.describe('Large', () => { | ||
| test('default @vrt', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading-features--large', | ||
| test('axe @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: story.id, | ||
| globals: { | ||
| featureFlags: { | ||
| primer_react_css_modules: true, | ||
| }, | ||
| }, | ||
| }) | ||
| await expect(page).toHaveNoViolations() | ||
| }) | ||
|
|
||
| // Default state | ||
| expect(await page.screenshot()).toMatchSnapshot(`Heading.Large.png`) | ||
| }) | ||
|
|
||
| test('axe @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: 'components-heading-features--large', | ||
| test('axe (styled-components) @aat', async ({page}) => { | ||
| await visit(page, { | ||
| id: story.id, | ||
| }) | ||
| await expect(page).toHaveNoViolations() | ||
| }) | ||
| await expect(page).toHaveNoViolations() | ||
| }) | ||
| }) | ||
| } | ||
| }) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| .Heading { | ||
| margin: 0; | ||
| font-size: var(--text-title-size-large); | ||
| font-weight: var(--base-text-weight-semibold); | ||
| } | ||
|
|
||
| .Heading:where([data-variant='large']) { | ||
| font: var(--text-title-shorthand-large); | ||
| } | ||
|
|
||
| .Heading:where([data-variant='medium']) { | ||
| font: var(--text-title-shorthand-medium); | ||
| } | ||
|
|
||
| .Heading:where([data-variant='small']) { | ||
| font: var(--text-title-shorthand-small); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.