Skip to content

[ColorSync] Convert label-image widget to CSS Modules#3444

Draft
Myranae wants to merge 10 commits intotb/testing-font-color-conversionfrom
tb/stacked-css-module-conversion
Draft

[ColorSync] Convert label-image widget to CSS Modules#3444
Myranae wants to merge 10 commits intotb/testing-font-color-conversionfrom
tb/stacked-css-module-conversion

Conversation

@Myranae
Copy link
Copy Markdown
Contributor

@Myranae Myranae commented Apr 1, 2026

Summary:

Converts the label-image widget's Aphrodite styles to CSS modules as part of the ongoing CSS module migration. This is a pure refactor with no intended visual or behavioral changes.

Issue: LEMS-4028

Test plan:

  • Chromatic snapshots show zero or near-zero diff against main
  • All checks pass

@Myranae Myranae self-assigned this Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

Size Change: -75 B (-0.02%)

Total Size: 495 kB

Filename Size Change
packages/perseus/dist/es/index.js 193 kB -75 B (-0.04%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.5 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 6.21 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 11.9 kB
packages/perseus-core/dist/es/index.js 25.1 kB
packages/perseus-editor/dist/es/index.js 101 kB
packages/perseus-linter/dist/es/index.js 9.3 kB
packages/perseus-score/dist/es/index.js 9.66 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/strings.js 8.09 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

🛠️ Item Splitting: No Changes ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (ff8580e) and published it to npm. You
can install it using the tag PR3444.

Example:

pnpm add @khanacademy/perseus@PR3444

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3444

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -t PR3444

@Myranae Myranae force-pushed the tb/stacked-css-module-conversion branch from db2383e to 8ddabc2 Compare April 1, 2026 17:38

import {usePerseusI18n} from "../../components/i18n-context";

import styles from "./hide-answers-toggle.module.css";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This import should be pulling in the styles object from hide-answers-toggle_legacy-styles.js file, since we are using Wonder Blocks <View> component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated and added to instructions :)


const Wrapper = (props) => (
<div className={css(styles.wrapper)}>
<div className={styles.wrapper}>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm inclined to make this a set of inline styles. I'm not sure what the purpose of this wrapper is, but since it is just used here in this story file, there is no need to make a CSS file for it. I recommend:

<div style={{position: "relative", height: "32px", width: "32px"}}>
    <Marker {...props} />
</div>


.instructions-caption {
font-family: inherit;
font-size: 15px;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My latest script update changes he px values to rem values. Recommending that this (and line-height be changed to their rem equivalent.

@@ -0,0 +1,37 @@
// TODO (LEMS-3815): Remove this file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since we aren't using this file in the associated label-image.tsx file, we can delete this file. We only need these legacy files if we need to pass style objects to Wonder Blocks components. Since label-image.tsx is passing in a "calculated" object (based upon the marker property), there is no need to move it to a file like this one. We can refactor how the styling for the markers is done when we get to the CSS optimization phase.

@mark-fitzgerald
Copy link
Copy Markdown
Contributor

Something is off about these regression snapshots. That will take a bit more investigation.

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.

3 participants