ChapterCard.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { Row, Col } from "antd";
  2. import { Typography } from "antd";
  3. import TimeShow from "../utilities/TimeShow";
  4. import TocPath from "../corpus/TocPath";
  5. import TagArea from "../tag/TagArea";
  6. import type { TagNode } from "../tag/TagArea";
  7. import type { ChannelInfoProps } from "../api/Channel";
  8. import ChannelListItem from "../channel/ChannelListItem";
  9. const { Title, Paragraph, Link, Text } = Typography;
  10. export interface ChapterData {
  11. Title: string;
  12. PaliTitle: string;
  13. Path: string;
  14. Book: number;
  15. Paragraph: number;
  16. Summary: string;
  17. Tag: TagNode[];
  18. Channel: ChannelInfoProps;
  19. CreatedAt: string;
  20. UpdatedAt: string;
  21. Hit: number;
  22. Like: number;
  23. }
  24. interface IWidgetChapterCard {
  25. data: ChapterData;
  26. }
  27. const Widget = ({ data }: IWidgetChapterCard) => {
  28. const path = JSON.parse(data.Path);
  29. const tags = data.Tag;
  30. return (
  31. <>
  32. <Row>
  33. <Col>
  34. <Row>
  35. <Col span={16}>
  36. <Title level={5}>
  37. <Link>{data.Title}</Link>
  38. </Title>
  39. <Text type="secondary">{data.PaliTitle}</Text>
  40. <TocPath data={path} />
  41. </Col>
  42. <Col span={8}>进度条</Col>
  43. </Row>
  44. <Row>
  45. <Col>
  46. <Paragraph
  47. ellipsis={{
  48. rows: 2,
  49. expandable: false,
  50. symbol: "more",
  51. }}
  52. >
  53. {data.Summary}
  54. </Paragraph>
  55. </Col>
  56. </Row>
  57. <Row>
  58. <Col span={16}>
  59. <TagArea data={tags} />
  60. </Col>
  61. <Col span={5}>
  62. <ChannelListItem data={data.Channel} />
  63. </Col>
  64. <Col span={3}>
  65. <TimeShow time={data.UpdatedAt} title="UpdatedAt" />
  66. </Col>
  67. </Row>
  68. </Col>
  69. </Row>
  70. </>
  71. );
  72. };
  73. export default Widget;