refactor: clean some codes

This commit is contained in:
rusconn
2024-03-28 12:33:14 +09:00
parent 749c79c8e4
commit 2fc9b7e419
10 changed files with 39 additions and 42 deletions

View File

@@ -3,22 +3,21 @@ import { cn } from "@/lib/style";
type Props = {
className?: string;
children: React.ReactNode;
title?: string;
title: string;
control?: React.ReactNode;
};
export function PageSection({ className, children, title, control }: Props) {
return (
<section className={cn("mt-3 flex flex-col", className)}>
{title &&
(control ? (
<div className="mb-1.5 flex w-full items-end">
<h2 className="text-base">{title}</h2>
<div className="ml-auto">{control}</div>
</div>
) : (
<h2 className="mb-1.5 text-base">{title}</h2>
))}
{control ? (
<div className="mb-1.5 flex w-full items-end">
<h2 className="text-base">{title}</h2>
<div className="ml-auto">{control}</div>
</div>
) : (
<h2 className="mb-1.5 text-base">{title}</h2>
)}
{children}
</section>
);