Skip to content

Commit 590f5d9

Browse files
committed
fix: QuizRadioGroup colors
partial tailwind migration to fix colors
1 parent e4d547f commit 590f5d9

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/components/Quiz/QuizWidget/QuizRadioGroup.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
Box,
55
chakra,
66
ChakraProps,
7-
Circle,
87
HStack,
98
Stack,
109
Text,
@@ -22,6 +21,8 @@ import type {
2221
TranslationKey,
2322
} from "@/lib/types"
2423

24+
import { cn } from "@/lib/utils/cn"
25+
2526
import type { AnswerStatus } from "./useQuizWidget"
2627

2728
type QuizRadioGroupProps = {
@@ -157,11 +158,6 @@ const CustomRadio = ({
157158
const getAnswerColor = (): ChakraProps["bg"] =>
158159
isSelectedCorrect ? "success.base" : "error.base"
159160

160-
const controlFocusProps: ChakraProps = {
161-
bg: isAnswerVisible ? "white" : "primary.pressed",
162-
color: isAnswerVisible ? getAnswerColor() : undefined,
163-
}
164-
165161
const radioInputProps = getInputProps({ id: INPUT_ID })
166162

167163
return (
@@ -188,22 +184,24 @@ const CustomRadio = ({
188184
outline: isAnswerVisible ? "none" : `1px solid ${primaryBaseColor}`,
189185
}}
190186
_checked={{
191-
bg: !isAnswerVisible ? "primary.base" : getAnswerColor(),
187+
bg: !isAnswerVisible ? "primary.action" : getAnswerColor(),
192188
color: "white",
193189
}}
194190
data-group
191+
className="group"
195192
>
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+
)}
202200
>
203-
<Text fontWeight="700" fontSize="lg" lineHeight="none">
201+
<p className="text-lg font-bold leading-none">
204202
{String.fromCharCode(97 + index).toUpperCase()}
205-
</Text>
206-
</Circle>
203+
</p>
204+
</div>
207205
<span>{label}</span>
208206
</HStack>
209207
</chakra.label>

0 commit comments

Comments
 (0)