1
1
import moment from "moment" ;
2
- // import { MdOutlineFavorite } from "react-icons/md";
3
- // import { RiQuestionAnswerFill } from "react-icons/ri";
2
+ import { BiSolidUpvote } from "react-icons/bi" ;
4
3
import { Link } from "react-router-dom" ;
5
4
6
5
interface Question {
@@ -17,14 +16,11 @@ interface Question {
17
16
const Questions = ( { question } : { question : Question } ) => {
18
17
return (
19
18
< Link to = { `/Questions/${ question . _id } ` } >
20
- < div className = "flex flex-col gap-4 p-4 bg-gray-50 border border-gray-300 rounded-md shadow-md hover:shadow-lg transition-shadow duration-300 mb-2" >
21
- { /* Votes and Answers Row */ }
22
-
23
- { /* Question Details Section */ }
19
+ < div className = "flex flex-col gap-4 p-6 bg-white border border-gray-200 rounded-2xl shadow-sm hover:shadow-md transition-shadow duration-300 mb-4 transform hover:-translate-y-1" >
24
20
< div className = "flex-grow" >
25
21
< Link
26
22
to = { `/Questions/${ question . _id } ` }
27
- className = "text-lg font-medium text-blue-700 hover:underline "
23
+ className = "text-xl font-semibold text-gray-800 hover:text-blue-600 transition-colors duration-300 "
28
24
>
29
25
{ question . questionTitle ?. length >
30
26
( window . innerWidth <= 400 ? 70 : 90 )
@@ -35,33 +31,39 @@ const Questions = ({ question }: { question: Question }) => {
35
31
: question . questionTitle }
36
32
</ Link >
37
33
</ div >
38
- < div className = "flex flex-wrap items-center gap-4 text-gray-600 text-xs sm:text-sm" >
39
- { /* <span className="px-2 py-1 bg-gray-100 border border-gray-300 rounded-full inline-flex items-center">
40
- <span className="font-semibold">
41
- {question.upVote.length - question.downVote.length}
42
- </span>{" "}
43
- <MdOutlineFavorite />
44
- </span> */ }
45
- { /* <span className="px-2 py-1 bg-gray-100 border border-gray-300 rounded-full inline-flex items-center">
46
- <span className="font-semibold px-1">{question.noOfAnswers}</span>
47
- <RiQuestionAnswerFill />
48
- </span> */ }
49
- < div className = "text-xs text-gray-500 mt-2" >
50
- asked { moment ( question . askedOn ) . fromNow ( ) } by
51
- < span className = "ml-1 font-medium text-gray-800" >
52
- { question . userPosted . length > 10
53
- ? question . userPosted . substring ( 0 , 10 ) + "..."
54
- : question . userPosted }
55
- </ span >
34
+
35
+ < div className = "flex items-center gap-2 text-sm text-gray-600" >
36
+ < div className = "flex flex-wrap gap-2" >
37
+ { question . questionTags . map ( ( tag ) => (
38
+ < span
39
+ key = { tag }
40
+ className = "px-3 py-1 text-xs font-medium text-gray-600 border border-gray-300 rounded-full hover:bg-blue-50 transition-colors duration-300"
41
+ >
42
+ { tag }
43
+ </ span >
44
+ ) ) }
56
45
</ div >
57
- { question . questionTags . map ( ( tag ) => (
58
- < span
59
- key = { tag }
60
- className = "px-2 py-1 text-xs text-gray-800 bg-gray-200 border border-gray-300 rounded-full"
61
- >
62
- { tag }
46
+
47
+ < span className = "px-2 py-1 text-xs font-medium text-gray-600 border border-gray-300 rounded-full items-center flex content-between" >
48
+ { question . noOfAnswers } < BiSolidUpvote />
49
+ </ span >
50
+
51
+ < span className = "px-2 py-1 text-xs font-medium text-gray-600 border border-gray-300 rounded-full" >
52
+ { question . noOfAnswers } 💬
53
+ </ span >
54
+ </ div >
55
+
56
+ < div className = "flex justify-between items-center text-gray-600 text-sm" >
57
+ < div className = "flex items-center gap-2 text-sm text-gray-500" >
58
+ < span className = "text-gray-500" >
59
+ asked { moment ( question . askedOn ) . fromNow ( ) }
63
60
</ span >
64
- ) ) }
61
+ </ div >
62
+ < span className = "font-medium text-slate-400 hover:text-blue-200 transition-colors duration-300" >
63
+ { question . userPosted . length > 10
64
+ ? question . userPosted . substring ( 0 , 10 ) + "..."
65
+ : question . userPosted }
66
+ </ span >
65
67
</ div >
66
68
</ div >
67
69
</ Link >
0 commit comments