Skip to content

[WB-1896] Tokens: Add thunderblocks theme to Wonder Blocks #2562

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

jandrade
Copy link
Member

@jandrade jandrade commented Apr 16, 2025

Summary:

Adds the new thunderblocks theme to support the new classroom experience.

This new theme is based on the existing default theme (OG) but it uses its own
primitive colors.

Also added theming support in Chromatic modes, so that the new theme can be
used for visual regression testing. Note that this was only added to the
IconButton snapshots for now to verify that the new theme works as expected.

More changes will come in future PRs to start using all the correct tokens in
all the required components (including sizing, borders, offsets,
typography, etc).

Issue: WB-1896

Test plan:

Verify that the new theme is available in the Storybook via the "Theme" toolbar.

Verify that the component colors change when the theme is switched to
thunderblocks.

/?path=/docs/foundations-using-color--docs&globals=theme:thunderblocks

Screenshot 2025-04-16 at 6 01 45 PM

Also verify that the IconButton snapshots now include the thunderblocks theme.

Screenshot 2025-04-16 at 6 02 29 PM

@jandrade jandrade self-assigned this Apr 16, 2025
Copy link

changeset-bot bot commented Apr 16, 2025

🦋 Changeset detected

Latest commit: 3e9dfeb

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

This PR includes changesets to release 26 packages
Name Type
@khanacademy/wonder-blocks-theming Minor
@khanacademy/wonder-blocks-tokens Minor
@khanacademy/wonder-blocks-button Patch
@khanacademy/wonder-blocks-icon-button Patch
@khanacademy/wonder-blocks-modal Patch
@khanacademy/wonder-blocks-switch Patch
@khanacademy/wonder-blocks-accordion Patch
@khanacademy/wonder-blocks-banner Patch
@khanacademy/wonder-blocks-birthday-picker Patch
@khanacademy/wonder-blocks-breadcrumbs Patch
@khanacademy/wonder-blocks-cell Patch
@khanacademy/wonder-blocks-clickable Patch
@khanacademy/wonder-blocks-dropdown Patch
@khanacademy/wonder-blocks-form Patch
@khanacademy/wonder-blocks-grid 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-popover Patch
@khanacademy/wonder-blocks-progress-spinner Patch
@khanacademy/wonder-blocks-search-field Patch
@khanacademy/wonder-blocks-styles Patch
@khanacademy/wonder-blocks-tabs Patch
@khanacademy/wonder-blocks-toolbar Patch
@khanacademy/wonder-blocks-tooltip 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 Apr 16, 2025

Size Change: 0 B

Total Size: 103 kB

ℹ️ View Unchanged
Filename Size
packages/wonder-blocks-accordion/dist/es/index.js 3.56 kB
packages/wonder-blocks-announcer/dist/es/index.js 2.04 kB
packages/wonder-blocks-banner/dist/es/index.js 1.58 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 2.09 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 886 B
packages/wonder-blocks-button/dist/es/index.js 4.25 kB
packages/wonder-blocks-cell/dist/es/index.js 2.36 kB
packages/wonder-blocks-clickable/dist/es/index.js 3.12 kB
packages/wonder-blocks-core/dist/es/index.js 2.85 kB
packages/wonder-blocks-data/dist/es/index.js 6.25 kB
packages/wonder-blocks-dropdown/dist/es/index.js 19.7 kB
packages/wonder-blocks-form/dist/es/index.js 6.03 kB
packages/wonder-blocks-grid/dist/es/index.js 1.36 kB
packages/wonder-blocks-icon-button/dist/es/index.js 2.27 kB
packages/wonder-blocks-icon/dist/es/index.js 873 B
packages/wonder-blocks-labeled-field/dist/es/index.js 1.26 kB
packages/wonder-blocks-layout/dist/es/index.js 1.82 kB
packages/wonder-blocks-link/dist/es/index.js 1.98 kB
packages/wonder-blocks-modal/dist/es/index.js 5.48 kB
packages/wonder-blocks-pill/dist/es/index.js 1.54 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-styles/dist/es/index.js 468 B
packages/wonder-blocks-switch/dist/es/index.js 1.9 kB
packages/wonder-blocks-tabs/dist/es/index.js 1.93 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.96 kB
packages/wonder-blocks-testing/dist/es/index.js 1.07 kB
packages/wonder-blocks-theming/dist/es/index.js 779 B
packages/wonder-blocks-timing/dist/es/index.js 1.79 kB
packages/wonder-blocks-tokens/dist/es/index.js 3.06 kB
packages/wonder-blocks-toolbar/dist/es/index.js 923 B
packages/wonder-blocks-tooltip/dist/es/index.js 7.02 kB
packages/wonder-blocks-typography/dist/es/index.js 1.23 kB

