dumi-theme-antd-web3
Version:
Ant Design 5.0 官网风格类似的 dumi2 主题插件
44 lines • 1.31 kB
JavaScript
import React from 'react';
import { Avatar, Skeleton, Tooltip } from 'antd';
import { jsx as ___EmotionJSX } from "@emotion/react";
var AvatarPlaceholder = function AvatarPlaceholder(_ref) {
var _ref$num = _ref.num,
num = _ref$num === void 0 ? 3 : _ref$num;
return ___EmotionJSX("li", null, Array.from({
length: num
}).map(function (_, i) {
return ___EmotionJSX(Skeleton.Avatar, {
size: "small",
active: true,
key: i,
style: {
marginInlineStart: i === 0 ? 0 : -8
}
});
}));
};
var ContributorAvatar = function ContributorAvatar(props) {
var _props$item = props.item,
_props$item2 = _props$item === void 0 ? {} : _props$item,
username = _props$item2.username,
url = _props$item2.url,
loading = props.loading;
if (loading) {
return ___EmotionJSX(AvatarPlaceholder, null);
}
if (username !== null && username !== void 0 && username.includes('github-actions')) {
return null;
}
return ___EmotionJSX(Tooltip, {
title: username
}, ___EmotionJSX("li", null, ___EmotionJSX("a", {
href: "https://github.com/".concat(username),
target: "_blank",
rel: "noopener noreferrer"
}, ___EmotionJSX(Avatar, {
size: "small",
src: url,
alt: username
}, username))));
};
export default ContributorAvatar;