@@ -3,6 +3,7 @@ import React from "react";
3
3
import { Question , Difficulty } from "@/api/structs" ;
4
4
import PeerprepButton from "../shared/PeerprepButton" ;
5
5
import { useRouter } from "next/navigation" ;
6
+ import styles from "@/style/questionCard.module.css" ;
6
7
7
8
type QuestionCardProps = {
8
9
question : Question ;
@@ -14,47 +15,48 @@ const QuestionCard: React.FC<QuestionCardProps> = ({ question }) => {
14
15
const getDifficultyColor = ( difficulty : Difficulty ) => {
15
16
switch ( difficulty ) {
16
17
case Difficulty . Easy :
17
- return "text-green-500 " ; // Green for easy
18
+ return "text-difficulty-easy " ; // Green for easy
18
19
case Difficulty . Medium :
19
- return "text-yellow-500 " ; // Yellow for medium
20
+ return "text-difficulty-med " ; // Yellow for medium
20
21
case Difficulty . Hard :
21
- return "text-red-500 " ; // Red for hard
22
+ return "text-difficulty-hard " ; // Red for hard
22
23
default :
23
- return "text-gray-100 " ; // Default color
24
+ return "text-secondary-text " ; // Default color
24
25
}
25
26
} ;
26
27
27
28
return (
28
- < div className = "flex flex-col sm:flex-row items-center w-full h-auto p-4 bg-gray-700 shadow-md rounded-lg mb-4" >
29
- < div className = "flex-none w-full sm:w-1/3 overflow-hidden " >
30
- < h2 className = "text-lg font-bold" > { question . title } </ h2 >
31
- < p className = "text-sm" >
29
+ < div className = { styles . container } >
30
+ < div className = "flex-none w-full sm:w-1/3" >
31
+ < h2 className = { styles . title } > { question . title } </ h2 >
32
+ < p className = { styles . bodytext } >
32
33
Difficulty:{ " " }
33
34
< span
34
- className = { `capitalize ${ getDifficultyColor ( question . difficulty ) } ` }
35
+ className = { `capitalize font-bold ${ getDifficultyColor (
36
+ question . difficulty
37
+ ) } `}
35
38
>
36
39
{ Difficulty [ question . difficulty ] }
37
40
</ span >
38
41
</ p >
39
- < p className = "text-sm" >
42
+ < p className = { styles . bodytext } >
40
43
Categories:{ " " }
41
44
< span >
42
45
{ question . categories ? question . categories . join ( ", " ) : "None" }
43
46
</ span >
44
47
</ p >
45
48
</ div >
46
49
47
- < div className = "flex-none w-full sm:w-1/2 max-h-16 overflow-hidden" >
48
- < p className = "text-sm text-wrap truncate text-left" >
49
- { question . description }
50
- </ p >
50
+ < div className = "flex-none w-full sm:w-1/2 max-h-16" >
51
+ < p className = { styles . bodytext } > { question . description } </ p >
51
52
</ div >
52
53
53
- < div className = "flex flex-col sm:flex-row ml-0 sm:ml-10 mr-0 sm:mr-10 w-full sm:w-1/6 items-center space-x-0 sm:space-x-2 space-y-2 sm:space-y-0" >
54
+ < div className = { styles . buttonContainer } >
54
55
< PeerprepButton onClick = { ( ) => router . push ( `questions/${ question . id } ` ) } >
55
56
View
56
57
</ PeerprepButton >
57
58
< PeerprepButton
59
+ // no functionality here yet
58
60
onClick = { ( ) => console . log ( `Deleting question ${ question . id } ` ) }
59
61
>
60
62
Delete
0 commit comments