mirror of
https://github.com/duckietm/Nitro-Cool-UI.git
synced 2025-06-21 22:36:58 +00:00
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
import { FC } from 'react';
|
|
import { NotificationBubbleItem, OpenUrl } from '../../../../api';
|
|
import { Flex, LayoutNotificationBubbleView, LayoutNotificationBubbleViewProps, Text } from '../../../../common';
|
|
|
|
export interface NotificationDefaultBubbleViewProps extends LayoutNotificationBubbleViewProps {
|
|
item: NotificationBubbleItem;
|
|
}
|
|
|
|
export const NotificationDefaultBubbleView: FC<NotificationDefaultBubbleViewProps> = props => {
|
|
// Do not destructure key!
|
|
const { item = null, onClose = null, ...restProps } = props;
|
|
|
|
const htmlText = item.message.replace(/\r\n|\r|\n/g, '<br />');
|
|
|
|
return (
|
|
<LayoutNotificationBubbleView onClose={ onClose } gap={ 2 } alignItems="center"
|
|
onClick={ event => (item.linkUrl && item.linkUrl.length && OpenUrl(item.linkUrl)) }
|
|
{ ...restProps }>
|
|
<Flex center className="bubble-image-container">
|
|
{ (item.iconUrl && item.iconUrl.length) &&
|
|
<img className="no-select" src={ item.iconUrl } alt="" /> }
|
|
</Flex>
|
|
<Text wrap variant="white" dangerouslySetInnerHTML={ { __html: htmlText } } />
|
|
</LayoutNotificationBubbleView>
|
|
);
|
|
};
|