refactor(playground/problem): restructure layout props and add route nesting

This commit is contained in:
cfngc4594 2025-02-24 19:55:17 +08:00
parent 0ad1f24c7a
commit ffe8c106d8
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import MdxPreview from "@/components/mdx-preview"; import MdxPreview from "@/components/mdx-preview";
import { DEFAULT_PROBLEM } from "@/config/problem"; import { DEFAULT_PROBLEM } from "@/config/problem";
export default function DescriptionPage() { export default function ProblemDescriptionPage() {
return <MdxPreview source={DEFAULT_PROBLEM} />; return <MdxPreview source={DEFAULT_PROBLEM} />;
} }

View File

@ -3,10 +3,10 @@ import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
interface ProblemLayoutProps { interface ProblemLayoutProps {
children: React.ReactNode; description: React.ReactNode;
} }
export default function ProblemLayout({ children }: ProblemLayoutProps) { export default function ProblemLayout({ description }: ProblemLayoutProps) {
return ( return (
<Tabs defaultValue="description" className="h-full flex flex-col"> <Tabs defaultValue="description" className="h-full flex flex-col">
<ScrollArea className="h-9 flex-none bg-muted px-1"> <ScrollArea className="h-9 flex-none bg-muted px-1">
@ -26,7 +26,7 @@ export default function ProblemLayout({ children }: ProblemLayoutProps) {
<ScrollBar orientation="horizontal" /> <ScrollBar orientation="horizontal" />
</ScrollArea> </ScrollArea>
<TabsContent value="description" className="grow mt-0"> <TabsContent value="description" className="grow mt-0">
{children} {description}
</TabsContent> </TabsContent>
</Tabs> </Tabs>
); );