1
1
import classNames from 'classnames' ;
2
2
import React from 'react' ;
3
+ import KatexSpan from './katexSpan' ;
3
4
4
5
export interface OptionProps {
5
6
ref ?: React . Ref < HTMLButtonElement > ;
6
7
index ?: number ;
7
8
showIndex ?: boolean ;
8
- label : string ;
9
+ label : string | JSX . Element ; // Allow label to be string or JSX
9
10
isSelected : boolean ;
10
11
isCorrect : boolean ;
11
12
showSolution : boolean ;
@@ -18,15 +19,15 @@ const Option = React.forwardRef<HTMLButtonElement, OptionProps>(
18
19
ref
19
20
) => {
20
21
const optionClasses = classNames (
21
- 'w-full ps-4 text-gray-900 flex items-center border rounded-lg focus:outline-primaryColor transition-colors duration-300' ,
22
+ 'w-full ps-4 text-gray-900 flex items-center border rounded-lg focus:outline-primary transition-colors duration-300' ,
22
23
{
23
24
'border-gray-200' : ! isSelected && ! showSolution ,
24
25
'cursor-not-allowed' : showSolution ,
25
26
'bg-[#1ad85f]' : showSolution && isCorrect ,
26
27
'border-rose-200 text-red-500' : showSolution && ! isCorrect ,
27
- 'border-primaryColor outline-double outline-primaryColor outline-offset-0 ring-2 ring-offset-0 ring-primary' :
28
+ 'border-primary outline-double outline-primary outline-offset-0 ring-2 ring-offset-0 ring-primary' :
28
29
! showSolution && isSelected ,
29
- 'hover:border-primaryColor focus:border-primaryColor ' : ! showSolution ,
30
+ 'hover:border-primary focus:border-primary ' : ! showSolution ,
30
31
}
31
32
) ;
32
33
@@ -51,7 +52,9 @@ const Option = React.forwardRef<HTMLButtonElement, OptionProps>(
51
52
</ div >
52
53
</ div >
53
54
) }
54
- < div className = 'py-4 ms-2 font-medium' > { label } </ div >
55
+ < div className = 'py-4 ms-2 font-medium' >
56
+ < KatexSpan text = { label } />
57
+ </ div >
55
58
</ div >
56
59
</ button >
57
60
) ;
0 commit comments