86 lines
2.9 KiB
React
86 lines
2.9 KiB
React
/*
|
|
Copyright (C) 2025 QuantumNous
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation, either version 3 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
*/
|
|
import React from 'react';
|
|
import { Card } from 'antd';
|
|
|
|
/**
|
|
* 企业中心统一卡片容器(方案 A+ 底盘层)。
|
|
* 实底表面 + 小圆角 + 1px 细边框 + 极轻海拔,靠边框分层,不用毛玻璃;
|
|
* 消除「裸表格」「Semi Card」「卡片表格」并存的不一致。
|
|
*
|
|
* @param {React.ReactNode} [title] 可选卡片标题(提供时渲染统一头部)
|
|
* @param {React.ReactNode} [subtitle] 标题下方副说明
|
|
* @param {React.ComponentType} [icon] 标题左侧 lucide 图标
|
|
* @param {React.ReactNode} [actions] 头部右侧操作区
|
|
* @param {string} [className] 追加类名
|
|
* @param {string} [padding] 内容内边距类,默认 'p-4';表格场景可传 'p-0' / 'p-2'
|
|
* @param {string} [bodyClassName] 内容容器追加类名
|
|
*/
|
|
const OrgPanel = ({
|
|
children,
|
|
title,
|
|
subtitle,
|
|
icon: Icon,
|
|
actions,
|
|
className = '',
|
|
padding = 'p-4',
|
|
bodyClassName = '',
|
|
}) => {
|
|
const hasHeader = title || actions;
|
|
return (
|
|
<Card
|
|
className={`org-panel ${className}`}
|
|
styles={{ body: { padding: 24 } }}
|
|
>
|
|
{hasHeader && (
|
|
<div className='flex items-start justify-between gap-3 flex-wrap border-b border-[var(--border-subtle)] px-5 py-3.5'>
|
|
<div className='flex items-center gap-2.5 min-w-0'>
|
|
{Icon && (
|
|
<span className='inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-brand/10 text-brand'>
|
|
<Icon size={16} />
|
|
</span>
|
|
)}
|
|
<div className='min-w-0'>
|
|
{title && (
|
|
<div className='text-sm font-semibold text-[var(--text-primary)] truncate'>
|
|
{title}
|
|
</div>
|
|
)}
|
|
{subtitle && (
|
|
<div className='mt-0.5 text-xs text-gray-500 dark:text-gray-400'>
|
|
{subtitle}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
{actions && (
|
|
<div className='flex items-center gap-2 flex-wrap justify-end'>
|
|
{actions}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)}
|
|
|
|
<div className={`${padding} ${bodyClassName}`}>{children}</div>
|
|
</Card>
|
|
);
|
|
};
|
|
|
|
export default OrgPanel;
|