Files
NODEDC_DESIGN_GUIDELINE/packages/ui-react/src/ApplicationSidePanel.tsx
T

56 lines
1.7 KiB
TypeScript

import type { HTMLAttributes, ReactNode } from "react";
import { cn } from "./cn.js";
import { Icon } from "./Icon.js";
export interface ApplicationSidePanelProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
eyebrow?: ReactNode;
title: ReactNode;
description?: ReactNode;
closeLabel?: string;
footer?: ReactNode;
onClose: () => void;
children: ReactNode;
}
/**
* Theme-aware trailing application panel paired with AdminNavigationPanel.
*
* The shell owns the separate end column; this component owns its matching
* surface, actions and right-to-left entrance animation.
*/
export function ApplicationSidePanel({
eyebrow = "NODE.DC",
title,
description,
closeLabel = "Закрыть панель",
footer,
onClose,
children,
className,
...props
}: ApplicationSidePanelProps) {
return (
<aside
className={cn("nodedc-admin-panel nodedc-application-side-panel", className)}
data-placement="end"
{...props}
>
<header className="nodedc-admin-panel__head">
<div>
<p>{eyebrow}</p>
<h2>{title}</h2>
{description ? <span className="nodedc-application-side-panel__description">{description}</span> : null}
</div>
<div className="nodedc-admin-panel__head-actions">
<button type="button" className="nodedc-admin-panel__close" aria-label={closeLabel} onClick={onClose}>
<Icon name="close" size={16} strokeWidth={1.6} />
</button>
</div>
</header>
<div className="nodedc-application-side-panel__body">{children}</div>
{footer ? <footer className="nodedc-admin-panel__footer">{footer}</footer> : null}
</aside>
);
}