github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/dm/ui/src/uikit/message.tsx (about)

     1  import React from 'react'
     2  import { message as antdMessage, MessageArgsProps } from 'antd'
     3  import { CloseOutlined } from '@ant-design/icons'
     4  
     5  const error = (props: Pick<MessageArgsProps, 'content' | 'duration'>) => {
     6    let hide: () => void
     7  
     8    const onClose = () => {
     9      hide()
    10    }
    11  
    12    hide = antdMessage.error({
    13      ...props,
    14      content: (
    15        <span>
    16          {props.content}
    17          <CloseOutlined
    18            onClick={onClose}
    19            style={{ color: '#999', cursor: 'pointer', marginLeft: 6 }}
    20          />
    21        </span>
    22      ),
    23    })
    24  }
    25  
    26  export const message = {
    27    ...antdMessage,
    28    error,
    29  }