BlogNav.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { Link } from "react-router";
  2. import { useIntl } from "react-intl";
  3. import { HomeOutlined } from "@ant-design/icons";
  4. import type { MenuProps } from "antd";
  5. import { Menu, Row, Col } from "antd";
  6. import {
  7. AnthologyOutLinedIcon,
  8. CourseOutLinedIcon,
  9. TermOutlinedIcon,
  10. TranslationOutLinedIcon,
  11. } from "../../assets/icon";
  12. interface IWidgetBlogNav {
  13. selectedKey: string;
  14. studio?: string;
  15. }
  16. const BlogNavWidget = ({ selectedKey, studio }: IWidgetBlogNav) => {
  17. //Library head bar
  18. const intl = useIntl(); //i18n
  19. // TODO 换图标
  20. const items: MenuProps["items"] = [
  21. {
  22. label: (
  23. <Link to={`/blog/${studio}/overview`}>
  24. {intl.formatMessage({ id: "blog.overview" })}
  25. </Link>
  26. ),
  27. key: "overview",
  28. icon: <HomeOutlined />,
  29. },
  30. {
  31. label: (
  32. <Link to={`/blog/${studio}/palicanon`}>
  33. {intl.formatMessage({ id: "blog.palicanon" })}
  34. </Link>
  35. ),
  36. key: "palicanon",
  37. icon: <TranslationOutLinedIcon />,
  38. },
  39. {
  40. label: (
  41. <Link to={`/blog/${studio}/course`}>
  42. {intl.formatMessage({ id: "columns.library.course.title" })}
  43. </Link>
  44. ),
  45. key: "course",
  46. icon: <CourseOutLinedIcon />,
  47. },
  48. {
  49. label: (
  50. <Link to={`/blog/${studio}/anthology`}>
  51. {intl.formatMessage({ id: "columns.library.anthology.title" })}
  52. </Link>
  53. ),
  54. key: "anthology",
  55. icon: <AnthologyOutLinedIcon />,
  56. },
  57. {
  58. label: (
  59. <Link to={`/blog/${studio}/term`}>
  60. {intl.formatMessage({ id: "columns.library.term.title" })}
  61. </Link>
  62. ),
  63. key: "term",
  64. icon: <TermOutlinedIcon />,
  65. },
  66. ];
  67. return (
  68. <Row>
  69. <Col flex="300px"></Col>
  70. <Col flex="auto">
  71. <Menu selectedKeys={[selectedKey]} mode="horizontal" items={items} />
  72. </Col>
  73. </Row>
  74. );
  75. };
  76. export default BlogNavWidget;