Skip to content

Commit cf97ab4

Browse files
committed
Revise click functionality on bottom menu. Remove vanilla JS and replaced with react state and dynamic CSS styling. Need to fix drag functionality
1 parent f094bff commit cf97ab4

File tree

5 files changed

+27
-28
lines changed

5 files changed

+27
-28
lines changed

app/src/components/bottom/BottomPanel.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const BottomPanel = (props): JSX.Element => {
2828
};
2929

3030
const mouseMoveHandler = function (e: MouseEvent): void {
31-
3231
const dy = y - e.clientY;
3332

3433
const newVal = h + dy;
@@ -54,7 +53,7 @@ const BottomPanel = (props): JSX.Element => {
5453
<div
5554
id="resize-drag"
5655
onMouseDown={mouseDownHandler}
57-
onClick={() => props.setBottomShow(true)}
56+
onClick={() => props.setBottomShow(!props.bottomShow)}
5857
tabIndex={0}
5958
>
6059
{props.bottomShow ? <ExpandMore /> : <ExpandLess />}

app/src/components/bottom/BottomTabs.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ const BottomTabs = (props): JSX.Element => {
3939

4040
arrow.renderArrow(state.canvasFocus?.childId);
4141

42+
const showBottomPanel = () => {
43+
props.setBottomShow(true);
44+
};
45+
4246
return (
4347
<div
4448
className={`${classes.root} ${classes.rootLight}`}
@@ -47,9 +51,6 @@ const BottomTabs = (props): JSX.Element => {
4751
zIndex: 1,
4852
borderTop: '2px solid grey'
4953
}}
50-
onClick={() => {
51-
props.setBottomShow(true);
52-
}}
5354
>
5455
<Box
5556
display="flex"
@@ -69,31 +70,37 @@ const BottomTabs = (props): JSX.Element => {
6970
disableRipple
7071
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
7172
label="Creation Panel"
73+
onClick={showBottomPanel}
7274
/>
7375
<Tab
7476
disableRipple
7577
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
7678
label="Customization"
79+
onClick={showBottomPanel}
7780
/>
7881
<Tab
7982
disableRipple
8083
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
8184
label="CSS Editor"
85+
onClick={showBottomPanel}
8286
/>
8387
<Tab
8488
disableRipple
8589
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
8690
label="Component Tree"
91+
onClick={showBottomPanel}
8792
/>
8893
<Tab
8994
disableRipple
9095
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
9196
label="Context Manager"
97+
onClick={showBottomPanel}
9298
/>
9399
<Tab
94100
disableRipple
95101
classes={{ root: classes.tabRoot, selected: classes.tabSelected }}
96102
label="State Manager"
103+
onClick={showBottomPanel}
97104
/>
98105
</Tabs>
99106
<div className={classes.projectTypeWrapper}>

app/src/components/main/Canvas.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,6 @@ const Canvas = (props: {}): JSX.Element => {
363363
</label>
364364
</div>
365365
);
366-
}
366+
};
367367

368-
export default Canvas;
368+
export default Canvas;

app/src/containers/MainContainer.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,27 @@ const MainContainer = (props): JSX.Element => {
109109
setBottomShow(false);
110110
};
111111

112-
let showPanel = bottomShow ? 'bottom-show' : 'bottom-hide';
112+
const hideBottomPanelStyles = {
113+
maxHeight: '64px',
114+
boxSizing: 'border-box',
115+
transition: 'all 0.5s ease-in-out'
116+
};
117+
118+
const showBottomPanelStyles = {
119+
maxHeight: '100%',
120+
transition: 'all 0.5s ease-in-out'
121+
};
113122

114123
return (
115124
<div className="main-container" style={style} ref={containerRef}>
116125
<div className="main">
117126
<CanvasContainer isThemeLight={props.isThemeLight} />
118127
<DemoRender />
119128
</div>
120-
<div className={showPanel} ref={ref}>
129+
<div
130+
ref={ref}
131+
style={bottomShow ? showBottomPanelStyles : hideBottomPanelStyles}
132+
>
121133
<BottomPanel
122134
bottomShow={bottomShow}
123135
setBottomShow={setBottomShow}

app/src/public/styles/style.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -502,25 +502,6 @@ BOTTOM PANEL
502502
/////////////////////////////////////////////////////
503503
*/
504504

505-
.bottom-hide {
506-
max-height: 64px;
507-
box-sizing: border-box;
508-
transition: all 0.5s ease-in-out;
509-
}
510-
511-
.bottom-show {
512-
max-height: 100%;
513-
transition: all 0.5s ease-in-out;
514-
}
515-
516-
.bottom-hide:focus-within {
517-
max-height: 100%;
518-
}
519-
/*
520-
.bottom-hide:hover {
521-
max-height: 100%;
522-
} */
523-
524505
.tab-content {
525506
height: calc(100% - 76px);
526507
width: 100%;

0 commit comments

Comments
 (0)