123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import { Icon, Tooltip, Tag } from 'antd';
- import React from 'react';
- import { connect } from 'dva';
- import { formatMessage } from 'umi-plugin-react/locale';
- import Avatar from './AvatarDropdown';
- import HeaderSearch from '../HeaderSearch';
- import SelectLang from '../SelectLang';
- import styles from './index.less';
- const ENVTagColor = {
- dev: 'orange',
- test: 'green',
- pre: '#87d068',
- };
-
- const GlobalHeaderRight = (props) => {
- const { theme, layout } = props;
- let className = styles.right;
-
- if (theme === 'dark' && layout === 'topmenu') {
- className = `${styles.right} ${styles.dark}`;
- }
-
- return (
- <div className={className}>
- <HeaderSearch
- className={`${styles.action} ${styles.search}`}
- placeholder={formatMessage({
- id: 'component.globalHeader.search',
- })}
- defaultValue="umi ui"
- dataSource={[
- formatMessage({
- id: 'component.globalHeader.search.example1',
- }),
- formatMessage({
- id: 'component.globalHeader.search.example2',
- }),
- formatMessage({
- id: 'component.globalHeader.search.example3',
- }),
- ]}
- onSearch={() => {}}
- onPressEnter={() => {}}
- />
- <Tooltip
- title={formatMessage({
- id: 'component.globalHeader.help',
- })}
- >
- <a
- target="_blank"
- href="https://pro.ant.design/docs/getting-started"
- rel="noopener noreferrer"
- className={styles.action}
- >
- <Icon type="question-circle-o" />
- </a>
- </Tooltip>
- <Avatar />
- {REACT_APP_ENV && <Tag color={ENVTagColor[REACT_APP_ENV]}>{REACT_APP_ENV}</Tag>}
- <SelectLang className={styles.action} />
- </div>
- );
- };
-
- export default connect(({ settings }) => ({
- theme: settings.navTheme,
- layout: settings.layout,
- }))(GlobalHeaderRight);
|