index.tsx 2.1 KB

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