AnthologyCard.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { Link } from "react-router-dom";
  2. import { Row, Col } from "antd";
  3. import { Card } from "antd";
  4. import { Typography } from "antd";
  5. import StudioName from "../auth/StudioName";
  6. import type { IStudio } from "../auth/StudioName";
  7. import type { ListNodeData } from "../studio/EditableTree";
  8. const { Title, Text } = Typography;
  9. export interface IArticleData {
  10. id: string;
  11. title: string;
  12. subTitle: string;
  13. summary: string;
  14. created_at: string;
  15. updated_at: string;
  16. }
  17. export interface IAnthologyData {
  18. id: string;
  19. title: string;
  20. subTitle: string;
  21. summary: string;
  22. articles: ListNodeData[];
  23. studio: IStudio;
  24. created_at: string;
  25. updated_at: string;
  26. }
  27. interface IWidgetAnthologyCard {
  28. data: IAnthologyData;
  29. }
  30. const Widget = (prop: IWidgetAnthologyCard) => {
  31. const articleList = prop.data.articles.map((item, id) => {
  32. return <div key={id}>{item.title}</div>;
  33. });
  34. return (
  35. <>
  36. <Card hoverable bordered={false} style={{ width: "100%" }}>
  37. <Title level={4}>
  38. <Link to={`/anthology/${prop.data.id}`}>{prop.data.title}</Link>
  39. </Title>
  40. <div>
  41. <Text type="secondary">{prop.data.subTitle}</Text>
  42. </div>
  43. <div>
  44. <Text>{prop.data.summary}</Text>
  45. </div>
  46. <Link to={`/blog/${prop.data.studio.studioName}/anthology`}>
  47. <StudioName data={prop.data.studio} />
  48. </Link>
  49. <Row>
  50. <Col flex={"100px"}>Content</Col>
  51. <Col flex={"auto"}>{articleList}</Col>
  52. </Row>
  53. </Card>
  54. </>
  55. );
  56. };
  57. export default Widget;