mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-05-19 07:56:34 +00:00
feat(playground): restructure app layout and implement playground with resizable panels
This commit is contained in:
parent
a699fc8069
commit
326cce7836
@ -1,16 +1,5 @@
|
|||||||
import CodeEditor from "@/components/code-editor";
|
import { redirect } from "next/navigation";
|
||||||
import { DEFAULT_PROBLEM } from "@/config/problem";
|
|
||||||
import MdxPreview from "@/components/problem-description";
|
|
||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
return (
|
redirect("/playground");
|
||||||
<div className="h-full flex items-center">
|
|
||||||
<div className="h-full w-1/2">
|
|
||||||
<MdxPreview source={DEFAULT_PROBLEM} />
|
|
||||||
</div>
|
|
||||||
<div className="h-full w-1/2">
|
|
||||||
<CodeEditor />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
6
src/app/(app)/playground/@problemDescription/page.tsx
Normal file
6
src/app/(app)/playground/@problemDescription/page.tsx
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import MdxPreview from "@/components/mdx-preview";
|
||||||
|
import { DEFAULT_PROBLEM } from "@/config/problem";
|
||||||
|
|
||||||
|
export default function ProblemDescriptionPage() {
|
||||||
|
return <MdxPreview source={DEFAULT_PROBLEM} />;
|
||||||
|
}
|
27
src/app/(app)/playground/layout.tsx
Normal file
27
src/app/(app)/playground/layout.tsx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import {
|
||||||
|
ResizableHandle,
|
||||||
|
ResizablePanel,
|
||||||
|
ResizablePanelGroup,
|
||||||
|
} from "@/components/ui/resizable";
|
||||||
|
|
||||||
|
interface PlaygroundLayoutProps {
|
||||||
|
children: React.ReactNode;
|
||||||
|
problemDescription: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function PlaygroundLayout({
|
||||||
|
children,
|
||||||
|
problemDescription,
|
||||||
|
}: PlaygroundLayoutProps) {
|
||||||
|
return (
|
||||||
|
<ResizablePanelGroup direction="horizontal">
|
||||||
|
<ResizablePanel defaultSize={50}>
|
||||||
|
{problemDescription}
|
||||||
|
</ResizablePanel>
|
||||||
|
<ResizableHandle withHandle />
|
||||||
|
<ResizablePanel defaultSize={50}>
|
||||||
|
{children}
|
||||||
|
</ResizablePanel>
|
||||||
|
</ResizablePanelGroup>
|
||||||
|
);
|
||||||
|
}
|
5
src/app/(app)/playground/page.tsx
Normal file
5
src/app/(app)/playground/page.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import CodeEditor from "@/components/code-editor";
|
||||||
|
|
||||||
|
export default function PlaygroundPage() {
|
||||||
|
return <CodeEditor />;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user