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 = { name: string; href: 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) => (
{
window?.gtag('event', '点击', {
event_category: '首页文章',
event_label: href,
});
}}
>
}
loading={loading}
className="more-card"
>
{date}
{icons ? (
icon.name === source)?.href} alt={source} />
) : null}
);
export default function MorePage() {
const { locale } = useIntl();
const [{ extras, icons }, loading] = useSiteData();
const list = extras?.[locale === 'zh-CN' ? 'cn' : 'en'] || [];
const loadingProps = { loading: loading || list.length === 0 } as MoreProps;
return (
{(list || [loadingProps, loadingProps, loadingProps, loadingProps]).map(
(more: any, i: number) => (
),
)}
);
}