AnthologyCard.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { Link } from "react-router";
  2. import { Row, Col } from "antd";
  3. import { Card } from "antd";
  4. import { Typography } from "antd";
  5. import StudioName from "../auth/Studio";
  6. import type { IStudio } from "../auth/Studio";
  7. import type { ListNodeData } from "./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 AnthologyCardWidget = (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
  37. hoverable
  38. bordered={false}
  39. style={{ width: "100%", borderRadius: 8 }}
  40. >
  41. <Title level={4}>
  42. <Link to={`/anthology/${prop.data.id}`}>{prop.data.title}</Link>
  43. </Title>
  44. <div>
  45. <Text type="secondary">{prop.data.subTitle}</Text>
  46. </div>
  47. <div>
  48. <Text>{prop.data.summary}</Text>
  49. </div>
  50. <Link to={`/blog/${prop.data.studio.studioName}/anthology`}>
  51. <StudioName data={prop.data.studio} />
  52. </Link>
  53. <Row>
  54. <Col flex={"100px"}>Content</Col>
  55. <Col flex={"auto"}>{articleList}</Col>
  56. </Row>
  57. </Card>
  58. </>
  59. );
  60. };
  61. export default AnthologyCardWidget;