File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
src/components/Quiz/QuizWidget Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { useCallback } from "react"
2
- import { Text , VStack } from "@chakra-ui/react"
2
+ import { Text , type TextProps , VStack } from "@chakra-ui/react"
3
3
4
4
import { ChildOnlyProp } from "@/lib/types"
5
5
@@ -12,13 +12,20 @@ export const QuizContent = ({ children }: QuizContentProps) => {
12
12
13
13
const getTitleContent = useCallback ( ( ) : string => {
14
14
if ( ! answerStatus ) return title
15
-
16
- return answerStatus === ' correct' ? "Correct!" : "Incorrect"
15
+
16
+ return answerStatus === " correct" ? "Correct!" : "Incorrect"
17
17
} , [ answerStatus , title ] )
18
-
18
+
19
+ const getTitleTextColor = ( ) : TextProps [ "color" ] => {
20
+ if ( ! answerStatus ) return "primary.hover"
21
+ return answerStatus === "correct" ? "success.base" : "fail.base"
22
+ }
23
+
19
24
return (
20
25
< VStack spacing = "4" >
21
- < Text > { getTitleContent ( ) } </ Text >
26
+ < Text fontWeight = "bold" textAlign = "center" color = { getTitleTextColor ( ) } >
27
+ { getTitleContent ( ) }
28
+ </ Text >
22
29
{ children }
23
30
</ VStack >
24
31
)
You can’t perform that action at this time.
0 commit comments