index.tsx 810 Bytes
Newer Older
1 2 3 4
import React from 'react';
import classNames from 'classnames';
import styles from './index.less';

陈帅's avatar
陈帅 committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
interface StandardFormRowProps {
  title?: string;
  last?: boolean;
  block?: boolean;
  grid?: boolean;
  style?: React.CSSProperties;
}

const StandardFormRow: React.SFC<StandardFormRowProps> = ({
  title,
  children,
  last,
  block,
  grid,
  ...rest
}) => {
21 22 23 24 25 26 27 28
  const cls = classNames(styles.standardFormRow, {
    [styles.standardFormRowBlock]: block,
    [styles.standardFormRowLast]: last,
    [styles.standardFormRowGrid]: grid,
  });

  return (
    <div className={cls} {...rest}>
jim's avatar
jim committed
29 30 31 32 33 34
      {title && (
        <div className={styles.label}>
          <span>{title}</span>
        </div>
      )}
      <div className={styles.content}>{children}</div>
35 36 37
    </div>
  );
};
ZHAO Jinxiang's avatar
ZHAO Jinxiang committed
38 39

export default StandardFormRow;