compressed-size-action

@jandrade jandrade changed the title [WB-1896] Tokens: Add thunderblocks theme to Wonder Blocks. [WB-1896] Tokens: Add thunderblocks theme to Wonder Blocks Apr 16, 2025
@jandrade jandrade marked this pull request as ready for review April 16, 2025 22:03
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Apr 16, 2025

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to package.json, pnpm-lock.yaml, vitest.config.ts, .changeset/flat-tables-grin.md, .storybook/modes.ts, .storybook/preview.tsx, __docs__/wonder-blocks-icon-button/icon-button-testing-snapshots.stories.tsx, packages/wonder-blocks-theming/src/types.ts, packages/wonder-blocks-tokens/src/theme/thunderblocks.ts, packages/wonder-blocks-tokens/src/theme/semantic/semantic-color-thunderblocks.ts, packages/wonder-blocks-tokens/src/theme/semantic/internal/primitive-color-thunderblocks.ts

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

@khan-actions-bot khan-actions-bot requested a review from a team April 16, 2025 22:04
Copy link
Contributor

github-actions bot commented Apr 16, 2025

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (4c87148) 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="PR2562"

Packages can also be installed manually by running:

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

Comment on lines 104 to 126
// Black
black_100: black,
black_90: fade(black, 0.9),
black_80: fade(black, 0.8),
black_70: fade(black, 0.7),
black_60: fade(black, 0.6),
black_50: fade(black, 0.5),
black_40: fade(black, 0.4),
black_30: fade(black, 0.3),
black_20: fade(black, 0.2),
black_10: fade(black, 0.1),
// White
white_100: white,
white_90: fade(white, 0.9),
white_80: fade(white, 0.8),
white_70: fade(white, 0.7),
white_60: fade(white, 0.6),
white_50: fade(white, 0.5),
white_40: fade(white, 0.4),
white_30: fade(white, 0.3),
white_20: fade(white, 0.2),
white_10: fade(white, 0.1),
white_01: fade(white, 0.01),
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: This might change based on a convo with Caitlyn.

Copy link
Contributor

github-actions bot commented Apr 17, 2025

A new build was pushed to Chromatic! 🚀

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

Chromatic results:

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

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.

This looks good to me! It's a big piece I was missing for typography theming.

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 great! So exciting to see the theme colors get updated when we toggle the theme 😄

{
value: "thunderblocks",
icon: "lightning",
title: "Thunder Blocks (Classroom)",
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 also want to include OG in the title for the default theme? In case others are referring to the default theme as OG!

import {fade} from "../../../util/utils";

// Base colors
const black = "#191918";
Copy link
Member

Choose a reason for hiding this comment

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

My one thought on working through some font theming is: should the default theme be put into these theme folders to keep similar objects near each other in the codebase? I think it could help reduce some cognitive complexity for theming.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great question! My main reasoning for not putting the default color primitives was because those tokens are public (TB primitive colors are not). I left color.ts and spacing.ts inside the tokens package as the goal is to mark them as deprecated at some point in the future (or OG colors are going to be marked as internal at some point).

OG colors are public mostly for historic reasons (we didn't use semanticColor tokens before), and the overall goal is to make these colors private at some point, but I'm not fully sure if we are going to be able to do it. That will happen for sure after completing Polaris and doing all the cleanup work from legacy UIs that won't be used by the Classic Experience anymore (aka things that are deprecated from ka.org and moved to Polaris).... same applies with Spacing -> Sizing.

That said, if you think that it is better to move OG colors to the theme folder, then I can do it without any problem :) (at the end, it is an internal thing, and the public export remains the same).

wdyt?

Base automatically changed from feature/css-vars to main April 22, 2025 14:48
@marcysutton
Copy link
Member

@jandrade FYI I think this one might need to be updated with main to get the latest changes for color-utils!

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