mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
775d1800bb
* chore(deps-dev): bump eslint-config-prettier from 6.15.0 to 7.0.0 Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.15.0 to 7.0.0. - [Release notes](https://github.com/prettier/eslint-config-prettier/releases) - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.15.0...v7.0.0) Signed-off-by: dependabot[bot] <support@github.com> * chore: fix eslint style * chore: prettier code style Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: afc163 <afc163@gmail.com>
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import * as React from 'react';
|
|
import { useIntl } from 'react-intl';
|
|
import { Card, Row, Col } from 'antd';
|
|
import { useSiteData } from './util';
|
|
import './MorePage.less';
|
|
|
|
type SourceType = 'zhihu' | 'yuque';
|
|
|
|
type Icons = Record<SourceType, string>;
|
|
|
|
interface MoreProps {
|
|
title: string;
|
|
description: string;
|
|
date: string;
|
|
img: string;
|
|
source: SourceType;
|
|
href: string;
|
|
icons?: Icons;
|
|
loading?: boolean;
|
|
}
|
|
|
|
const MoreCard = ({ title, description, date, img, source, href, icons, loading }: MoreProps) => (
|
|
<Col xs={24} sm={6}>
|
|
<a
|
|
href={href}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
onClick={() => {
|
|
window?.gtag('event', '点击', {
|
|
event_category: '首页文章',
|
|
event_label: href,
|
|
});
|
|
}}
|
|
>
|
|
<Card
|
|
hoverable
|
|
cover={loading ? undefined : <img alt={title} src={img} />}
|
|
loading={loading}
|
|
className="more-card"
|
|
>
|
|
<Card.Meta title={title} description={description} />
|
|
<div>
|
|
{date}
|
|
<span className="more-card-source">
|
|
{icons ? <img src={icons[source]} alt={source} /> : null}
|
|
</span>
|
|
</div>
|
|
</Card>
|
|
</a>
|
|
</Col>
|
|
);
|
|
|
|
export default function MorePage() {
|
|
const { locale } = useIntl();
|
|
const isZhCN = locale === 'zh-CN';
|
|
const list = useSiteData<MoreProps[]>('extras', isZhCN ? 'cn' : 'en');
|
|
const icons = useSiteData<Icons>('icons');
|
|
const loadingProps = { loading: true } as MoreProps;
|
|
return (
|
|
<Row gutter={[24, 32]}>
|
|
{(list || [loadingProps, loadingProps, loadingProps, loadingProps]).map((more, i) => (
|
|
<MoreCard key={more.title || i} {...more} icons={icons} />
|
|
))}
|
|
</Row>
|
|
);
|
|
}
|