Skip to content

Commit 41087ae

Browse files
authored
CORE-931: new style for no feedback (#95)
* new style for no feedback * replace double quote * resolve comments
1 parent cfbb492 commit 41087ae

File tree

3 files changed

+314
-45
lines changed

3 files changed

+314
-45
lines changed

src/components/ProgressBar.tsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import FlagIcon from '../assets/flag';
44
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
55
import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck';
66
import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark';
7+
import { faCircle } from '@fortawesome/free-solid-svg-icons/faCircle';
78
import { faQuestion } from '@fortawesome/free-solid-svg-icons';
89

910
const ProgressBarWrapper = styled.nav`
@@ -44,10 +45,14 @@ const handleVariant = (variant: ProgressBarItemVariant) => {
4445
color: ${colors.answer.incorrect};
4546
background-color: #F8E8EA;
4647
`;
47-
default:
48+
case 'isIncomplete':
4849
return css`
4950
background-color: ${colors.palette.neutralBright};
5051
`;
52+
default:
53+
return css`
54+
background-color: ${colors.palette.neutralLight};
55+
`;
5156
}
5257
};
5358

@@ -80,8 +85,7 @@ export const StyledItem = styled.button<{ variant: ProgressBarItemVariant, isAct
8085
`;
8186

8287
const StyledFontAwesomeIcon = styled(FontAwesomeIcon)`
83-
background: ${props => props.color};
84-
color: #fff;
88+
color: ${props => props.color};
8589
position: absolute;
8690
bottom: 0.4rem;
8791
right: 0.3rem;
@@ -93,31 +97,43 @@ const StyledFontAwesomeIcon = styled(FontAwesomeIcon)`
9397
`;
9498

9599
const ItemIcon = ({ variant }: { variant: ProgressBarItemVariant }) => {
96-
if (!variant || variant !== 'isCorrect' && variant !== 'isIncorrect' && variant !== 'isIncomplete') {
100+
if (variant === 'isStatus') {
97101
return null;
98102
}
99103

100104
const variantData = {
101105
isCorrect: {
102106
icon: faCheck,
103-
color: colors.answer.correct,
107+
background: colors.answer.correct,
108+
color: colors.palette.white,
104109
label: 'Correct',
105110
},
106111
isIncorrect: {
107112
icon: faXmark,
108-
color: colors.answer.incorrect,
113+
background: colors.answer.incorrect,
114+
color: colors.palette.white,
109115
label: 'Incorrect',
110116
},
111117
isIncomplete: {
112118
icon: faQuestion,
113-
color: colors.answer.neutral,
119+
background: colors.answer.neutral,
120+
color: colors.palette.white,
114121
label: 'Incomplete'
122+
},
123+
null: {
124+
icon: faCircle,
125+
background: colors.answer.neutral,
126+
color: colors.answer.neutralDark,
127+
label: 'No feedback'
115128
}
116-
}[variant];
129+
}[String(variant)];
130+
131+
if (!variantData) return null;
117132

118133
return <StyledFontAwesomeIcon
119134
icon={variantData.icon}
120135
color={variantData.color}
136+
style={{ background: variantData.background }} // for the icon background of noFeedback
121137
height='16px'
122138
width='16px'
123139
aria-label={variantData.label}

0 commit comments

Comments
 (0)