mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-17 20:49:24 +00:00
refactor: clean some codes
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user