Skip to content

[WB-1867.3] Add ThunderBlocks theme to modal #2678

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 14 commits into from
Jun 26, 2025
Merged

[WB-1867.3] Add ThunderBlocks theme to modal #2678

merged 14 commits into from
Jun 26, 2025

Conversation

jandrade
Copy link
Member

Summary:

Last PR to add Thunderblocks theme to modal components.

  • Adds ThunderBlocks theme to modal package.
  • Updates typography to use BodyText and Heading.
  • Removes Strut uses (including stories).

Figma: https://www.figma.com/design/EuFu0U7gqc1koXm8ZhlOLp/%E2%9A%A1%EF%B8%8F-Components?node-id=2213-141&m=dev

Implementation plan

  1. [WB-1867.1] Modal setup: Remove Khanmigo theme from modal #2676
  2. [WB-1867.2] Remove light prop from Modal package. #2677
  3. [WB-1867.3] Add ThunderBlocks theme to modal #2678

Issue: https://khanacademy.atlassian.net/browse/WB-1867

Test plan:

Navigate to the Modal stories in Storybook and ensure that the modals render
correctly.

Make sure that the typography elements are looking as expected.

@jandrade jandrade self-assigned this Jun 20, 2025
Copy link

changeset-bot bot commented Jun 20, 2025

🦋 Changeset detected

Latest commit: e91690b

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

This PR includes changesets to release 28 packages
Name Type
@khanacademy/wonder-blocks-modal Minor
@khanacademy/wonder-blocks-tokens Minor
@khanacademy/wonder-blocks-dropdown Patch
@khanacademy/wonder-blocks-popover Patch
@khanacademy/wonder-blocks-tooltip Patch
@khanacademy/wonder-blocks-accordion Patch
@khanacademy/wonder-blocks-badge Patch
@khanacademy/wonder-blocks-banner Patch
@khanacademy/wonder-blocks-birthday-picker Patch
@khanacademy/wonder-blocks-breadcrumbs Patch
@khanacademy/wonder-blocks-button Patch
@khanacademy/wonder-blocks-cell Patch
@khanacademy/wonder-blocks-clickable Patch
@khanacademy/wonder-blocks-form Patch
@khanacademy/wonder-blocks-grid Patch
@khanacademy/wonder-blocks-icon-button Patch
@khanacademy/wonder-blocks-icon Patch
@khanacademy/wonder-blocks-labeled-field Patch
@khanacademy/wonder-blocks-layout Patch
@khanacademy/wonder-blocks-link Patch
@khanacademy/wonder-blocks-pill Patch
@khanacademy/wonder-blocks-progress-spinner Patch
@khanacademy/wonder-blocks-search-field Patch
@khanacademy/wonder-blocks-styles Patch
@khanacademy/wonder-blocks-switch Patch
@khanacademy/wonder-blocks-tabs Patch
@khanacademy/wonder-blocks-toolbar Patch
@khanacademy/wonder-blocks-typography 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 Jun 20, 2025

Size Change: +47 B (+0.05%)

Total Size: 101 kB

Filename Size Change
packages/wonder-blocks-modal/dist/es/index.js 4.66 kB +47 B (+1.02%)
ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 2.99 kB
packages/wonder-blocks-announcer/dist/es/index.js 1.74 kB
packages/wonder-blocks-badge/dist/es/index.js 1.75 kB
packages/wonder-blocks-banner/dist/es/index.js 1.91 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.91 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 723 B
packages/wonder-blocks-button/dist/es/index.js 4.12 kB
packages/wonder-blocks-cell/dist/es/index.js 2.06 kB
packages/wonder-blocks-clickable/dist/es/index.js 2.67 kB
packages/wonder-blocks-core/dist/es/index.js 2.48 kB
packages/wonder-blocks-data/dist/es/index.js 5.48 kB
packages/wonder-blocks-dropdown/dist/es/index.js 16.6 kB
packages/wonder-blocks-form/dist/es/index.js 4.94 kB
packages/wonder-blocks-grid/dist/es/index.js 1.24 kB
packages/wonder-blocks-icon-button/dist/es/index.js 3.05 kB
packages/wonder-blocks-icon/dist/es/index.js 2.02 kB
packages/wonder-blocks-labeled-field/dist/es/index.js 2.92 kB
packages/wonder-blocks-layout/dist/es/index.js 1.63 kB
packages/wonder-blocks-link/dist/es/index.js 1.64 kB
packages/wonder-blocks-pill/dist/es/index.js 1.31 kB
packages/wonder-blocks-popover/dist/es/index.js 4.32 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.48 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.09 kB
packages/wonder-blocks-styles/dist/es/index.js 467 B
packages/wonder-blocks-switch/dist/es/index.js 1.55 kB
packages/wonder-blocks-tabs/dist/es/index.js 3.67 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.51 kB
packages/wonder-blocks-testing/dist/es/index.js 985 B
packages/wonder-blocks-theming/dist/es/index.js 577 B
packages/wonder-blocks-timing/dist/es/index.js 1.37 kB
packages/wonder-blocks-tokens/dist/es/index.js 4.84 kB
packages/wonder-blocks-toolbar/dist/es/index.js 900 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.42 kB
packages/wonder-blocks-typography/dist/es/index.js 1.55 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented Jun 20, 2025

