index.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* eslint-disable */
  2. import { Tag, Space } from 'antd'
  3. // import { QuestionCircleOutlined } from '@ant-design/icons'
  4. import React from 'react'
  5. import { useModel, SelectLang } from 'umi'
  6. import Avatar from './AvatarDropdown'
  7. // import HeaderSearch from '../HeaderSearch'
  8. import styles from './index.less'
  9. const ENVTagColor = {
  10. dev: 'orange',
  11. test: 'green',
  12. pre: '#87d068'
  13. }
  14. const GlobalHeaderRight: React.FC = () => {
  15. const { initialState } = useModel('@@initialState')
  16. if (!initialState || !initialState.settings) {
  17. return null
  18. }
  19. const { navTheme, layout } = initialState.settings
  20. let className = styles.right
  21. if ((navTheme === 'dark' && layout === 'top') || layout === 'mix') {
  22. className = `${styles.right} ${styles.dark}`
  23. }
  24. return (
  25. <Space className={className}>
  26. {/* <HeaderSearch
  27. className={`${styles.action} ${styles.search}`}
  28. placeholder="站内搜索"
  29. defaultValue="umi ui"
  30. options={[
  31. { label: <a href="https://umijs.org/zh/guide/umi-ui.html">umi ui</a>, value: 'umi ui' },
  32. {
  33. label: <a href="next.ant.design">Ant Design</a>,
  34. value: 'Ant Design',
  35. },
  36. {
  37. label: <a href="https://protable.ant.design/">Pro Table</a>,
  38. value: 'Pro Table',
  39. },
  40. {
  41. label: <a href="https://prolayout.ant.design/">Pro Layout</a>,
  42. value: 'Pro Layout',
  43. },
  44. ]}
  45. onSearch={value => {
  46. console.log('input', value);
  47. }}
  48. /> */}
  49. {/* <span
  50. className={styles.action}
  51. onClick={() => {
  52. window.open('https://pro.ant.design/docs/getting-started');
  53. }}
  54. >
  55. <QuestionCircleOutlined />
  56. </span> */}
  57. <Avatar />
  58. {REACT_APP_ENV && REACT_APP_ENV !== 'prod' && (
  59. <span>
  60. <Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag>
  61. </span>
  62. )}
  63. <SelectLang className={styles.action} />
  64. </Space>
  65. )
  66. }
  67. export default GlobalHeaderRight
  68. export type SiderTheme = 'light' | 'dark'