From d6f4159cc2fdf5e225552e1a933aebeeff65eb2a Mon Sep 17 00:00:00 2001 From: Juan Andrade Date: Tue, 28 Jan 2025 21:44:14 -0500 Subject: [PATCH 1/3] [semantic-p3] docs(changeset): Replace `color` with `semanticColor` tokens --- .changeset/gorgeous-adults-lay.md | 7 +++ .../components/accordion-section-header.tsx | 55 ++++++------------- .../src/components/accordion-section.tsx | 38 +++++++------ .../src/components/banner.tsx | 16 +++--- .../src/components/birthday-picker.tsx | 12 +++- 5 files changed, 60 insertions(+), 68 deletions(-) create mode 100644 .changeset/gorgeous-adults-lay.md diff --git a/.changeset/gorgeous-adults-lay.md b/.changeset/gorgeous-adults-lay.md new file mode 100644 index 0000000000..aa61f00516 --- /dev/null +++ b/.changeset/gorgeous-adults-lay.md @@ -0,0 +1,7 @@ +--- +"@khanacademy/wonder-blocks-birthday-picker": patch +"@khanacademy/wonder-blocks-accordion": patch +"@khanacademy/wonder-blocks-banner": patch +--- + +Replace `color` with `semanticColor` tokens diff --git a/packages/wonder-blocks-accordion/src/components/accordion-section-header.tsx b/packages/wonder-blocks-accordion/src/components/accordion-section-header.tsx index 4c07ab9dcf..bed43b6e85 100644 --- a/packages/wonder-blocks-accordion/src/components/accordion-section-header.tsx +++ b/packages/wonder-blocks-accordion/src/components/accordion-section-header.tsx @@ -6,7 +6,7 @@ import Clickable from "@khanacademy/wonder-blocks-clickable"; import {View} from "@khanacademy/wonder-blocks-core"; import {PhosphorIcon} from "@khanacademy/wonder-blocks-icon"; import {HeadingSmall} from "@khanacademy/wonder-blocks-typography"; -import * as tokens from "@khanacademy/wonder-blocks-tokens"; +import {spacing, semanticColor} from "@khanacademy/wonder-blocks-tokens"; import type {StyleType} from "@khanacademy/wonder-blocks-core"; import type {AccordionCornerKindType} from "./accordion"; @@ -125,7 +125,7 @@ const AccordionSectionHeader = React.forwardRef(function AccordionSectionHeader( {collapsible && ( { switch (kind) { case "success": return { - color: color.green, + color: semanticColor.status.success.foreground, icon: successIcon, role: "status", }; case "warning": return { - color: color.gold, + color: semanticColor.status.warning.foreground, icon: warningIcon, role: "alert", ariaLive: "polite", }; case "critical": return { - color: color.red, + color: semanticColor.status.critical.foreground, icon: criticalIcon, role: "alert", }; default: return { - color: color.blue, + color: semanticColor.status.notice.foreground, icon: infoIcon, role: "status", }; @@ -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, }, containerInner: { flexDirection: "row", @@ -328,7 +328,7 @@ const styles = StyleSheet.create({ marginInlineStart: spacing.xxxxSmall_2, marginInlineEnd: spacing.xSmall_8, alignSelf: "flex-start", - color: color.offBlack64, + color: semanticColor.icon.primary, }, labelAndButtonsContainer: { flex: 1, @@ -359,7 +359,7 @@ const styles = StyleSheet.create({ justifyContent: "center", }, link: { - fontSize: 14, + fontSize: font.size.small, }, dismiss: { flexShrink: 1, diff --git a/packages/wonder-blocks-birthday-picker/src/components/birthday-picker.tsx b/packages/wonder-blocks-birthday-picker/src/components/birthday-picker.tsx index a53f6f8d0e..aeab09e0fa 100644 --- a/packages/wonder-blocks-birthday-picker/src/components/birthday-picker.tsx +++ b/packages/wonder-blocks-birthday-picker/src/components/birthday-picker.tsx @@ -3,7 +3,7 @@ import * as React from "react"; import {StyleSheet} from "aphrodite"; import {StyleType, View} from "@khanacademy/wonder-blocks-core"; import {Strut} from "@khanacademy/wonder-blocks-layout"; -import {color, spacing} from "@khanacademy/wonder-blocks-tokens"; +import {semanticColor, spacing} from "@khanacademy/wonder-blocks-tokens"; import {Body} from "@khanacademy/wonder-blocks-typography"; import {PhosphorIcon} from "@khanacademy/wonder-blocks-icon"; import {SingleSelect, OptionItem} from "@khanacademy/wonder-blocks-dropdown"; @@ -284,11 +284,17 @@ export default class BirthdayPicker extends React.Component {