import * as React from 'react'; import classNames from 'classnames'; type widthUnit = number | string; export interface SkeletonParagraphProps { prefixCls?: string; className?: string; style?: React.CSSProperties; width?: widthUnit | Array; rows?: number; } const getWidth = (index: number, props: SkeletonParagraphProps) => { const { width, rows = 2 } = props; if (Array.isArray(width)) { return width[index]; } // last paragraph if (rows - 1 === index) { return width; } return undefined; }; const Paragraph: React.FC = (props) => { const { prefixCls, className, style, rows } = props; const rowList = [...new Array(rows)].map((_, index) => ( // eslint-disable-next-line react/no-array-index-key
  • )); return (
      {rowList}
    ); }; export default Paragraph;