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

[WB-1814.4] Refactor Accordion, Banner, BirthdayPicker to use semantic colors #2446

Merged
merged 3 commits into from
Jan 31, 2025

Conversation

jandrade
Copy link
Member

Summary:

Next step is to refactor the Accordion, Banner, and BirthdayPicker
components to use semantic colors.

Implementation plan:

  1. [WB-1814.1] Refactor Checkbox and Radio to use semantic colors #2439
  2. [WB-1814.2] Refactor TextField and TextArea to use semantic colors #2440
  3. [WB-1814.3] Refactor Switch to use semantic colors #2441
  4. Accordion, Banner, BirthdayPicker (current PR)
  5. IconButton
  6. Clickable, Link
  7. Modal
  8. Popover, Tooltip
  9. Pill, Toolbar

Issue: WB-1814

Test plan:

Verify that the Chromatic snapshots are unchanged.

@jandrade jandrade self-assigned this Jan 29, 2025
Copy link

changeset-bot bot commented Jan 29, 2025

🦋 Changeset detected

Latest commit: 79e48c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@khanacademy/wonder-blocks-birthday-picker Patch
@khanacademy/wonder-blocks-accordion Patch
@khanacademy/wonder-blocks-banner Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jan 29, 2025

Size Change: +44 B (+0.04%)

Total Size: 98.3 kB

