import * as React from 'react'; import type { Extra, Icon } from './util'; import useSiteToken from '../../../hooks/useSiteToken'; import { Col, Row, Card, Typography, Skeleton } from 'antd'; import { css } from '@emotion/react'; const useStyle = () => { const { token } = useSiteToken(); return { card: css` border: ${token.lineWidth}px solid ${token.colorBorderSecondary}; border-radius: ${token.borderRadiusLG}px; padding-block: ${token.paddingMD}px; padding-inline: ${token.paddingLG}px; flex: 1 1 0; width: 33%; display: flex; flex-direction: column; align-items: stretch; text-decoration: none; transition: all ${token.motionDurationSlow}; background: ${token.colorBgContainer}; &:hover { box-shadow: ${token.boxShadowCard}; } `, }; }; export interface BannerRecommendsProps { extras?: Extra[]; icons?: Icon[]; } export default function BannerRecommends({ extras = [], icons = [] }: BannerRecommendsProps) { const style = useStyle(); const first3 = extras.length === 0 ? Array(3).fill(null) : extras.slice(0, 3); const { token } = useSiteToken(); return (
{first3.map((extra, index) => { if (!extra) { return ; } const icon = icons.find((icon) => icon.name === extra.source); return ( {extra.title} {extra.description}
{extra.date} {icon && }
); })}
); }