jc-biz-components
Version:
jc component library based on Antd
26 lines (24 loc) • 779 B
JavaScript
import React from 'react'
import classNames from 'classnames'
import { Row } from 'antd'
// import styles from './index.less'
export default function DescriptionList({ className, title, col = 3, layout = 'horizontal', gutter = 32,
children, size, ...restProps }) {
const prefixCls = 'jc-description-list'
const clsString = classNames(prefixCls, 'layout', className, {
small: size === 'small',
large: size === 'large',
})
const column = col > 4 ? 4 : col
return (
<div
className={clsString}
{...restProps}
>
{title ? <div className={`${this.props.prefixCls}-title`}>{title}</div> : null}
<Row gutter={gutter}>
{React.Children.map(children, child => React.cloneElement(child, { column }))}
</Row>
</div>
)
}