| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- import { Link } from "react-router-dom";
- import { Layout, Col, Row, Space } from "antd";
- import { useIntl } from "react-intl";
- import type { MenuProps } from "antd";
- import { Menu } from "antd";
- import img_banner from "../../assets/library/images/wikipali_logo_library.svg";
- import UiLangSelect from "../general/UiLangSelect";
- import SignInAvatar from "../auth/SignInAvatar";
- import ToStudio from "../auth/ToStudio";
- const { Header } = Layout;
- const onClick: MenuProps["onClick"] = (e) => {
- console.log("click ", e);
- };
- type IWidgetHeadBar = {
- selectedKeys?: string;
- };
- const Widget = ({ selectedKeys = "" }: IWidgetHeadBar) => {
- //Library head bar
- const intl = useIntl(); //i18n
- // TODO
- const items: MenuProps["items"] = [
- {
- label: (
- <Link to="/community/list">
- {intl.formatMessage({
- id: "columns.library.community.title",
- })}
- </Link>
- ),
- key: "community",
- },
- {
- label: (
- <Link to="/palicanon/list">
- {intl.formatMessage({
- id: "columns.library.palicanon.title",
- })}
- </Link>
- ),
- key: "palicanon",
- },
- {
- label: (
- <Link to="/course/list">
- {intl.formatMessage({ id: "columns.library.course.title" })}
- </Link>
- ),
- key: "course",
- },
- {
- label: (
- <Link to="/dict/recent">
- {intl.formatMessage({ id: "columns.library.dict.title" })}
- </Link>
- ),
- key: "dict",
- },
- {
- label: (
- <Link to="/anthology/list">
- {intl.formatMessage({
- id: "columns.library.anthology.title",
- })}
- </Link>
- ),
- key: "anthology",
- },
- {
- label: (
- <a
- href="https://asset-hk.wikipali.org/help/zh-Hans"
- target="_blank"
- rel="noreferrer"
- >
- {intl.formatMessage({ id: "columns.library.help.title" })}
- </a>
- ),
- key: "help",
- },
- {
- label: (
- <Space>
- {intl.formatMessage({ id: "columns.library.more.title" })}
- </Space>
- ),
- key: "more",
- children: [
- {
- label: (
- <a
- href="https://asset-hk.wikipali.org/handbook/zh-Hans"
- target="_blank"
- rel="noreferrer"
- >
- {intl.formatMessage({
- id: "columns.library.palihandbook.title",
- })}
- </a>
- ),
- key: "palihandbook",
- },
- {
- label: (
- <Link to="/calendar">
- {intl.formatMessage({
- id: "columns.library.calendar.title",
- })}
- </Link>
- ),
- key: "calendar",
- },
- {
- label: (
- <Link to="/convertor">
- {intl.formatMessage({
- id: "columns.library.convertor.title",
- })}
- </Link>
- ),
- key: "convertor",
- },
- {
- label: (
- <Link to="/statistics">
- {intl.formatMessage({
- id: "columns.library.statistics.title",
- })}
- </Link>
- ),
- key: "statistics",
- },
- ],
- },
- ];
- return (
- <Header className="header">
- <Row justify="space-between">
- <Col flex="100px">
- <Link to="/">
- <img
- alt="code"
- style={{ height: "3em" }}
- src={img_banner}
- />
- </Link>
- </Col>
- <Col span={8}>
- <Menu
- onClick={onClick}
- selectedKeys={[selectedKeys]}
- mode="horizontal"
- theme="dark"
- items={items}
- />
- </Col>
- <Col span={4}>
- <Space>
- <ToStudio />
- <SignInAvatar />
- <UiLangSelect />
- </Space>
- </Col>
- </Row>
- </Header>
- );
- };
- export default Widget;
|