FactuGES_ERP/packages/rdx-ui/src/components/right-panel/right-panel.tsx

47 lines
1.1 KiB
TypeScript
Raw Normal View History

2026-03-31 15:56:41 +00:00
import { Button } from "@repo/shadcn-ui/components";
import { cn } from "@repo/shadcn-ui/lib/utils";
import { XIcon } from "lucide-react";
import type { RightPanelProps } from "./right-panel-types.ts";
export const RightPanel = ({
open,
title,
className,
headerActions,
children,
onOpenChange,
}: RightPanelProps) => {
if (!open) return null;
return (
<aside
aria-labelledby="right-panel-title"
2026-03-31 17:14:30 +00:00
className={cn("flex h-full flex-col bg-background", className)}
2026-03-31 15:56:41 +00:00
>
2026-03-31 17:14:30 +00:00
<div className="flex items-center justify-between border-b px-4 py-3">
<h2 className="truncate text-sm font-semibold" id="right-panel-title">
{title}
</h2>
2026-03-31 15:56:41 +00:00
2026-03-31 17:14:30 +00:00
<div className="flex items-center gap-1">
{headerActions}
2026-03-31 15:56:41 +00:00
2026-03-31 17:14:30 +00:00
{onOpenChange ? (
<Button
aria-label="Cerrar panel"
onClick={() => onOpenChange(false)}
size="icon-sm"
variant="ghost"
>
<XIcon className="size-4" />
</Button>
) : null}
2026-03-31 15:56:41 +00:00
</div>
</div>
2026-03-31 17:14:30 +00:00
<div className="flex-1 overflow-auto">{children}</div>
2026-03-31 15:56:41 +00:00
</aside>
);
};