| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import { Link } from "react-router";
- import { Card } from "antd";
- import {
- AppstoreOutlined,
- LikeOutlined,
- FieldTimeOutlined,
- } from "@ant-design/icons";
- import { Space } from "antd";
- interface IIconParamListData {
- label: React.ReactNode;
- key: string;
- icon: React.ReactNode;
- }
- interface IWidgetIconParamList {
- data: IIconParamListData[];
- }
- const IconParamList = (prop: IWidgetIconParamList) => {
- return (
- <>
- <Space>
- {prop.data.map((item, id) => {
- return (
- <Space key={id}>
- {item.icon} {item.label}
- </Space>
- );
- })}
- </Space>
- </>
- );
- };
- export interface ITopArticleCardData {
- title: string;
- link: string;
- like: number;
- hit: number;
- updatedAt: string;
- }
- interface IWidgetTopArticleCard {
- data: ITopArticleCardData;
- }
- const TopArticleCardWidget = (prop: IWidgetTopArticleCard) => {
- const items: IIconParamListData[] = [
- {
- label: "经藏",
- key: "sutta",
- icon: <AppstoreOutlined />,
- },
- {
- label: prop.data.like,
- key: "like",
- icon: <LikeOutlined />,
- },
- {
- label: prop.data.updatedAt,
- key: "updated",
- icon: <FieldTimeOutlined />,
- },
- ];
- return (
- <>
- <Card>
- <h4>
- <Link to={prop.data.link}>{prop.data.title}</Link>
- </h4>
- <div>
- <IconParamList data={items} />
- </div>
- </Card>
- </>
- );
- };
- export default TopArticleCardWidget;
|