1
- import { Badge } from '@/components/ui/badge' ;
2
- import { Card , CardHeader , CardTitle } from '@/components/ui/card' ;
3
- import { getQuestionDetails } from '@/services/question-service' ;
4
1
import { QueryClient , queryOptions , useSuspenseQuery } from '@tanstack/react-query' ;
2
+ import Markdown from 'react-markdown' ;
5
3
import { LoaderFunctionArgs , useLoaderData } from 'react-router-dom' ;
4
+ import rehypeKatex from 'rehype-katex' ;
5
+ import remarkGfm from 'remark-gfm' ;
6
+ import remarkMath from 'remark-math' ;
7
+
8
+ import { Badge } from '@/components/ui/badge' ;
9
+ import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card' ;
10
+ import { getQuestionDetails } from '@/services/question-service' ;
6
11
7
12
const questionDetailsQuery = ( id : number ) =>
8
13
queryOptions ( {
@@ -24,9 +29,11 @@ export const QuestionDetails = () => {
24
29
return (
25
30
< Card >
26
31
< CardHeader >
27
- < CardTitle > { details . title } </ CardTitle >
28
- < div className = 'flex flex-col gap-2' >
29
- < Badge className = 'flex w-min grow-0' > { details . difficulty } </ Badge >
32
+ < div className = 'flex flex-col gap-4' >
33
+ < div className = 'flex w-full items-center gap-4' >
34
+ < CardTitle className = 'text-2xl' > { details . title } </ CardTitle >
35
+ < Badge className = 'flex w-min grow-0' > { details . difficulty } </ Badge >
36
+ </ div >
30
37
< div className = 'flex flex-wrap items-center gap-1' >
31
38
{ details . topics . map ( ( v , i ) => (
32
39
< Badge className = 'flex w-min grow-0 whitespace-nowrap' key = { i } >
@@ -36,6 +43,15 @@ export const QuestionDetails = () => {
36
43
</ div >
37
44
</ div >
38
45
</ CardHeader >
46
+ < CardContent >
47
+ < Markdown
48
+ rehypePlugins = { [ rehypeKatex ] }
49
+ remarkPlugins = { [ remarkMath , remarkGfm ] }
50
+ className = 'prose prose-neutral'
51
+ >
52
+ { details . description }
53
+ </ Markdown >
54
+ </ CardContent >
39
55
</ Card >
40
56
) ;
41
57
} ;
0 commit comments