@@ -4,6 +4,7 @@ import FlagIcon from '../assets/flag';
4
4
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' ;
5
5
import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck' ;
6
6
import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark' ;
7
+ import { faCircle } from '@fortawesome/free-solid-svg-icons/faCircle' ;
7
8
import { faQuestion } from '@fortawesome/free-solid-svg-icons' ;
8
9
9
10
const ProgressBarWrapper = styled . nav `
@@ -44,10 +45,14 @@ const handleVariant = (variant: ProgressBarItemVariant) => {
44
45
color : ${ colors . answer . incorrect } ;
45
46
background-color : # F8E8EA ;
46
47
` ;
47
- default :
48
+ case 'isIncomplete' :
48
49
return css `
49
50
background-color : ${ colors . palette . neutralBright } ;
50
51
` ;
52
+ default :
53
+ return css `
54
+ background-color : ${ colors . palette . neutralLight } ;
55
+ ` ;
51
56
}
52
57
} ;
53
58
@@ -80,8 +85,7 @@ export const StyledItem = styled.button<{ variant: ProgressBarItemVariant, isAct
80
85
` ;
81
86
82
87
const StyledFontAwesomeIcon = styled ( FontAwesomeIcon ) `
83
- background: ${ props => props . color } ;
84
- color: #fff;
88
+ color: ${ props => props . color } ;
85
89
position: absolute;
86
90
bottom: 0.4rem;
87
91
right: 0.3rem;
@@ -93,31 +97,43 @@ const StyledFontAwesomeIcon = styled(FontAwesomeIcon)`
93
97
` ;
94
98
95
99
const ItemIcon = ( { variant } : { variant : ProgressBarItemVariant } ) => {
96
- if ( ! variant || variant !== 'isCorrect' && variant !== 'isIncorrect' && variant !== 'isIncomplete ') {
100
+ if ( variant === 'isStatus ') {
97
101
return null ;
98
102
}
99
103
100
104
const variantData = {
101
105
isCorrect : {
102
106
icon : faCheck ,
103
- color : colors . answer . correct ,
107
+ background : colors . answer . correct ,
108
+ color : colors . palette . white ,
104
109
label : 'Correct' ,
105
110
} ,
106
111
isIncorrect : {
107
112
icon : faXmark ,
108
- color : colors . answer . incorrect ,
113
+ background : colors . answer . incorrect ,
114
+ color : colors . palette . white ,
109
115
label : 'Incorrect' ,
110
116
} ,
111
117
isIncomplete : {
112
118
icon : faQuestion ,
113
- color : colors . answer . neutral ,
119
+ background : colors . answer . neutral ,
120
+ color : colors . palette . white ,
114
121
label : 'Incomplete'
122
+ } ,
123
+ null : {
124
+ icon : faCircle ,
125
+ background : colors . answer . neutral ,
126
+ color : colors . answer . neutralDark ,
127
+ label : 'No feedback'
115
128
}
116
- } [ variant ] ;
129
+ } [ String ( variant ) ] ;
130
+
131
+ if ( ! variantData ) return null ;
117
132
118
133
return < StyledFontAwesomeIcon
119
134
icon = { variantData . icon }
120
135
color = { variantData . color }
136
+ style = { { background : variantData . background } } // for the icon background of noFeedback
121
137
height = '16px'
122
138
width = '16px'
123
139
aria-label = { variantData . label }
0 commit comments