Filename Size Change
packages/wonder-blocks-accordion/dist/es/index.js 3.75 kB -14 B (-0.37%)
packages/wonder-blocks-banner/dist/es/index.js 1.55 kB +28 B (+1.83%)
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.8 kB +30 B (+1.69%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-breadcrumbs/dist/es/index.js 887 B
packages/wonder-blocks-button/dist/es/index.js 4.31 kB
packages/wonder-blocks-cell/dist/es/index.js 2.01 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.06 kB
packages/wonder-blocks-core/dist/es/index.js 2.9 kB
packages/wonder-blocks-data/dist/es/index.js 6.24 kB
packages/wonder-blocks-dropdown/dist/es/index.js 18.9 kB
packages/wonder-blocks-form/dist/es/index.js 5.99 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-icon-button/dist/es/index.js 2.95 kB
packages/wonder-blocks-icon/dist/es/index.js 871 B
packages/wonder-blocks-labeled-field/dist/es/index.js 1.84 kB
packages/wonder-blocks-layout/dist/es/index.js 1.82 kB
packages/wonder-blocks-link/dist/es/index.js 2.28 kB
packages/wonder-blocks-modal/dist/es/index.js 5.42 kB
packages/wonder-blocks-pill/dist/es/index.js 1.65 kB
packages/wonder-blocks-popover/dist/es/index.js 4.85 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.52 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.34 kB
packages/wonder-blocks-switch/dist/es/index.js 2 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.74 kB
packages/wonder-blocks-testing/dist/es/index.js 1.07 kB
packages/wonder-blocks-theming/dist/es/index.js 693 B
packages/wonder-blocks-timing/dist/es/index.js 1.8 kB
packages/wonder-blocks-tokens/dist/es/index.js 2.54 kB
packages/wonder-blocks-toolbar/dist/es/index.js 905 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.99 kB
packages/wonder-blocks-typography/dist/es/index.js 1.23 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented Jan 29, 2025

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-ntstvvkenb.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 54
Tests with visual changes 0
Total stories 535
Inherited (not captured) snapshots [TurboSnap] 0
Tests on the build 380

@jandrade jandrade marked this pull request as ready for review January 29, 2025 16:47
@khan-actions-bot khan-actions-bot requested a review from a team January 29, 2025 16:48
@khan-actions-bot
Copy link
Contributor

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/gorgeous-adults-lay.md, __docs__/wonder-blocks-accordion/accordion.stories.tsx, packages/wonder-blocks-accordion/src/components/accordion-section-header.tsx, packages/wonder-blocks-accordion/src/components/accordion-section.tsx, packages/wonder-blocks-banner/src/components/banner.tsx, packages/wonder-blocks-birthday-picker/src/components/birthday-picker.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

Copy link
Contributor

github-actions bot commented Jan 29, 2025

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (fe27e7d) and published all packages with changesets to npm.

You can install the packages in webapp by running:

./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2446"

Packages can also be installed manually by running:

yarn add @khanacademy/wonder-blocks-<package-name>@PR2446

Comment on lines -186 to -190
// Provide basic, default focus styles on older browsers (e.g.
// Safari 14)
":focus": {
boxShadow: `0 0 0 2px ${tokens.color.blue}`,
},
Copy link
Member Author

Choose a reason for hiding this comment

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

note: We now support Safari v14+, so I dropped this.

Copy link
Member

@beaesguerra beaesguerra left a comment

Choose a reason for hiding this comment

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

Looks good! Left a non-blocking question around the banner background color!

@@ -313,7 +313,7 @@ const styles = StyleSheet.create({
// the base color needs to be hard-coded as white for the
// intended pastel background color to show up correctly
// on dark backgrounds.
backgroundColor: color.white,
backgroundColor: semanticColor.surface.primary,
Copy link
Member

Choose a reason for hiding this comment

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

Ohh interesting, we don't use the semantic background colors for the background of the banner (we rely on opacity). Do we want to use the semantic background tokens?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question! tbh I'm not sure how this will be handled with the Polaris theme. I'm going to revisit this once we add theming support to banner. I'll add a TODO comment to make sure we track this.

@jandrade jandrade merged commit 7057fa7 into main Jan 31, 2025
13 of 14 checks passed
@jandrade jandrade deleted the semantic-p3 branch January 31, 2025 22:01
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (c162abb) to head (79e48c0).
Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@     Coverage Diff      @@
##   main   #2446   +/-   ##
============================
============================

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c162abb...79e48c0. Read the comment docs.

jandrade added a commit that referenced this pull request Jan 31, 2025
## Summary:

Next step is to refactor the `IconButton` component to use semantic colors.

Besides the migration, this PR also includes the following changes:

- Reworked the theme structure to make it closer to the semanticColor structure.
- Moved all the color-related CSS properties to a separate function (`getStylesByKind`).
- Added `border` to all the states to prepare the work for Polaris as these
icon buttons will look similar to the Button ones.

### Implementation plan:

1. #2439
2. #2440
3. #2441
4. #2446
5. IconButton (current PR)
6. Clickable, Link
7. Modal
8. Popover, Tooltip
9. Pill, Toolbar


Issue: WB-1814

## Test plan:

Verify that the Chromatic snapshots are unchanged.

URL: `/?path=/story/packages-iconbutton-all-variants--default`

Author: jandrade

Reviewers: jandrade, marcysutton, beaesguerra

Required Reviewers:

Approved By: marcysutton, beaesguerra

Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Chromatic - Build and test on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ gerald, ⏭️  dependabot

Pull Request URL: #2449
jandrade added a commit that referenced this pull request Feb 20, 2025
Next step is to refactor the `Link` component to use semantic colors.

Besides the migration, this PR also includes the following changes:

- Reworked the theme structure to make it closer to the semanticColor structure.
- Updated stories to use the new semantic colors.

### Implementation plan:

1. #2439
2. #2440
3. #2441
4. #2446
5. #2449
6. Link (current PR)
7. Modal
8. Popover, Tooltip
9. Pill
10. Clickable, Toolbar


Issue: WB-1814

## Test plan:

Verify that the Chromatic snapshots are unchanged.

URL: `/?path=/story/packages-link-link-all-variants--default`

Author: jandrade

Reviewers: jandrade, beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Chromatic - Build and test on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ⏭️  dependabot, ✅ gerald

Pull Request URL: #2464
jandrade added a commit that referenced this pull request Feb 20, 2025
## Summary:

Next step is to refactor the `Modal` package to use semantic colors.

Besides the migration, this PR also includes the following changes:

- Reworked the theme structure to split tokens by sub-component.
- Updated stories to use the new semantic colors.
- Adapted some components to use theming instead of hardcoded colors.

### Implementation plan:

1. #2439
2. #2440
3. #2441
4. #2446
5. #2449
6. #2464
7. Modal (current PR)
8. Popover, Tooltip
9. Dropdown
10. Clickable, Pill, Toolbar


Issue: WB-1814

## Test plan:

Verify that the Modal Chromatic snapshots are mostly unchanged.

URL: `/?path=/docs/packages-modal-onepanedialog--docs&globals=viewport:desktop`

Author: jandrade

Reviewers: jandrade, beaesguerra, marcysutton

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Chromatic - Build and test on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ gerald, ⏭️  dependabot

Pull Request URL: #2468
jandrade added a commit that referenced this pull request Feb 20, 2025
…#2470)

## Summary:

Next step is to refactor the `Popover`, `Tooltip` and `Toolbar` packages to use
semantic colors.

### Implementation plan:

1. #2439
2. #2440
3. #2441
4. #2446
5. #2449
6. #2464
7. #2468
8. Popover, Tooltip, Toolbar (current PR)
9. Dropdown
10. Clickable, Pill


Issue: WB-1814

## Test plan:

Verify that the Modal Chromatic snapshots are mostly unchanged.

Author: jandrade

Reviewers: beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Chromatic - Build and test on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ gerald, ⏭️  dependabot

Pull Request URL: #2470
jandrade added a commit that referenced this pull request Feb 20, 2025
## Summary:

- Migrate Clickable and Pill to use semantic colors
- Add `All Variants` story to Pill

### Implementation plan:

1. #2439
2. #2440
3. #2441
4. #2446
5. #2449
6. #2464
7. #2468
8. #2470
9. Clickable, Pill (current PR)
10. Dropdown

Issue: WB-1814

## Test plan:

Navigate to the `Clickable` and `Pill` stories in Storybook and verify that the
colors are correct.

Author: jandrade

Reviewers: jandrade, beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Chromatic - Build and test on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ gerald, ⏭️  dependabot

Pull Request URL: #2472
jandrade added a commit that referenced this pull request Feb 20, 2025
…2474)

## Summary:

Last PR that migrates the remaining components to use semantic colors.

- Added `All Variants` stories to `ActionItem` and `OptionItem`.
- Refactored `ActionItem` and `OptionItem` to use semantic colors.
- Also refactored `ActionMenu`, `SingleSelect`, `MultiSelect` and `Combobox` to
use semantic colors.
- Simplified the styles in `ActionMenuOpenerCore` to use a single static
StyleSheet instance (instead of generating another one in runtime).

### Implementation plan:

1. #2439
2. #2440
3. #2441
4. #2446
5. #2449
6. #2464
7. #2468
8. #2470
9. #2472
10. Dropdown (current PR)

Issue: WB-1814

## Test plan:

Verify that all the dropdown stories are still working as expected.

Author: jandrade

Reviewers: jandrade, beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Chromatic - Build and test on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ⏭️  dependabot, ✅ gerald

Pull Request URL: #2474
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants