动态菜单和动态路由的 antd pro

DescriptionList.js 778B

1234567891011121314151617181920212223242526272829303132
  1. import React from 'react';
  2. import classNames from 'classnames';
  3. import { Row } from 'antd';
  4. import styles from './index.less';
  5. const DescriptionList = ({
  6. className,
  7. title,
  8. col = 3,
  9. layout = 'horizontal',
  10. gutter = 32,
  11. children,
  12. size,
  13. ...restProps
  14. }) => {
  15. const clsString = classNames(styles.descriptionList, styles[layout], className, {
  16. [styles.small]: size === 'small',
  17. [styles.large]: size === 'large',
  18. });
  19. const column = col > 4 ? 4 : col;
  20. return (
  21. <div className={clsString} {...restProps}>
  22. {title ? <div className={styles.title}>{title}</div> : null}
  23. <Row gutter={gutter}>
  24. {React.Children.map(children, child => React.cloneElement(child, { column }))}
  25. </Row>
  26. </div>
  27. );
  28. };
  29. export default DescriptionList;