Skip to content

Commit

Permalink
wip: fixup icons, add correct state
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole Watts committed Nov 14, 2023
1 parent f262fbb commit 02ce9b2
Showing 1 changed file with 15 additions and 28 deletions.
43 changes: 15 additions & 28 deletions packages/perseus/src/widgets/label-image/marker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
*/

import Color from "@khanacademy/wonder-blocks-color";
import {PhosphorIcon} from "@khanacademy/wonder-blocks-icon";
import caretUpIcon from "@phosphor-icons/core/bold/caret-up-bold.svg";
import {StyleSheet, css} from "aphrodite";
import * as React from "react";

import Icon from "../../components/icon";
import {iconCheck, iconMinus} from "../../icon-paths";
import {iconCheck, iconChevronDown, iconMinus} from "../../icon-paths";

import type {InteractiveMarkerType} from "./types";

Expand Down Expand Up @@ -81,11 +79,13 @@ export default class Marker extends React.Component<Props, State> {

if (showCorrectness === "correct") {
iconStyles = [
styles.markerGraded,

Check warning on line 82 in packages/perseus/src/widgets/label-image/marker.tsx

View check run for this annotation

Codecov / codecov/patch

packages/perseus/src/widgets/label-image/marker.tsx#L82

Added line #L82 was not covered by tests
styles.markerCorrect,
isSelected && styles.markerSelected,

Check warning on line 84 in packages/perseus/src/widgets/label-image/marker.tsx

View check run for this annotation

Codecov / codecov/patch

packages/perseus/src/widgets/label-image/marker.tsx#L84

Added line #L84 was not covered by tests
];
} else {
iconStyles = [
styles.markerGraded,

Check warning on line 88 in packages/perseus/src/widgets/label-image/marker.tsx

View check run for this annotation

Codecov / codecov/patch

packages/perseus/src/widgets/label-image/marker.tsx#L88

Added line #L88 was not covered by tests
styles.markerIncorrect,
isSelected && styles.markerSelected,

Check warning on line 90 in packages/perseus/src/widgets/label-image/marker.tsx

View check run for this annotation

Codecov / codecov/patch

packages/perseus/src/widgets/label-image/marker.tsx#L90

Added line #L90 was not covered by tests
];
Expand All @@ -108,13 +108,9 @@ export default class Marker extends React.Component<Props, State> {
];
}

if (isSelected) {
if (isSelected && selected && selected.length === 0) {
innerIcon = (
<PhosphorIcon
icon={caretUpIcon}
size="small"
color={Color.white}
/>
<Icon icon={iconChevronDown} size={8} color={Color.white} />
);
}

Check warning on line 115 in packages/perseus/src/widgets/label-image/marker.tsx

View check run for this annotation

Codecov / codecov/patch

packages/perseus/src/widgets/label-image/marker.tsx#L112-L115

Added lines #L112 - L115 were not covered by tests

Expand Down Expand Up @@ -161,8 +157,6 @@ export default class Marker extends React.Component<Props, State> {
}
}

const correctColor = "#00a60e";
const incorrectColor = "#909195";
const lightShadowColor = "rgba(33, 36, 44, 0.16)";

const markerSize = 20;
Expand Down Expand Up @@ -251,6 +245,7 @@ const styles = StyleSheet.create({
border: `solid 4px ${Color.white}`,
backgroundColor: Color.blue,
borderRadius: markerSize,
transform: "rotate(180deg)",

":hover": {
outline: `2px solid ${Color.blue}`,
Expand All @@ -273,31 +268,23 @@ const styles = StyleSheet.create({
boxShadow: `0 1px 1px 0 ${lightShadowColor}`,
},

markerCorrect: {
width: 24,
height: 24,
markerGraded: {
width: markerSize,
height: markerSize,
marginLeft: 1,
marginTop: 1,

justifyContent: "center",
alignItems: "center",
border: `2px solid ${Color.white}`,
boxShadow: `0 8px 8px ${Color.offBlack8}`,
},

background: correctColor,

boxShadow: `0 1px 1px 0 ${lightShadowColor}`,
markerCorrect: {
background: Color.green,
},

markerIncorrect: {
width: 24,
height: 24,
marginLeft: 1,
marginTop: 1,

justifyContent: "center",
alignItems: "center",

background: incorrectColor,

boxShadow: `0 1px 1px 0 ${lightShadowColor}`,
background: Color.offBlack64,
},
});

0 comments on commit 02ce9b2

Please sign in to comment.