refactor: 更新配置模块的样式与布局,优化组件结构,增强可读性与一致性

This commit is contained in:
2026-05-21 16:33:22 +08:00
parent 055c613a6d
commit 3ce84af39c
15 changed files with 541 additions and 377 deletions

View File

@@ -0,0 +1,75 @@
"use client";
import type { ReactNode } from "react";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { cn } from "@/lib/utils";
type ConfigDocPageProps = {
title: string;
titleSuffix?: ReactNode;
description?: string;
/** Category / play-type chips etc., rendered above the version toolbar. */
filters?: ReactNode;
toolbar?: ReactNode;
context?: ReactNode;
children: ReactNode;
className?: string;
contentClassName?: string;
};
export function ConfigDocToolbar({
switcher,
actions,
className,
}: {
switcher: ReactNode;
actions: ReactNode;
className?: string;
}) {
return (
<div
className={cn(
"rounded-xl border border-border/60 bg-secondary/50 p-4 shadow-sm",
className,
)}
>
<div className="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div className="min-w-0 flex-1">{switcher}</div>
<div className="flex shrink-0 flex-wrap items-center justify-end gap-2">{actions}</div>
</div>
</div>
);
}
export function ConfigDocPage({
title,
titleSuffix,
description,
filters,
toolbar,
context,
children,
className,
contentClassName,
}: ConfigDocPageProps) {
return (
<Card className={className}>
<CardHeader className="border-b border-border/60 pb-4">
<CardTitle className="text-lg">
{title}
{titleSuffix ? (
<span className="ml-2 font-normal text-muted-foreground">{titleSuffix}</span>
) : null}
</CardTitle>
{description ? <CardDescription className="text-base">{description}</CardDescription> : null}
</CardHeader>
<CardContent className={cn("space-y-6 pt-6", contentClassName)}>
{filters}
{toolbar}
{context}
{children}
</CardContent>
</Card>
);
}