update-footerconfig

This commit is contained in:
xiyang.bai
2021-08-11 19:52:28 +08:00
parent 2a2b6306b8
commit 83b808dcb4
4 changed files with 39 additions and 11 deletions

View File

@@ -14,12 +14,26 @@ import {
ContainerWrapper, ContainerWrapper,
Control, Control,
} from 'dooringx-lib'; } from 'dooringx-lib';
import { FormattedMessage } from 'react-intl';
import { InsertRowBelowOutlined } from '@ant-design/icons';
import { useContext } from 'react'; import { useContext } from 'react';
import { configContext } from '@/layouts'; import { configContext } from '@/layouts';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { PREVIEWSTATE } from '@/constant'; import { PREVIEWSTATE } from '@/constant';
import { Button, Popover } from 'antd';
export const HeaderHeight = '40px'; export const HeaderHeight = '40px';
const footerConfig = function () {
return (
<>
<Popover content={'快捷键'} title={null} trigger="hover">
<Button type="text" icon={<InsertRowBelowOutlined />}></Button>
</Popover>
<Popover content={'快捷键'} title={null} trigger="hover">
<Button type="text" icon={<InsertRowBelowOutlined />}></Button>
</Popover>
</>
);
};
export default function IndexPage() { export default function IndexPage() {
const config = useContext(configContext); const config = useContext(configContext);
@@ -35,21 +49,20 @@ export default function IndexPage() {
return ( return (
<div {...innerContainerDragUp(config)}> <div {...innerContainerDragUp(config)}>
<div style={{ height: HeaderHeight }}> <div style={{ height: HeaderHeight }}>
head <Button
<button
onClick={() => { onClick={() => {
window.open('/iframe'); window.open('/iframe');
}} }}
> >
go preview iframe
</button> </Button>
<button <Button
onClick={() => { onClick={() => {
window.open('/preview'); window.open('/preview');
}} }}
> >
go preview
</button> </Button>
</div> </div>
<div <div
style={{ style={{
@@ -61,7 +74,7 @@ export default function IndexPage() {
}} }}
> >
<div style={{ height: '100%' }}> <div style={{ height: '100%' }}>
<LeftConfig config={config}></LeftConfig> <LeftConfig footerConfig={footerConfig()} config={config}></LeftConfig>
</div> </div>
<ContainerWrapper config={config}> <ContainerWrapper config={config}>

View File

@@ -36,7 +36,7 @@ export const defaultConfig: Partial<InitConfig> = {
{ {
type: 'basic', type: 'basic',
icon: <HighlightOutlined />, icon: <HighlightOutlined />,
displayName: '基础组件', displayName: '基础',
}, },
{ {
type: 'xxc', type: 'xxc',

View File

@@ -15,6 +15,7 @@ import styles from '../index.less';
interface LeftConfigProps { interface LeftConfigProps {
config: UserConfig; config: UserConfig;
footerConfig?: ReactNode;
} }
/** /**
@@ -153,10 +154,18 @@ function LeftConfig(props: LeftConfigProps) {
<Menu style={{ flex: 1 }} defaultSelectedKeys={[menuSelect]} mode="vertical"> <Menu style={{ flex: 1 }} defaultSelectedKeys={[menuSelect]} mode="vertical">
{leftMapRenderListCategory.map((v, i) => { {leftMapRenderListCategory.map((v, i) => {
return ( return (
<Menu.Item key={i} onClick={() => setMenuSelect(i + '')} icon={v.icon}></Menu.Item> <Menu.Item
key={i}
onClick={() => setMenuSelect(i + '')}
icon={v.icon}
className={`${styles.menuStyle}`}
>
{v.displayName}
</Menu.Item>
); );
})} })}
</Menu> </Menu>
<div className={`${styles.menu_footer}`}>{props.footerConfig}</div>
<Menu selectedKeys={[]}> <Menu selectedKeys={[]}>
<Menu.Item <Menu.Item
key="1" key="1"

View File

@@ -163,6 +163,12 @@
} }
} }
.menuStyle {
display: flex !important;
flex-direction: column !important;
justify-content: center !important;
height: auto !important;
}
.menu_footer { .menu_footer {
display: flex; display: flex;
flex-direction: column; flex-direction: column;