diff --git a/src/app/(main)/problems/[slug]/@answer/page.tsx b/src/app/(main)/problems/[slug]/@answer/page.tsx deleted file mode 100644 index 5050135..0000000 --- a/src/app/(main)/problems/[slug]/@answer/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export default async function AnswerPage({ - params, -}: { - params: Promise<{ slug: string }>; -}) { - const slug = (await params).slug; - return ( -
-

Answer Page: {slug}

-
- ); -} diff --git a/src/app/(main)/problems/[slug]/@console/page.tsx b/src/app/(main)/problems/[slug]/@console/page.tsx deleted file mode 100644 index af667c1..0000000 --- a/src/app/(main)/problems/[slug]/@console/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export default async function ConsolePage({ - params, -}: { - params: Promise<{ slug: string }>; -}) { - const slug = (await params).slug; - return ( -
-

Console Page: {slug}

-
- ); -} diff --git a/src/app/(main)/problems/[slug]/@description/page.tsx b/src/app/(main)/problems/[slug]/@description/page.tsx deleted file mode 100644 index 08f06a5..0000000 --- a/src/app/(main)/problems/[slug]/@description/page.tsx +++ /dev/null @@ -1,12 +0,0 @@ -export default async function DescriptionPage({ - params, -}: { - params: Promise<{ slug: string }>; -}) { - const slug = (await params).slug; - return ( -
-

Description Page: {slug}

-
- ); -} diff --git a/src/app/(main)/problems/[slug]/components/tabs-card.tsx b/src/app/(main)/problems/[slug]/components/tabs-card.tsx new file mode 100644 index 0000000..660e194 --- /dev/null +++ b/src/app/(main)/problems/[slug]/components/tabs-card.tsx @@ -0,0 +1,41 @@ +import { LucideIcon } from "lucide-react"; +import { Tabs } from "@radix-ui/react-tabs"; +import { TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; + +interface TabsItem { + icon: LucideIcon; + label: string; + value: string; + content: React.ReactNode; +} + +interface TabsCardProps { + tabsItems: TabsItem[]; +} + +export function TabsCard({ tabsItems }: TabsCardProps) { + return ( + + + {tabsItems.map((tabsItem) => ( + + + {tabsItem.label} + + ))} + + {tabsItems.map((tabsItem) => ( + + {tabsItem.content} + + ))} + + ); +} diff --git a/src/app/(main)/problems/[slug]/layout.tsx b/src/app/(main)/problems/[slug]/layout.tsx index 76421d3..5622fc3 100644 --- a/src/app/(main)/problems/[slug]/layout.tsx +++ b/src/app/(main)/problems/[slug]/layout.tsx @@ -1,20 +1,50 @@ +import { + CodeXmlIcon, + FileChartColumnIcon, + SquareChevronRightIcon, +} from "lucide-react"; import { ResizableHandle, ResizablePanel, ResizablePanelGroup, } from "@/components/ui/resizable"; +import AnswerPage from "./views/answer-page"; +import ConsolePage from "./views/console-page"; +import { TabsCard } from "./components/tabs-card"; +import DescriptionPage from "./views/description-page"; export default async function ProblemLayout({ + params, children, - description, - answer, - console, }: { + params: Promise<{ slug: string }>; children: React.ReactNode; - description: React.ReactNode; - answer: React.ReactNode; - console: React.ReactNode; }) { + const slug = (await params).slug; + const descriptionTabsItems = [ + { + icon: FileChartColumnIcon, + label: "题目描述", + value: "description", + content: , + }, + ]; + const answerTabsItems = [ + { + icon: CodeXmlIcon, + label: "代码", + value: "code", + content: , + }, + ]; + const consoleTabsItems = [ + { + icon: SquareChevronRightIcon, + label: "控制台", + value: "console", + content: , + }, + ]; return (
{children} @@ -23,18 +53,18 @@ export default async function ProblemLayout({ defaultSize={25} className="hidden lg:block border rounded-lg" > - {description} + - {answer} + - {console} +
diff --git a/src/app/(main)/problems/[slug]/views/answer-page.tsx b/src/app/(main)/problems/[slug]/views/answer-page.tsx new file mode 100644 index 0000000..6acd362 --- /dev/null +++ b/src/app/(main)/problems/[slug]/views/answer-page.tsx @@ -0,0 +1,7 @@ +export default function AnswerPage({ slug }: { slug: string }) { + return ( +
+

Answer Page: {slug}

+
+ ); +} diff --git a/src/app/(main)/problems/[slug]/views/console-page.tsx b/src/app/(main)/problems/[slug]/views/console-page.tsx new file mode 100644 index 0000000..2bec759 --- /dev/null +++ b/src/app/(main)/problems/[slug]/views/console-page.tsx @@ -0,0 +1,7 @@ +export default function ConsolePage({ slug }: { slug: string }) { + return ( +
+

Console Page: {slug}

+
+ ); +} diff --git a/src/app/(main)/problems/[slug]/views/description-page.tsx b/src/app/(main)/problems/[slug]/views/description-page.tsx new file mode 100644 index 0000000..00c1af6 --- /dev/null +++ b/src/app/(main)/problems/[slug]/views/description-page.tsx @@ -0,0 +1,7 @@ +export default function DescriptionPage({ slug }: { slug: string }) { + return ( +
+

Description Page: {slug}

+
+ ); +}