Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
fix: 移除文档贡献者 label, 否则没有贡献者也会展示,有点丑 (#315)
Browse files Browse the repository at this point in the history
Co-authored-by: xinming <xinming.lxj@antfin.com>
  • Loading branch information
visiky and xinming committed Mar 31, 2021
1 parent 1c28260 commit 9f4644e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 4 additions & 1 deletion @antv/gatsby-theme-antv/site/components/Contributors.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import _ from 'lodash';
import { Avatar, Tooltip } from 'antd';
import { useTranslation } from 'react-i18next';
import styles from './Contributors.module.less';

type Props = {
Expand All @@ -15,6 +16,8 @@ type Props = {
const Contributors: React.FC<Props> = (props) => {
const { contributors, style } = props;

const { t } = useTranslation();

const openGithub = (githubId: string) => {
window.open(`https://github.com/${githubId}`);
};
Expand All @@ -23,7 +26,7 @@ const Contributors: React.FC<Props> = (props) => {
<div className={styles.docsContributors} style={style || {}}>
{_.map(contributors, ({ author, avatar, github }) => {
return (
<Tooltip title={author}>
<Tooltip title={`${t('贡献者')}: ${author}`}>
<span onClick={() => openGithub(github)}>
<Avatar size={24} src={avatar} />
</span>
Expand Down
6 changes: 4 additions & 2 deletions @antv/gatsby-theme-antv/site/templates/document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,10 @@ export default function Template({
</h1>
<div className={styles.meta}>
<ReadingTime readingTime={readingTime} />
<span className={styles.contributorsLabel}>{t('贡献者')}:</span>
<Contributors contributors={frontmatter.contributors} />
<Contributors
style={{ marginLeft: '8px' }}
contributors={frontmatter.contributors}
/>
</div>
<div className={styles.content}>{renderAst(htmlAst)}</div>
<div>
Expand Down
4 changes: 0 additions & 4 deletions @antv/gatsby-theme-antv/site/templates/markdown.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,6 @@
.contentReset;
}
}

.contributors-label {
margin: 0 8px;
}
}

// reference yuque UI
Expand Down

0 comments on commit 9f4644e

Please sign in to comment.