import React, { FC } from 'react';
import classnames from 'classnames';

import styles from './index.less';

interface PageProps {
  title?: string;
  imgSrc?: any;
  children?: any;
  style?: string;
  rightView?: any;
  require?: boolean;
}

const CardDiv: FC<PageProps> = ({
  title,
  children,
  imgSrc,
  style,
  rightView,
  require = false,
}) => {
  return (
    <div
      className={classnames({
        [styles.card]: true,
        [`${style}`]: !!style,
      })}
    >
      <div className={styles.titleBox}>
        {!!imgSrc && <img src={imgSrc} alt="" />}
        {!!require && <div className={styles.sign}>*</div>}
        {!!title && <div className={styles.titleText}>{title}</div>}
        {!!rightView && rightView}
      </div>
      {children}
    </div>
  );
};

export default CardDiv;
