Commit c471e6c3 authored by afc163's avatar afc163 Committed by 陈帅

Add Tootlip fop options

parent c59842ca
...@@ -4,9 +4,9 @@ import styles from './GridContent.less'; ...@@ -4,9 +4,9 @@ import styles from './GridContent.less';
class GridContent extends PureComponent { class GridContent extends PureComponent {
render() { render() {
const { grid, children } = this.props; const { contentWidth, children } = this.props;
let className = `${styles.main}`; let className = `${styles.main}`;
if (grid === 'Fixed') { if (contentWidth === 'Fixed') {
className = `${styles.main} ${styles.wide}`; className = `${styles.main} ${styles.wide}`;
} }
return <div className={className}>{children}</div>; return <div className={className}>{children}</div>;
...@@ -14,5 +14,5 @@ class GridContent extends PureComponent { ...@@ -14,5 +14,5 @@ class GridContent extends PureComponent {
} }
export default connect(({ setting }) => ({ export default connect(({ setting }) => ({
grid: setting.grid, contentWidth: setting.contentWidth,
}))(GridContent); }))(GridContent);
...@@ -7,13 +7,13 @@ import GridContent from './GridContent'; ...@@ -7,13 +7,13 @@ import GridContent from './GridContent';
import styles from './index.less'; import styles from './index.less';
import MenuContext from '@/layouts/MenuContext'; import MenuContext from '@/layouts/MenuContext';
const PageHeaderWrapper = ({ children, grid, wrapperClassName, top, ...restProps }) => ( const PageHeaderWrapper = ({ children, contentWidth, wrapperClassName, top, ...restProps }) => (
<div style={{ margin: '-24px -24px 0' }} className={wrapperClassName}> <div style={{ margin: '-24px -24px 0' }} className={wrapperClassName}>
{top} {top}
<MenuContext.Consumer> <MenuContext.Consumer>
{value => ( {value => (
<PageHeader <PageHeader
wide={grid === 'Fixed'} wide={contentWidth === 'Fixed'}
home={<FormattedMessage id="menu.home" defaultMessage="Home" />} home={<FormattedMessage id="menu.home" defaultMessage="Home" />}
{...value} {...value}
key="pageheader" key="pageheader"
...@@ -37,5 +37,5 @@ const PageHeaderWrapper = ({ children, grid, wrapperClassName, top, ...restProps ...@@ -37,5 +37,5 @@ const PageHeaderWrapper = ({ children, grid, wrapperClassName, top, ...restProps
); );
export default connect(({ setting }) => ({ export default connect(({ setting }) => ({
grid: setting.grid, contentWidth: setting.contentWidth,
}))(PageHeaderWrapper); }))(PageHeaderWrapper);
import { Icon } from 'antd';
import React from 'react'; import React from 'react';
import { Tooltip, Icon } from 'antd';
import style from './index.less'; import style from './index.less';
const BlockChecbox = ({ value, onChange, list }) => ( const BlockChecbox = ({ value, onChange, list }) => (
<div className={style.blockChecbox} key={value}> <div className={style.blockChecbox} key={value}>
{list.map(item => ( {list.map(item => (
<div <Tooltip title={item.title} key={item.key}>
key={item.key} <div className={style.item} onClick={() => onChange(item.key)}>
className={style.item} <img src={item.url} alt={item.key} />
onClick={() => { <div
onChange(item.key); className={style.selectIcon}
}} style={{
> display: value === item.key ? 'block' : 'none',
<img src={item.url} alt={item.key} /> }}
<div >
className={style.selectIcon} <Icon type="check" />
style={{ </div>
display: value === item.key ? 'block' : 'none',
}}
>
<Icon type="check" />
</div> </div>
</div> </Tooltip>
))} ))}
</div> </div>
); );
......
import { Icon } from 'antd';
import React from 'react'; import React from 'react';
import { Tooltip, Icon } from 'antd';
import { formatMessage } from 'umi/locale';
import styles from './ThemeColor.less'; import styles from './ThemeColor.less';
const Tag = ({ color, check, ...rest }) => ( const Tag = ({ color, check, ...rest }) => (
...@@ -17,28 +18,53 @@ const ThemeColor = ({ colors, title, value, onChange }) => { ...@@ -17,28 +18,53 @@ const ThemeColor = ({ colors, title, value, onChange }) => {
let colorList = colors; let colorList = colors;
if (!colors) { if (!colors) {
colorList = [ colorList = [
'#F5222D', {
'#FA541C', key: 'dust',
'#FAAD14', color: '#F5222D',
'#13C2C2', },
'#52C41A', {
'#1890FF', key: 'volcano',
'#2F54EB', color: '#FA541C',
'#722ED1', },
{
key: 'sunset',
color: '#FAAD14',
},
{
key: 'cyan',
color: '#13C2C2',
},
{
key: 'green',
color: '#52C41A',
},
{
key: 'daybreak',
color: '#1890FF',
},
{
key: 'geekblue',
color: '#2F54EB',
},
{
key: 'purple',
color: '#722ED1',
},
]; ];
} }
return ( return (
<div className={styles.themeColor}> <div className={styles.themeColor}>
<h3 className={styles.title}>{title}</h3> <h3 className={styles.title}>{title}</h3>
<div className={styles.content}> <div className={styles.content}>
{colorList.map(color => ( {colorList.map(({ key, color }) => (
<Tag <Tooltip key={color} title={formatMessage({ id: `app.setting.themecolor.${key}` })}>
className={styles.colorBlock} <Tag
key={color} className={styles.colorBlock}
color={color} color={color}
check={value === color} check={value === color}
onClick={() => onChange && onChange(color)} onClick={() => onChange && onChange(color)}
/> />
</Tooltip>
))} ))}
</div> </div>
</div> </div>
......
...@@ -28,23 +28,23 @@ class SettingDrawer extends PureComponent { ...@@ -28,23 +28,23 @@ class SettingDrawer extends PureComponent {
getLayOutSetting = () => { getLayOutSetting = () => {
const { const {
setting: { grid, fixedHeader, layout, autoHideHeader, fixSiderbar }, setting: { contentWidth, fixedHeader, layout, autoHideHeader, fixSiderbar },
} = this.props; } = this.props;
return [ return [
{ {
title: formatMessage({ id: 'app.setting.gridmode' }), title: formatMessage({ id: 'app.setting.content-width' }),
action: [ action: [
<Select <Select
value={grid} value={contentWidth}
size="small" size="small"
onSelect={value => this.changeSetting('grid', value)} onSelect={value => this.changeSetting('contentWidth', value)}
style={{ width: 80 }} style={{ width: 80 }}
> >
<Select.Option value="Fixed"> <Select.Option value="Fixed">
{formatMessage({ id: 'app.setting.gridmode.fixed' })} {formatMessage({ id: 'app.setting.content-width.fixed' })}
</Select.Option> </Select.Option>
<Select.Option value="Fluid"> <Select.Option value="Fluid">
{formatMessage({ id: 'app.setting.gridmode.fluid' })} {formatMessage({ id: 'app.setting.content-width.fluid' })}
</Select.Option> </Select.Option>
</Select>, </Select>,
], ],
...@@ -89,7 +89,7 @@ class SettingDrawer extends PureComponent { ...@@ -89,7 +89,7 @@ class SettingDrawer extends PureComponent {
const nextState = { ...setting }; const nextState = { ...setting };
nextState[key] = value; nextState[key] = value;
if (key === 'layout') { if (key === 'layout') {
nextState.grid = value === 'topmenu' ? 'Fixed' : 'Fluid'; nextState.contentWidth = value === 'topmenu' ? 'Fixed' : 'Fluid';
} else if (key === 'fixedHeader' && !value) { } else if (key === 'fixedHeader' && !value) {
nextState.autoHideHeader = false; nextState.autoHideHeader = false;
} }
...@@ -140,10 +140,12 @@ class SettingDrawer extends PureComponent { ...@@ -140,10 +140,12 @@ class SettingDrawer extends PureComponent {
{ {
key: 'dark', key: 'dark',
url: 'https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg', url: 'https://gw.alipayobjects.com/zos/rmsportal/LCkqqYNmvBEbokSDscrm.svg',
title: formatMessage({ id: 'app.setting.pagestyle.dark' }),
}, },
{ {
key: 'light', key: 'light',
url: 'https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg', url: 'https://gw.alipayobjects.com/zos/rmsportal/jpRkZQMyYRryryPNtyIC.svg',
title: formatMessage({ id: 'app.setting.pagestyle.light' }),
}, },
]} ]}
value={navTheme} value={navTheme}
...@@ -165,10 +167,12 @@ class SettingDrawer extends PureComponent { ...@@ -165,10 +167,12 @@ class SettingDrawer extends PureComponent {
{ {
key: 'sidemenu', key: 'sidemenu',
url: 'https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg', url: 'https://gw.alipayobjects.com/zos/rmsportal/JopDzEhOqwOjeNTXkoje.svg',
title: formatMessage({ id: 'app.setting.sidemenu' }),
}, },
{ {
key: 'topmenu', key: 'topmenu',
url: 'https://gw.alipayobjects.com/zos/rmsportal/KDNDBbriJhLwuqMoxcAr.svg', url: 'https://gw.alipayobjects.com/zos/rmsportal/KDNDBbriJhLwuqMoxcAr.svg',
title: formatMessage({ id: 'app.setting.topmenu' }),
}, },
]} ]}
value={layout} value={layout}
......
...@@ -9,18 +9,18 @@ export default class TopNavHeader extends PureComponent { ...@@ -9,18 +9,18 @@ export default class TopNavHeader extends PureComponent {
super(props); super(props);
this.state = { this.state = {
maxWidth: (props.grid === 'Fixed' ? 1200 : window.innerWidth) - 324 - 165 - 4, maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 324 - 165 - 4,
}; };
} }
static getDerivedStateFromProps(props) { static getDerivedStateFromProps(props) {
return { return {
maxWidth: (props.grid === 'Fixed' ? 1200 : window.innerWidth) - 324 - 165 - 4, maxWidth: (props.contentWidth === 'Fixed' ? 1200 : window.innerWidth) - 324 - 165 - 4,
}; };
} }
render() { render() {
const { theme, grid, logo } = this.props; const { theme, contentWidth, logo } = this.props;
const { maxWidth } = this.state; const { maxWidth } = this.state;
return ( return (
<div className={`${styles.head} ${theme === 'light' ? styles.light : ''}`}> <div className={`${styles.head} ${theme === 'light' ? styles.light : ''}`}>
...@@ -28,7 +28,7 @@ export default class TopNavHeader extends PureComponent { ...@@ -28,7 +28,7 @@ export default class TopNavHeader extends PureComponent {
ref={ref => { ref={ref => {
this.maim = ref; this.maim = ref;
}} }}
className={`${styles.main} ${grid === 'Fixed' ? styles.wide : ''}`} className={`${styles.main} ${contentWidth === 'Fixed' ? styles.wide : ''}`}
> >
<div className={styles.left}> <div className={styles.left}>
<div className={styles.logo} key="logo" id="logo"> <div className={styles.logo} key="logo" id="logo">
......
...@@ -156,11 +156,23 @@ export default { ...@@ -156,11 +156,23 @@ export default {
'app.result.success.btn-project': 'View project', 'app.result.success.btn-project': 'View project',
'app.result.success.btn-print': 'Print', 'app.result.success.btn-print': 'Print',
'app.setting.pagestyle': 'Page style setting', 'app.setting.pagestyle': 'Page style setting',
'app.setting.pagestyle.dark': 'Dark style',
'app.setting.pagestyle.light': 'Light style',
'app.setting.content-width': 'Content Width', 'app.setting.content-width': 'Content Width',
'app.setting.content-width.fixed': 'Fixed', 'app.setting.content-width.fixed': 'Fixed',
'app.setting.content-width.fluid': 'Fluid', 'app.setting.content-width.fluid': 'Fluid',
'app.setting.themecolor': 'Theme Color', 'app.setting.themecolor': 'Theme Color',
'app.setting.themecolor.dust': 'Dust Red',
'app.setting.themecolor.volcano': 'Volcano',
'app.setting.themecolor.sunset': 'Sunset Orange',
'app.setting.themecolor.cyan': 'Cyan',
'app.setting.themecolor.green': 'Polar Green',
'app.setting.themecolor.daybreak': 'Daybreak Blue (default)',
'app.setting.themecolor.geekblue': 'Geek Glue',
'app.setting.themecolor.purple': 'Golden Purple',
'app.setting.navigationmode': 'Navigation Mode', 'app.setting.navigationmode': 'Navigation Mode',
'app.setting.sidemenu': 'Side Menu Layout',
'app.setting.topmenu': 'Top Menu Layout',
'app.setting.fixedheader': 'Fixed Header', 'app.setting.fixedheader': 'Fixed Header',
'app.setting.fixedsidebar': 'Fixed Sidebar', 'app.setting.fixedsidebar': 'Fixed Sidebar',
'app.setting.hideheader': 'Hidden Header when sliding ', 'app.setting.hideheader': 'Hidden Header when sliding ',
......
...@@ -152,13 +152,25 @@ export default { ...@@ -152,13 +152,25 @@ export default {
'app.result.success.btn-project': '查看项目', 'app.result.success.btn-project': '查看项目',
'app.result.success.btn-print': '打印', 'app.result.success.btn-print': '打印',
'app.setting.pagestyle': '整体风格设置', 'app.setting.pagestyle': '整体风格设置',
'app.setting.pagestyle.dark': '暗色菜单风格',
'app.setting.pagestyle.light': '亮色菜单风格',
'app.setting.content-width': '内容区域宽度', 'app.setting.content-width': '内容区域宽度',
'app.setting.content-width.fixed': '定宽', 'app.setting.content-width.fixed': '定宽',
'app.setting.content-width.fluid': '流式', 'app.setting.content-width.fluid': '流式',
'app.setting.themecolor': '主题色', 'app.setting.themecolor': '主题色',
'app.setting.themecolor.dust': '薄暮',
'app.setting.themecolor.volcano': '火山',
'app.setting.themecolor.sunset': '日暮',
'app.setting.themecolor.cyan': '明青',
'app.setting.themecolor.green': '极光绿',
'app.setting.themecolor.daybreak': '拂晓蓝(默认)',
'app.setting.themecolor.geekblue': '极客蓝',
'app.setting.themecolor.purple': '酱紫',
'app.setting.navigationmode': '导航模式', 'app.setting.navigationmode': '导航模式',
'app.setting.sidemenu': '侧边菜单布局',
'app.setting.topmenu': '顶部菜单布局',
'app.setting.fixedheader': '固定 Header', 'app.setting.fixedheader': '固定 Header',
'app.setting.fixedsidebar': '固定 Sidebar', 'app.setting.fixedsidebar': '固定侧边菜单',
'app.setting.hideheader': '下滑时隐藏 Header', 'app.setting.hideheader': '下滑时隐藏 Header',
'app.setting.othersettings': '其他设置', 'app.setting.othersettings': '其他设置',
'app.setting.weakmode': '色弱模式', 'app.setting.weakmode': '色弱模式',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment