1
- ' use client' ;
1
+ " use client" ;
2
2
import { Question , Difficulty } from "@/api/structs" ;
3
3
import Chip from "@/components/shared/Chip" ;
4
4
import PeerprepButton from "@/components/shared/PeerprepButton" ;
5
- import styles from ' @/style/question.module.css' ;
5
+ import styles from " @/style/question.module.css" ;
6
6
7
7
interface Props {
8
- question : Question ;
8
+ question : Question ;
9
9
}
10
10
11
11
interface DifficultyChipProps {
12
- diff : Difficulty
12
+ diff : Difficulty ;
13
13
}
14
14
15
15
function DifficultyChip ( { diff } : DifficultyChipProps ) {
16
- return (
17
- diff === Difficulty . Easy
18
- ? < Chip className = { styles . easy } > Easy </ Chip >
19
- : diff === Difficulty . Medium
20
- ? < Chip className = { styles . med } > Med </ Chip >
21
- : < Chip className = { styles . hard } > Hard</ Chip >
16
+ return diff === Difficulty . Easy ? (
17
+ < Chip className = { styles . easy } > Easy</ Chip >
18
+ ) : diff === Difficulty . Medium ? (
19
+ < Chip className = { styles . med } > Med </ Chip >
20
+ ) : (
21
+ < Chip className = { styles . hard } > Hard</ Chip >
22
22
) ;
23
23
}
24
24
@@ -28,7 +28,9 @@ function QuestionBlock({ question }: Props) {
28
28
const createRow = ( key : string ) => (
29
29
< tr key = { key } >
30
30
< td className = { `${ styles . table } ${ styles . cell } ` } > { key } </ td >
31
- < td className = { `${ styles . table } ${ styles . cell } ` } > { question . test_cases [ key ] } </ td >
31
+ < td className = { `${ styles . table } ${ styles . cell } ` } >
32
+ { question . test_cases [ key ] }
33
+ </ td >
32
34
</ tr >
33
35
) ;
34
36
@@ -37,41 +39,56 @@ function QuestionBlock({ question }: Props) {
37
39
< div className = { styles . qn_container } >
38
40
< div className = { styles . title_wrapper } >
39
41
< div className = { styles . label_wrapper } >
40
- < h1 className = { styles . title } > Q{ question . id } : { question . title } </ h1 >
42
+ < h1 className = { styles . title } >
43
+ Q{ question . id } : { question . title }
44
+ </ h1 >
41
45
< DifficultyChip diff = { question . difficulty } />
42
46
</ div >
43
- < PeerprepButton className = { ` ${ styles . button } ` }
44
- onClick = { /* TODO: Replace this function with gateway.delete*/ ( ) => console . log ( "Delete Me!" ) } >
47
+ < PeerprepButton
48
+ className = { ` ${ styles . button } ` }
49
+ onClick = {
50
+ /* TODO: Replace this function with gateway.delete*/ ( ) =>
51
+ console . log ( "Delete Me!" )
52
+ }
53
+ >
45
54
Delete
46
55
</ PeerprepButton >
47
56
</ div >
48
57
< div className = { styles . label_wrapper } >
49
58
< p > Categories: </ p >
50
- { question . categories . length == 0
51
- ? ( < p > No categories listed.</ p > )
52
- : question . categories . map ( ( elem , idx ) => (
53
- < p key = { idx } > { elem } </ p >
54
- ) ) }
59
+ { question . categories . length == 0 ? (
60
+ < p > No categories listed.</ p >
61
+ ) : (
62
+ question . categories . map ( ( elem , idx ) => < p key = { idx } > { elem } </ p > )
63
+ ) }
55
64
</ div >
56
65
< p > { question . description } </ p >
57
- < br />
66
+ < br />
58
67
{ question . test_cases && (
59
68
< table className = { styles . table } >
60
69
< tbody >
61
70
< tr >
62
- < th className = { `${ styles . table } ${ styles . header } ${ styles . input } ` } > Input</ th >
63
- < th className = { `${ styles . table } ${ styles . header } ${ styles . output } ` } > Expected Output</ th >
71
+ < th
72
+ className = { `${ styles . table } ${ styles . header } ${ styles . input } ` }
73
+ >
74
+ Input
75
+ </ th >
76
+ < th
77
+ className = { `${ styles . table } ${ styles . header } ${ styles . output } ` }
78
+ >
79
+ Expected Output
80
+ </ th >
64
81
</ tr >
65
82
{ keys . map ( createRow ) }
66
83
</ tbody >
67
84
</ table >
68
85
) }
69
86
</ div >
70
87
< form className = { styles . editor_container } >
71
- < textarea className = { styles . code_editor } />
88
+ < textarea className = { styles . code_editor } />
72
89
</ form >
73
90
</ >
74
91
) ;
75
92
}
76
93
77
- export default QuestionBlock ;
94
+ export default QuestionBlock ;
0 commit comments