import { Space } from "antd";
import { QuestionCircleOutlined } from "@ant-design/icons";
import React from "react";
import { useModel, SelectLang } from "umi";
import Avatar from "./AvatarDropdown";
import HeaderSearch from "../HeaderSearch";
import styles from "./index.less";
import { MenuUnfoldOutlined, MenuFoldOutlined } from '@ant-design/icons'

const GlobalHeaderRight = () => {
  const { initialState, setInitialState } = useModel("@@initialState");
  const { collapsed } = initialState;
  if (!initialState || !initialState.settings) {
    return null;
  }

  const { navTheme, layout } = initialState.settings;
  let className = styles.right;

  if ((navTheme === "dark" && layout === "top") || layout === "mix") {
    className = `${styles.right}  ${styles.dark}`;
  }

  return (
    <Space className={className}>
      <div
        style={{ color: "#000", fontSize: 20, paddingLeft: 12 }}
        onClick={() => { }}
      >
        {collapsed ? (
          <MenuUnfoldOutlined
            style={{ cursor: "pointer" }}
            onClick={() => {
              setInitialState(s => ({ ...s, collapsed: !collapsed }));
            }}
          />
        ) : (
          <MenuFoldOutlined
            style={{ cursor: "pointer" }}
            onClick={() => {
              setInitialState(s => ({ ...s, collapsed: !collapsed }));
            }}
          />
        )}
      </div>
      <Avatar />
    </Space>
  );
};

export default GlobalHeaderRight;
