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

45 lines
971 B
TypeScript
Raw Normal View History

2026-03-31 18:13:03 +00:00
import {
Button,
Card,
CardAction,
CardContent,
CardHeader,
CardTitle,
} from "@repo/shadcn-ui/components";
2026-03-31 15:56:41 +00:00
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 (
2026-03-31 18:13:03 +00:00
<Card className={className}>
<CardHeader>
<CardTitle id="right-panel-title">{title}</CardTitle>
<CardAction>
2026-03-31 17:14:30 +00:00
{headerActions}
{onOpenChange ? (
<Button
aria-label="Cerrar panel"
onClick={() => onOpenChange(false)}
size="icon-sm"
variant="ghost"
>
<XIcon className="size-4" />
</Button>
) : null}
2026-03-31 18:13:03 +00:00
</CardAction>
</CardHeader>
<CardContent className="-mx-4">{children}</CardContent>
</Card>
2026-03-31 15:56:41 +00:00
);
};