import { useState } from 'react' import { UpOutlined, DownOutlined } from '@ant-design/icons' import './ExtendInfoPanel.css' /** * 扩展信息面板组件 * @param {Object} props * @param {Array} props.sections - 信息区块配置数组 * @param {string} props.sections[].key - 区块唯一键 * @param {string} props.sections[].title - 区块标题 * @param {ReactNode} props.sections[].icon - 标题图标 * @param {ReactNode} props.sections[].content - 区块内容 * @param {boolean} props.sections[].defaultCollapsed - 默认是否折叠 * @param {boolean} props.sections[].hideTitleBar - 是否隐藏该区块的标题栏(默认 false) * @param {string} props.layout - 布局方式:'vertical'(垂直堆叠)| 'horizontal'(水平排列) * @param {string} props.className - 自定义类名 */ function ExtendInfoPanel({ sections = [], layout = 'vertical', className = '' }) { const [collapsedSections, setCollapsedSections] = useState(() => { const initial = {} sections.forEach((section) => { if (section.defaultCollapsed) { initial[section.key] = true } }) return initial }) const toggleSection = (key) => { setCollapsedSections((prev) => ({ ...prev, [key]: !prev[key], })) } return (