|
|
|
@@ -4,21 +4,27 @@ import './index.less'; |
|
|
|
|
|
|
|
type InfoGroupProps = { |
|
|
|
title: string; |
|
|
|
contentScroll?: boolean; // 内容是否需要滚动,如果可以滚动,则取消 padding |
|
|
|
height?: string | number; // 如果要纵向滚动,需要设置高度 |
|
|
|
width?: string | number; // 如果要横向滚动,需要设置宽度 |
|
|
|
className?: string; |
|
|
|
style?: React.CSSProperties; |
|
|
|
children?: React.ReactNode; |
|
|
|
}; |
|
|
|
|
|
|
|
function InfoGroup({ title, contentScroll = false, className, style, children }: InfoGroupProps) { |
|
|
|
function InfoGroup({ title, height, width, className, style, children }: InfoGroupProps) { |
|
|
|
const contentStyle: React.CSSProperties = {}; |
|
|
|
if (height) { |
|
|
|
contentStyle.height = height; |
|
|
|
contentStyle.overflowY = 'auto'; |
|
|
|
} |
|
|
|
if (width) { |
|
|
|
contentStyle.width = width; |
|
|
|
contentStyle.overflowX = 'auto'; |
|
|
|
} |
|
|
|
return ( |
|
|
|
<div className={classNames('kf-info-group', className)} style={style}> |
|
|
|
<InfoGroupTitle title={title} /> |
|
|
|
<div |
|
|
|
className={classNames('kf-info-group__content', { |
|
|
|
'kf-info-group__content--scroll': contentScroll, |
|
|
|
})} |
|
|
|
> |
|
|
|
<div style={contentStyle} className={'kf-info-group__content'}> |
|
|
|
{children} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|