"index.cdd4afe9.css" did not exist on "a46399a52d3df9561f3df407039d7b99913434d9"
RightContent.tsx 1.55 KB
Newer Older
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
1
import { ConnectProps, ConnectState } from '@/models/connect';
duanledexianxianxian's avatar
duanledexianxianxian committed
2
import { Icon, Tooltip, message } from 'antd';
3
import Avatar from './AvatarDropdown';
jim's avatar
jim committed
4
import HeaderSearch from '../HeaderSearch';
5
import React from 'react';
6
import SelectLang from '../SelectLang';
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
7
import { connect } from 'dva';
8 9
import { formatMessage } from 'umi-plugin-react/locale';
import styles from './index.less';
duanledexianxianxian's avatar
duanledexianxianxian committed
10
import NoticeIconView from './NoticeIconView';
duanledexianxianxian's avatar
duanledexianxianxian committed
11
import DefaultSettings from 'config/defaultSettings';
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
12

何乐's avatar
何乐 committed
13 14
export type SiderTheme = 'light' | 'dark';
export interface GlobalHeaderRightProps extends ConnectProps {
15
  theme?: SiderTheme;
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
16
  layout: 'sidemenu' | 'topmenu';
17
}
何乐's avatar
何乐 committed
18

duanledexianxianxian's avatar
duanledexianxianxian committed
19 20 21 22 23
const goHelpPage = (e: React.MouseEvent) => {
  e.preventDefault();
  message.info('go go  go! help page.');
};

24 25 26
const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = props => {
  const { theme, layout } = props;
  let className = styles.right;
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
27

28 29 30
  if (theme === 'dark' && layout === 'topmenu') {
    className = `${styles.right}  ${styles.dark}`;
  }
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
31

32 33 34 35 36 37 38
  return (
    <div className={className}>
      <Tooltip
        title={formatMessage({
          id: 'component.globalHeader.help',
        })}
      >
duanledexianxianxian's avatar
duanledexianxianxian committed
39
        <a href="#" className={styles.action} onClick={goHelpPage}>
40 41 42
          <Icon type="question-circle-o" />
        </a>
      </Tooltip>
duanledexianxianxian's avatar
duanledexianxianxian committed
43 44
      <NoticeIconView />
      <Avatar menu />
duanledexianxianxian's avatar
duanledexianxianxian committed
45
      <SelectLang className={styles.action} locales={DefaultSettings.locales} />
46 47 48
    </div>
  );
};
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
49

ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
50 51 52
export default connect(({ settings }: ConnectState) => ({
  theme: settings.navTheme,
  layout: settings.layout,
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
53
}))(GlobalHeaderRight);