Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cold-plums-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus-editor": patch
---

Updates WB `color` references to use the new `semanticColor` tokens instead.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {color, spacing} from "@khanacademy/wonder-blocks-tokens";
import {semanticColor, spacing} from "@khanacademy/wonder-blocks-tokens";
import * as React from "react";

import DeviceFramer from "../device-framer";
Expand All @@ -17,8 +17,9 @@ const SampleContent = () => {
return (
<div
style={{
backgroundColor: color.blue,
color: color.offWhite,
backgroundColor:
Copy link
Member Author

Choose a reason for hiding this comment

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

semanticColor.core.background.instructive.default,
color: semanticColor.core.foreground.knockout.default,
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: I changed this on purpose as we no longer use offWhite for foreground colors (text/icon color). This also improves color contrast.

https://khanacademy.atlassian.net/wiki/spaces/WB/pages/4049666283/Core#Knockout.1

width: "90%",
height: "300px",
padding: spacing.medium_16,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {ApiOptions} from "@khanacademy/perseus";
import {getDefaultFigureForType} from "@khanacademy/perseus-core";
import {View} from "@khanacademy/wonder-blocks-core";
import {color, spacing} from "@khanacademy/wonder-blocks-tokens";
import {semanticColor, spacing} from "@khanacademy/wonder-blocks-tokens";
import {StyleSheet} from "aphrodite";
import * as React from "react";

Expand Down Expand Up @@ -74,7 +74,7 @@ const styles = StyleSheet.create({
width: containerSize,
padding: padding,
marginInlineStart: spacing.medium_16,
border: `1px solid ${color.offBlack32}`,
border: `1px solid ${semanticColor.core.border.neutral.subtle}`,
borderRadius: spacing.xxxSmall_4,
},
});
17 changes: 13 additions & 4 deletions packages/perseus-editor/src/components/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Reusable checkbox component.
**/
import {color} from "@khanacademy/wonder-blocks-tokens";
import {semanticColor} from "@khanacademy/wonder-blocks-tokens";
import {css, StyleSheet} from "aphrodite";
import * as React from "react";

Expand Down Expand Up @@ -100,8 +100,14 @@ export default class Checkbox extends React.Component<CheckboxProps> {
rx={borderRadius}
/>
<path
fill={color.white}
stroke={color.white}
fill={
semanticColor.core.foreground
.knockout.default
}
stroke={
semanticColor.core.foreground
.knockout.default
}
d="M4.98 7.41a0.58.58 0 1 0-0.81.81L6.47
10.53c0.23.23.59.23.81
0l4.55-4.55a0.58.58 0 0
Expand All @@ -111,7 +117,10 @@ export default class Checkbox extends React.Component<CheckboxProps> {
)}
{!checked && (
<rect
fill={color.white}
fill={
semanticColor.core.foreground
.knockout.default
}
stroke={gray68}
width={size - 2 * padding}
height={size - 2 * padding}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {View} from "@khanacademy/wonder-blocks-core";
import {Strut} from "@khanacademy/wonder-blocks-layout";
import {color as wbColor, spacing} from "@khanacademy/wonder-blocks-tokens";
import {semanticColor, spacing} from "@khanacademy/wonder-blocks-tokens";
import {LabelMedium} from "@khanacademy/wonder-blocks-typography";
import {StyleSheet} from "aphrodite";
import * as React from "react";
Expand Down Expand Up @@ -97,8 +97,8 @@ const styles = StyleSheet.create({
width: spacing.xxxLarge_64,
},
errorField: {
borderColor: wbColor.red,
backgroundColor: wbColor.fadedRed8,
borderColor: semanticColor.core.border.critical.default,
Copy link
Member Author

Choose a reason for hiding this comment

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

backgroundColor: semanticColor.core.background.critical.subtle,
Copy link
Member Author

Choose a reason for hiding this comment

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

},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* If you need to handle `onSubmit`, please use <TextField> directly with your
* own <form> that wraps all text fields in the form.
**/
import {color, color as WBColor} from "@khanacademy/wonder-blocks-tokens";
import {semanticColor} from "@khanacademy/wonder-blocks-tokens";
import {StyleSheet, css} from "aphrodite";
import * as React from "react";

Expand Down Expand Up @@ -150,8 +150,8 @@ class FormWrappedTextField extends React.Component<PropsWithForwardRef, State> {
}

const borderColorStyle = focused
? focusBorderColor || WBColor.blue
: borderColor || WBColor.offBlack16;
? focusBorderColor || semanticColor.focus.outer
Copy link
Member Author

Choose a reason for hiding this comment

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

: borderColor || semanticColor.core.border.neutral.subtle;
extraStyles.border = `1px solid ${borderColorStyle}`;

const wrappedIcon = icon && (
Expand Down Expand Up @@ -234,7 +234,7 @@ const styles = StyleSheet.create({
marginBottom: 0,
},
defaultBackground: {
backgroundColor: color.white,
backgroundColor: semanticColor.core.background.base.default,
},
icon: {
display: "flex",
Expand Down
4 changes: 2 additions & 2 deletions packages/perseus-editor/src/components/heading.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Clickable from "@khanacademy/wonder-blocks-clickable";
import {View} from "@khanacademy/wonder-blocks-core";
import {color, spacing} from "@khanacademy/wonder-blocks-tokens";
import {semanticColor, spacing} from "@khanacademy/wonder-blocks-tokens";
import {LabelLarge} from "@khanacademy/wonder-blocks-typography";
import {StyleSheet} from "aphrodite";
import * as React from "react";
Expand Down Expand Up @@ -49,7 +49,7 @@ const styles = StyleSheet.create({
// match otherwise there's a gap from this header to the edge
// of the editor borders.
marginInline: -10,
backgroundColor: color.offBlack8,
backgroundColor: semanticColor.core.background.neutral.subtle,
padding: spacing.xSmall_8,
width: "calc(100% + 20px)",
},
Expand Down
Loading
Loading