mirror of
https://litchi.icu/ngc2207/judge.git
synced 2025-05-18 16:07:04 +00:00
feat(layout): create MainLayout and MainPage components with editor features
This commit is contained in:
parent
274cb40b73
commit
545422cd5f
14
src/app/(main)/layout.tsx
Normal file
14
src/app/(main)/layout.tsx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import Header from "./components/header";
|
||||||
|
|
||||||
|
export default function MainLayout({
|
||||||
|
children,
|
||||||
|
}: Readonly<{
|
||||||
|
children: React.ReactNode;
|
||||||
|
}>) {
|
||||||
|
return (
|
||||||
|
<div className="h-full flex flex-col">
|
||||||
|
<Header />
|
||||||
|
<div className="flex-1">{children}</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
33
src/app/(main)/page.tsx
Normal file
33
src/app/(main)/page.tsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import * as monaco from "monaco-editor";
|
||||||
|
import Editor from "@monaco-editor/react";
|
||||||
|
import { loader } from "@monaco-editor/react";
|
||||||
|
import ThemeSelector from "./components/theme-selector";
|
||||||
|
import FontSizeSlider from "./components/font-size-slider";
|
||||||
|
import LanguageSelector from "./components/language-selector";
|
||||||
|
import { useCodeEditorStore } from "@/store/useCodeEditorStore";
|
||||||
|
import { highlightMonacoEditor } from "@/constants/editor/themes";
|
||||||
|
|
||||||
|
loader.config({ monaco });
|
||||||
|
|
||||||
|
export default function MainPage() {
|
||||||
|
const { language, theme, fontSize, setEditor } = useCodeEditorStore();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="h-full flex flex-col gap-2">
|
||||||
|
<div className="flex items-center px-4 gap-2">
|
||||||
|
<LanguageSelector />
|
||||||
|
<ThemeSelector />
|
||||||
|
<FontSizeSlider />
|
||||||
|
</div>
|
||||||
|
<Editor
|
||||||
|
language={language}
|
||||||
|
theme={theme}
|
||||||
|
beforeMount={highlightMonacoEditor}
|
||||||
|
onMount={setEditor}
|
||||||
|
options={{ fontSize, automaticLayout: true }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
@ -1,3 +0,0 @@
|
|||||||
export default function HomePage() {
|
|
||||||
return null;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user