@logicflow/dumi-theme-simple
Version:
Simple website theme based on dumi2.
47 lines • 1.51 kB
JavaScript
import React from 'react';
import { Link } from 'dumi';
import styles from "./Notification.module.less";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var numberImages = ['https://gw.alipayobjects.com/zos/antfincdn/IqREAm36K7/1.png', 'https://gw.alipayobjects.com/zos/antfincdn/3fG1Iqjfnz/2.png'];
var Notification = function Notification(_ref) {
var _ref$index = _ref.index,
index = _ref$index === void 0 ? 0 : _ref$index,
type = _ref.type,
title = _ref.title,
date = _ref.date,
_ref$link = _ref.link,
link = _ref$link === void 0 ? '' : _ref$link;
var children = /*#__PURE__*/_jsxs("div", {
className: styles.container,
children: [/*#__PURE__*/_jsx("img", {
className: styles.number,
src: numberImages[index],
alt: index.toString()
}), /*#__PURE__*/_jsxs("div", {
className: styles.content,
children: [/*#__PURE__*/_jsxs("p", {
className: styles.description,
children: [type, " \u2027 ", title]
}), /*#__PURE__*/_jsx("p", {
className: styles.date,
children: date
})]
})]
});
if (link.startsWith('http')) {
return /*#__PURE__*/_jsx("a", {
href: link,
target: "_blank",
rel: "noopener noreferrer",
className: styles.notification,
children: children
});
}
return /*#__PURE__*/_jsx(Link, {
to: link,
className: styles.notification,
children: children
});
};
export default Notification;