A new build was pushed to Chromatic! 🚀

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

Chromatic results:

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

@jandrade jandrade marked this pull request as ready for review June 20, 2025 20:50
@khan-actions-bot khan-actions-bot requested a review from a team June 20, 2025 20:50
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Jun 20, 2025

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .changeset/forty-zebras-yell.md, .changeset/gold-yaks-grab.md, .storybook/preview.tsx, __docs__/wonder-blocks-modal/modal-dialog.stories.tsx, __docs__/wonder-blocks-modal/modal-footer.stories.tsx, __docs__/wonder-blocks-modal/modal-header.stories.tsx, __docs__/wonder-blocks-modal/modal-launcher.stories.tsx, __docs__/wonder-blocks-modal/modal-panel.stories.tsx, __docs__/wonder-blocks-modal/one-pane-dialog.stories.tsx, packages/wonder-blocks-modal/src/components/close-button.tsx, packages/wonder-blocks-modal/src/components/modal-content.tsx, packages/wonder-blocks-modal/src/components/modal-dialog.tsx, packages/wonder-blocks-modal/src/components/modal-footer.tsx, packages/wonder-blocks-modal/src/components/modal-header.tsx, packages/wonder-blocks-modal/src/components/modal-panel.tsx, packages/wonder-blocks-modal/src/components/one-pane-dialog.tsx, packages/wonder-blocks-modal/src/theme/default.ts, packages/wonder-blocks-modal/src/theme/thunderblocks.ts, packages/wonder-blocks-tokens/src/theme/semantic/semantic-color-thunderblocks.ts

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 Jun 20, 2025

npm Snapshot: Published

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

You can install the packages in frontend by running:

./dev/tools/deploy_wonder_blocks.js --tag="PR2678"

Packages can also be installed manually by running:

pnpm add @khanacademy/wonder-blocks-<package-name>@PR2678

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.

Left some questions in Chromatic and in the PR! 😄

