HeadBar.tsx 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { Link } from "react-router-dom";
  2. import { Layout, Space } from 'antd';
  3. import { useIntl } from "react-intl";
  4. import type { MenuProps } from 'antd';
  5. import { Menu } from 'antd';
  6. const onClick: MenuProps['onClick'] = e => {
  7. console.log('click ', e);
  8. };
  9. type IWidgetHeadBar ={
  10. selectedKeys?: string
  11. }
  12. const Widget = ({selectedKeys = ''}: IWidgetHeadBar) => {
  13. //Library head bar
  14. const intl = useIntl();//i18n
  15. // TODO
  16. const items: MenuProps['items'] = [
  17. {
  18. label: (<Link to = "/community">{intl.formatMessage({ id: "columns.library.community.title" })}</Link>),
  19. key: 'community',
  20. },
  21. {
  22. label: (<Link to = "/palicanon">{intl.formatMessage({ id: "columns.library.palicanon.title" })}</Link>),
  23. key: 'palicanon',
  24. },
  25. {
  26. label: (<Link to = "/course">{intl.formatMessage({ id: "columns.library.course.title" })}</Link>),
  27. key: 'course',
  28. },
  29. {
  30. label: (<Link to = "/dict">{intl.formatMessage({ id: "columns.library.dict.title" })}</Link>),
  31. key: 'dict',
  32. },
  33. {
  34. label: (<Link to = "/anthology">{intl.formatMessage({ id: "columns.library.anthology.title" })}</Link>),
  35. key: 'anthology',
  36. },
  37. {
  38. label: (<a href = "https://asset-hk.wikipali.org/help/zh-Hans" target="_blank" rel="noreferrer">{intl.formatMessage({ id: "columns.library.help.title" })}</a>),
  39. key: 'help',
  40. },
  41. {
  42. label: (<Space>{intl.formatMessage({ id: "columns.library.more.title" })}</Space>),
  43. key: 'more',
  44. children: [
  45. {
  46. label: (<a href = "https://asset-hk.wikipali.org/handbook/zh-Hans" target="_blank" rel="noreferrer">{intl.formatMessage({ id: "columns.library.palihandbook.title" })}</a>),
  47. key: 'palihandbook',
  48. },
  49. {
  50. label: (<Link to = "/calendar">{intl.formatMessage({ id: "columns.library.calendar.title" })}</Link>),
  51. key: 'calendar',
  52. },
  53. {
  54. label: (<Link to = "/convertor">{intl.formatMessage({ id: "columns.library.convertor.title" })}</Link>),
  55. key: 'convertor',
  56. },
  57. {
  58. label: (<Link to = "/statistics">{intl.formatMessage({ id: "columns.library.statistics.title" })}</Link>),
  59. key: 'statistics',
  60. },
  61. ],
  62. },
  63. ];
  64. return (
  65. <Layout>
  66. <Menu onClick={onClick} selectedKeys={[selectedKeys]} mode="horizontal" theme="dark" items={items} />
  67. </Layout>
  68. );
  69. };
  70. export default Widget;