@logicflow/dumi-theme-simple
Version:
Simple website theme based on dumi2.
52 lines • 1.72 kB
JavaScript
import React from 'react';
import { Link, useLocale } from 'dumi';
import { ic } from "../hooks";
import styles from "./News.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'];
export var News = function News(_ref) {
var _ref$index = _ref.index,
index = _ref$index === void 0 ? 0 : _ref$index,
type = _ref.type,
title = _ref.title,
date = _ref.date,
subTitle = _ref.subTitle,
img = _ref.img,
_ref$link = _ref.link,
link = _ref$link === void 0 ? '' : _ref$link;
var lang = useLocale().id;
var children = /*#__PURE__*/_jsx("div", {
className: styles.container,
children: /*#__PURE__*/_jsxs("div", {
className: styles.content,
children: [/*#__PURE__*/_jsxs("p", {
className: styles.description,
children: [img && /*#__PURE__*/_jsx("img", {
src: img,
alt: "message_title"
}), type ? "".concat(ic(type), " \u2027 ") : '', ic(title)]
}), date && /*#__PURE__*/_jsx("p", {
className: styles.date,
children: date
}), subTitle && /*#__PURE__*/_jsx("p", {
className: styles.subTitle,
children: ic(subTitle)
})]
})
});
if (link.startsWith('http')) {
return /*#__PURE__*/_jsx("a", {
href: link,
target: "_blank",
rel: "noopener noreferrer",
className: styles.news,
children: children
});
}
return /*#__PURE__*/_jsx(Link, {
to: link[lang] ? link[lang] : link,
className: styles.news,
children: children
});
};