@@ -132,6 +133,13 @@ const withThemeSwitcher: Decorator = (
Story,
{globals: {theme}, parameters: {enableRenderStateRootDecorator}},
) => {
React.useEffect(() => {
if (theme) {
Copy link
Member

Choose a reason for hiding this comment

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

Will we be removing the ThemeSwitcher related things later on? The components that were for the original theming mechanism!

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so. We'll need it just in case someone needs to override the theme down in the tree for any reason.

@@ -119,6 +119,7 @@ const core = {
},
shadow: {
transparent: transparent,
instructive: `color-mix(in srgb, ${color.blue_10} 20%, ${transparent})`,
Copy link
Member

Choose a reason for hiding this comment

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

Will this token also be added in Figma? The color tokens in the handshake file doesn't include this token! Though it seems the transparent token for TB has a blueish tint?

https://www.figma.com/design/e9qdyiDUBZ3rDabP9S7ulO/%E2%9A%A1%EF%B8%8F-Handshake?node-id=3040-15249&m=dev

Copy link
Member Author

Choose a reason for hiding this comment

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

oh good catch! turns out that I was using the incorrect tokens and incorrect values. I fixed that by moving it to core.shadow.transparent, and using the correct value in the modal component-level dialog.shadow.default token. It should now match the designs as expected. Let me know what you think.

jandrade added a commit that referenced this pull request Jun 24, 2025
## Summary:

- Removes the `khanmigo` theme from modal in favor of CSS vars.
- Uses `sizing` instead of `spacing`.

### Implementation plan

1. #2676
2. #2677
3. #2678

Issue: https://khanacademy.atlassian.net/browse/WB-1867

## Test plan:

Navigate to the Modal stories in Storybook and ensure that the modals render
correctly.

Author: jandrade

Reviewers: jandrade, beaesguerra

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ 39 checks were successful, ⏭️  5 checks have been skipped

Pull Request URL: #2676
@khan-actions-bot khan-actions-bot requested a review from a team June 24, 2025 11:26
jandrade added a commit that referenced this pull request Jun 24, 2025
## Summary:

Removes the `light` prop from modal as it is no longer needed.

### Implementation plan

1. #2676
2. #2677
3. #2678

Issue: https://khanacademy.atlassian.net/browse/WB-1867

## Test plan:

Navigate to the Modal stories in Storybook and ensure that the modals render
correctly.

Verify that the "Dark" stories are no longer present in the docs.

Author: jandrade

Reviewers: beaesguerra, jandrade

Required Reviewers:

Approved By: beaesguerra

Checks: ✅ 12 checks were successful, ⏭️  2 checks have been skipped

Pull Request URL: #2677
Base automatically changed from rm-modal-light to main June 24, 2025 12:07
@jandrade jandrade requested a review from beaesguerra June 24, 2025 14:57
Copy link
Member

@marcysutton marcysutton 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 to me!

<Heading size="xxlarge" id="modal-title-0">
Modal Title
</Heading>
<BodyText id="modal-desc-0">
Copy link
Member

Choose a reason for hiding this comment

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

Such a clean switchover! Love to see it!

<br />
<Body>
</BodyText>
<BodyText>
Copy link
Member

Choose a reason for hiding this comment

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

Should we add any margins or a gap here to replace the <br /> tags?

Copy link
Member Author

Choose a reason for hiding this comment

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

that's being added to the parent container (in all the stories).

@@ -118,7 +118,7 @@ const core = {
},
},
shadow: {
transparent: transparent,
transparent: `color-mix(in srgb, ${color.blue_10} 20%, ${transparent})`,
Copy link
Member

Choose a reason for hiding this comment

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

What does this line do? Could you add a comment?

Copy link
Member

Choose a reason for hiding this comment

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

+1! I'm still not sure when we should use color utilities in code 😄

I see in Figma it's set to #252368 20%, though color.blue_10 is #363498

image

Copy link
Member Author

Choose a reason for hiding this comment

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

ohhh it should be color_blue_05 instead.

color-mix is the official CSS way of generating alpha colors. I couldn't use the WB fade() function as it doesn't work with CSS variables (same happens when concatenating WB tokens with the alpha channel).

BEFORE:

const fadedBlue20 = fade(color.blue, 0.2) // e.g. fade(#00f, 0.2) = rgba(0, 0, 255, 0.2)

This doesn't work anymore because the semantic color variable gets converted to a reference to a CSS variable, so we have to use CSS functions as a workaround.

I'll add a note there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment explaining 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.

Thanks for making these updates! Left some questions in Chromatic around letting custom styles override the default title styles!

"@khanacademy/wonder-blocks-tokens": minor
---

Add core.shadow token. Export modal tokens.
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to update the changeset since we don't add a new shadow token anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was to make sure that I would include the CSS vars generated for WB Modal for all the 3 stacked PRs. But turns out that I didn't land this last PR with the other two, so I messed up the release (and probably this is not needed anymore).

Copy link
Member

Choose a reason for hiding this comment

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

If we keep the changeset, could we remove the Add core.shadow token part since we no longer add the instructive shadow token?

@@ -118,7 +118,7 @@ const core = {
},
},
shadow: {
transparent: transparent,
transparent: `color-mix(in srgb, ${color.blue_10} 20%, ${transparent})`,
Copy link
Member

Choose a reason for hiding this comment

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

+1! I'm still not sure when we should use color utilities in code 😄

I see in Figma it's set to #252368 20%, though color.blue_10 is #363498

image

@jandrade jandrade requested a review from beaesguerra June 25, 2025 21:37
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, nice work!

"@khanacademy/wonder-blocks-tokens": minor
---

Add core.shadow token. Export modal tokens.
Copy link
Member

Choose a reason for hiding this comment

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

If we keep the changeset, could we remove the Add core.shadow token part since we no longer add the instructive shadow token?

@jandrade jandrade merged commit e457d8c into main Jun 26, 2025
14 checks passed
@jandrade jandrade deleted the tb-modal branch June 26, 2025 21:16
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@88072cd). Learn more about missing BASE report.
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff           @@
##             main   #2678   +/-   ##
======================================
  Coverage        ?       0           
======================================
  Files           ?       0           
  Lines           ?       0           
  Branches        ?       0           
======================================
  Hits            ?       0           
  Misses          ?       0           
  Partials        ?       0           

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 88072cd...e91690b. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants