mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-05-18 15:26:36 +00:00
feat(components): add ProblemDescription component to render markdown
- Added ProblemDescription component that uses MDXRemote to render markdown content. - Includes a Skeleton loader while content is loading and a horizontal scrollbar. - Wrapped content in a ScrollArea with a max-height limit for better UI experience.
This commit is contained in:
parent
a4a037f5a4
commit
7db6f4e20e
21
src/components/problem-description.tsx
Normal file
21
src/components/problem-description.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import { Suspense } from "react";
|
||||
import { MDXRemote } from "next-mdx-remote/rsc";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
|
||||
|
||||
interface ProblemDescriptionProps {
|
||||
mdxSource: string;
|
||||
}
|
||||
|
||||
export function ProblemDescription({ mdxSource }: ProblemDescriptionProps) {
|
||||
return (
|
||||
<ScrollArea className="[&>[data-radix-scroll-area-viewport]]:max-h-[calc(100vh-56px)]">
|
||||
<Suspense fallback={<Skeleton className="h-full w-full" />}>
|
||||
<div className="markdown-body">
|
||||
<MDXRemote source={mdxSource} />
|
||||
</div>
|
||||
</Suspense>
|
||||
<ScrollBar orientation="horizontal" />
|
||||
</ScrollArea>
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue
Block a user