All files / src/components ErrorMsg.tsx

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21                  66x 5x 5x                  
import React, { ReactElement } from "react";
import { WarningOutlined } from '@ant-design/icons';
import { Space } from "antd";
import { wrapAsHtml } from "@utils/ComponentUtils";
/**
 * 在界面上显示某个字段的校验错误逻辑的控件
 * @param props 要显示的错误信息
 * @constructor
 */
const ErrorMsg = (props: { errorMsg: string }): ReactElement => {
  const {errorMsg} = props;
  return (<div>
    <Space>
      <span><WarningOutlined /></span>
      <span className="errorMsg">{wrapAsHtml(errorMsg)}</span>
    </Space>
  </div>);
};
 
export default ErrorMsg;