import AlertBlockInfo from '@/components/alert-info/block'; import { CloseOutlined } from '@ant-design/icons'; import { isArray } from 'lodash'; import React, { useMemo } from 'react'; import styled from 'styled-components'; interface CompatibilityAlertProps { warningStatus: { show: boolean; title?: string; isHtml?: boolean; message: string | string[]; }; contentStyle?: React.CSSProperties; showClose?: boolean; onClose?: () => void; } const DivWrapper = styled.div` position: relative; padding-inline: 12px; `; const CloseWrapper = styled.div` position: absolute; top: 6px; right: 18px; cursor: pointer; `; const MessageWrapper = styled.div` display: flex; flex-direction: column; font-size: var(--font-size-small); gap: 4px; `; const CompatibilityAlert: React.FC = (props) => { const { warningStatus, contentStyle, showClose, onClose } = props; const { title, show, message, isHtml } = warningStatus; const renderMessage = useMemo(() => { if (!message || !show) { return ''; } if (isHtml) { return ( ); } if (typeof message === 'string') { return message; } if (isArray(message)) { return ( {message.map((item, index) => (
{item}
))}
); } return ''; }, [message, show]); return ( show && ( {showClose && ( )} ) ); }; export default CompatibilityAlert;