Skip to content

Commit e7ab897

Browse files
committed
update QuizRadioGroup component layout and spacing
1 parent 4b71e5a commit e7ab897

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

src/components/Quiz/QuizWidget/QuizRadioGroup.tsx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const QuizRadioGroup = () => {
6161
<Box as="fieldset" w="full" {...getRootProps()}>
6262
<Text
6363
as="legend"
64-
textAlign={{ base: "center", md: "start" }}
64+
textAlign="center"
6565
fontWeight="700"
6666
size="2xl"
6767
w="full"
@@ -73,32 +73,34 @@ export const QuizRadioGroup = () => {
7373
{t(prompt)}
7474
</Text>
7575

76-
<Stack spacing="4">
77-
{answers.map(({ id, label }, idx) => {
78-
const display =
79-
!answerStatus || id === selectedAnswer ? "inline-flex" : "none"
80-
81-
return (
82-
<Box key={id} display={display}>
83-
<CustomRadio
84-
label={t(label)}
85-
isAnswerVisible={!!answerStatus}
86-
isSelectedCorrect={isSelectedCorrect}
87-
index={idx}
88-
{...getRadioProps({ value: id })}
89-
/>
90-
</Box>
91-
)
92-
})}
93-
</Stack>
94-
95-
{!!answerStatus && (
96-
<Stack spacing="2" mt="6">
97-
<Text fontWeight="bold">{t("explanation")}</Text>
98-
99-
<Text m={0}>{t(explanation)}</Text>
76+
<Box px={{ base: "0", md: "12", lg: "16" }}>
77+
<Stack spacing="4">
78+
{answers.map(({ id, label }, idx) => {
79+
const display =
80+
!answerStatus || id === selectedAnswer ? "inline-flex" : "none"
81+
82+
return (
83+
<Box key={id} display={display}>
84+
<CustomRadio
85+
label={t(label)}
86+
isAnswerVisible={!!answerStatus}
87+
isSelectedCorrect={isSelectedCorrect}
88+
index={idx}
89+
{...getRadioProps({ value: id })}
90+
/>
91+
</Box>
92+
)
93+
})}
10094
</Stack>
101-
)}
95+
96+
{!!answerStatus && (
97+
<Stack spacing="2" mt="6">
98+
<Text fontWeight="bold">{t("explanation")}</Text>
99+
100+
<Text m={0}>{t(explanation)}</Text>
101+
</Stack>
102+
)}
103+
</Box>
102104
</Box>
103105
)
104106
}

src/components/Quiz/QuizWidget/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const QuizWidget = ({
118118
<Stack
119119
w="full"
120120
gap="8"
121-
px={{ base: "8", md: "12", lg: "16" }}
121+
px={isStandaloneQuiz ? "4" : "0"}
122122
// Reduce padding when showing Spinner
123123
pt={!quizData ? "10" : { base: "5", md: "12" }}
124124
pb={!quizData ? "5" : { base: "4", md: "8" }}

0 commit comments

Comments
 (0)