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

fix: 移除文档贡献者 label, 否则没有贡献者也会展示,有点丑 #315

Merged
merged 1 commit into from
Mar 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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