Skip to content

Commit 2cbc2e5

Browse files
committed
fix: rtl quiz icon and text positioning
1 parent c198a0d commit 2cbc2e5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/components/Quiz/QuizWidget/QuizRadioGroup.tsx

Lines changed: 1 addition & 1 deletion
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: "left" }}
64+
textAlign={{ base: "center", md: "start" }}
6565
fontWeight="700"
6666
size="2xl"
6767
w="full"

src/components/Quiz/QuizWidget/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Dispatch, SetStateAction, useEffect, useRef } from "react"
22
import {
3+
calc,
34
Center,
45
Heading,
56
Spinner,
@@ -24,6 +25,8 @@ import { QuizRadioGroup } from "./QuizRadioGroup"
2425
import { QuizSummary } from "./QuizSummary"
2526
import { useQuizWidget } from "./useQuizWidget"
2627

28+
import { useRtlFlip } from "@/hooks/useRtlFlip"
29+
2730
type CommonProps = {
2831
quizKey: string
2932
updateUserStats: Dispatch<SetStateAction<UserStats>>
@@ -69,6 +72,8 @@ const QuizWidget = ({
6972
setCurrentQuestionAnswerChoice,
7073
} = useQuizWidget({ quizKey, updateUserStats })
7174

75+
const { isRtl } = useRtlFlip()
76+
7277
const quizPageProps = useRef<
7378
| (Required<Pick<QuizWidgetProps, "currentHandler" | "statusHandler">> & {
7479
nextQuiz: string | undefined
@@ -129,7 +134,7 @@ const QuizWidget = ({
129134
top={{ base: 2, md: 0 }}
130135
insetInlineStart={{ md: "50%" }}
131136
transform="auto"
132-
translateX={{ md: "-50%" }}
137+
translateX={{ md: calc.multiply("50%", isRtl ? 1 : -1) }}
133138
translateY={{ md: "-50%" }}
134139
>
135140
<AnswerIcon answerStatus={answerStatus} />

0 commit comments

Comments
 (0)