add: 左边增加收缩切换按钮

This commit is contained in:
zhangjinlong 2020-09-25 21:23:36 +08:00
parent cb60dfa9b5
commit 8e8926e3b1
5 changed files with 41 additions and 4 deletions

View File

@ -28,6 +28,7 @@ const { TabPane } = Tabs;
const Container = (props: { history?: any; location?: any; pstate?: any; dispatch?: any }) => { const Container = (props: { history?: any; location?: any; pstate?: any; dispatch?: any }) => {
const [scaleNum, setScale] = useState(1); const [scaleNum, setScale] = useState(1);
const [collapsed, setCollapsed] = useState(false);
const { pstate, dispatch } = props; const { pstate, dispatch } = props;
const pointData = pstate ? pstate.pointData : {}; const pointData = pstate ? pstate.pointData : {};
@ -39,6 +40,10 @@ const Container = (props: { history?: any; location?: any; pstate?: any; dispatc
setScale(1); setScale(1);
}; };
const toggleCollapsed = (checked: boolean) => {
setCollapsed(checked);
};
const CpIcon = { const CpIcon = {
base: <HighlightOutlined />, base: <HighlightOutlined />,
media: <PlayCircleOutlined />, media: <PlayCircleOutlined />,
@ -123,9 +128,10 @@ const Container = (props: { history?: any; location?: any; pstate?: any; dispatc
pointData={pointData} pointData={pointData}
clearData={clearData} clearData={clearData}
location={props.location} location={props.location}
toggleCollapsed={toggleCollapsed}
/> />
<div className={styles.container}> <div className={styles.container}>
<div className={styles.list}> <div className={!collapsed ? styles.list : styles.collapsed}>
<div className={styles.searchBar}> <div className={styles.searchBar}>
<Alert <Alert
banner banner
@ -195,6 +201,7 @@ const Container = (props: { history?: any; location?: any; pstate?: any; dispatc
canvasId={canvasId} canvasId={canvasId}
allType={allType} allType={allType}
/> />
<div className={styles.resetBall}> <div className={styles.resetBall}>
<ReloadOutlined onClick={() => setDragState({ x: 0, y: 0 })} /> <ReloadOutlined onClick={() => setDragState({ x: 0, y: 0 })} />
</div> </div>

View File

@ -1,5 +1,5 @@
import React, { useRef, memo } from 'react'; import React, { useRef, memo } from 'react';
import { Button, Input, Popover, Modal } from 'antd'; import { Button, Input, Popover, Modal, Switch } from 'antd';
import { import {
ArrowLeftOutlined, ArrowLeftOutlined,
MobileOutlined, MobileOutlined,
@ -28,10 +28,11 @@ interface HeaderComponentProps {
clearData: any; clearData: any;
undohandler: any; undohandler: any;
redohandler: any; redohandler: any;
toggleCollapsed: any;
} }
const HeaderComponent = memo((props: HeaderComponentProps) => { const HeaderComponent = memo((props: HeaderComponentProps) => {
const { pointData, location, clearData, undohandler, redohandler } = props; const { pointData, location, clearData, undohandler, redohandler, toggleCollapsed } = props;
const iptRef = useRef<Input>(null); const iptRef = useRef<Input>(null);
const toPreview = () => { const toPreview = () => {
@ -135,6 +136,7 @@ const HeaderComponent = memo((props: HeaderComponentProps) => {
<ArrowLeftOutlined /> <ArrowLeftOutlined />
</div> </div>
<div className={styles.logo}>Dooring</div> <div className={styles.logo}>Dooring</div>
<Switch onChange={toggleCollapsed} style={{ marginLeft: '100px' }} />
</div> </div>
<div className={styles.controlArea}> <div className={styles.controlArea}>
<Button type="primary" style={{ marginRight: '9px' }} onClick={useTemplate}> <Button type="primary" style={{ marginRight: '9px' }} onClick={useTemplate}>

View File

@ -1,6 +1,17 @@
.layout { .layout {
height: 100%; height: 100%;
width: 100%; width: 100%;
div::-webkit-scrollbar {
width: 8px;
height: 8px;
}
div::-webkit-scrollbar-thumb {
background: #bfbfbf;
border-radius: 10px;
}
div::-webkit-scrollbar-thumb:hover {
background: #2f54eb;
}
.editorWrap { .editorWrap {
background-color: rgba(245, 245, 245, 1); background-color: rgba(245, 245, 245, 1);
height: 100%; height: 100%;
@ -194,6 +205,10 @@
} }
} }
} }
.collapsed {
.list;
height: calc(56px);
}
} }
} }

View File

@ -3,11 +3,12 @@
height: 100%; height: 100%;
.leftArea { .leftArea {
padding: 10px 0 10px 20px; padding: 10px 0 10px 20px;
width: 320px; // width: 320px;
border-right: 1px solid #f0f0f0; border-right: 1px solid #f0f0f0;
} }
.contentArea { .contentArea {
flex: 1; flex: 1;
margin-right: 60px;
.logoTip { .logoTip {
padding-top: 100px; padding-top: 100px;
text-align: center; text-align: center;

View File

@ -6,6 +6,7 @@ import {
ConsoleSqlOutlined, ConsoleSqlOutlined,
GithubOutlined, GithubOutlined,
CodeOutlined, CodeOutlined,
IdcardOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import styles from './index.less'; import styles from './index.less';
@ -47,6 +48,17 @@ const Home = () => {
> >
... ...
</TabPane> </TabPane>
<TabPane
tab={
<span>
<IdcardOutlined />
</span>
}
key="3"
>
...
</TabPane>
</Tabs> </Tabs>
</div> </div>
<div className={styles.contentArea}> <div className={styles.contentArea}>