4
4
Box ,
5
5
chakra ,
6
6
ChakraProps ,
7
- Circle ,
8
7
HStack ,
9
8
Stack ,
10
9
Text ,
@@ -22,6 +21,8 @@ import type {
22
21
TranslationKey ,
23
22
} from "@/lib/types"
24
23
24
+ import { cn } from "@/lib/utils/cn"
25
+
25
26
import type { AnswerStatus } from "./useQuizWidget"
26
27
27
28
type QuizRadioGroupProps = {
@@ -157,11 +158,6 @@ const CustomRadio = ({
157
158
const getAnswerColor = ( ) : ChakraProps [ "bg" ] =>
158
159
isSelectedCorrect ? "success.base" : "error.base"
159
160
160
- const controlFocusProps : ChakraProps = {
161
- bg : isAnswerVisible ? "white" : "primary.pressed" ,
162
- color : isAnswerVisible ? getAnswerColor ( ) : undefined ,
163
- }
164
-
165
161
const radioInputProps = getInputProps ( { id : INPUT_ID } )
166
162
167
163
return (
@@ -188,22 +184,24 @@ const CustomRadio = ({
188
184
outline : isAnswerVisible ? "none" : `1px solid ${ primaryBaseColor } ` ,
189
185
} }
190
186
_checked = { {
191
- bg : ! isAnswerVisible ? "primary.base " : getAnswerColor ( ) ,
187
+ bg : ! isAnswerVisible ? "primary.action " : getAnswerColor ( ) ,
192
188
color : "white" ,
193
189
} }
194
190
data-group
191
+ className = "group"
195
192
>
196
- < Circle
197
- size = "6"
198
- bg = "disabled"
199
- color = "white"
200
- _groupHover = { controlFocusProps }
201
- _groupChecked = { controlFocusProps }
193
+ < div
194
+ className = { cn (
195
+ "grid aspect-square size-6 place-items-center rounded-full bg-disabled text-white group-hover:bg-primary-action" ,
196
+ "group-data-[checked]:bg-white group-data-[checked]:text-primary-action" ,
197
+ isAnswerVisible &&
198
+ ( isSelectedCorrect ? "!text-success" : "!text-error" )
199
+ ) }
202
200
>
203
- < Text fontWeight = "700" fontSize = "lg" lineHeight = " none">
201
+ < p className = "text-lg font-bold leading- none">
204
202
{ String . fromCharCode ( 97 + index ) . toUpperCase ( ) }
205
- </ Text >
206
- </ Circle >
203
+ </ p >
204
+ </ div >
207
205
< span > { label } </ span >
208
206
</ HStack >
209
207
</ chakra . label >
0 commit comments