Skip to content

Commit 81d0096

Browse files
authored
Merge pull request #219 from open-source-labs/denton/statemanager
state manager color and expansion issues addressed
2 parents fb7e07a + 50aab95 commit 81d0096

File tree

4 files changed

+44
-4
lines changed

4 files changed

+44
-4
lines changed

Dockerrun.aws.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"Environment": [
1313
{
1414
"Name": "API_BASE_URL",
15-
"Value": "Reactypev15-env.eba-mbvivk7k.us-east-1.elasticbeanstalk.com"
15+
"Value": "Reactypev17-env.eba-mbvivk7k.us-east-1.elasticbeanstalk.com"
1616
}
1717
]
1818
}

app/src/components/StateManagement/CreateTab/components/StatePropsPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ const StatePropsPanel = ({ isThemeLight, data }): JSX.Element => {
405405
</FormControl>
406406
</div>
407407
<br />
408-
<div style={{ display: 'flex', overflowX: 'scroll' }}>
408+
<div style={{ display: 'flex'}}>
409409
<div style={{ display: 'flex', flexDirection: 'column' }}>
410410
<h4
411411
className={

app/src/containers/MainContainer.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef, useEffect } from 'react';
1+
import React, { useRef, useEffect, useState} from 'react';
22
import BottomPanel from '../components/bottom/BottomPanel';
33
import CanvasContainer from '../components/main/CanvasContainer';
44
import DemoRender from '../components/main/DemoRender';
@@ -11,6 +11,7 @@ import { Amplify, Storage } from 'aws-amplify';
1111
import awsconfig from '../../../src/custom-aws-exports';
1212

1313
const MainContainer = (props): JSX.Element => {
14+
const [bottomShow, setBottomShow] = useState(false)
1415
const dispatch = useDispatch();
1516
const screenshotTrigger = useSelector((store: RootState) => store.appState.screenshotTrigger);
1617
const id: string = useSelector((store: RootState) => store.appState._id);
@@ -65,13 +66,46 @@ const MainContainer = (props): JSX.Element => {
6566
}
6667
}
6768

69+
//Logic to close the bottompanel when clicking outside of it
70+
const useOutsideClick = () => {
71+
const bottomPanelRef = useRef(null);
72+
73+
useEffect(() => {
74+
const handleClick = (event) => {
75+
if (event.type === "click" &&
76+
(bottomPanelRef.current &&
77+
!bottomPanelRef.current.contains(event.target)) || (event.type === "message" && event.data === 'iframeClicked')) {
78+
//menuButtonRef is to ensure that handleClose does not get invoked when the user clicks on the menu dropdown button
79+
handleClose();
80+
}
81+
};
82+
window.addEventListener('click', handleClick, true);
83+
window.addEventListener('message', handleClick);//to capture clicks in the iframe
84+
85+
return () => {
86+
window.removeEventListener('click', handleClick, true);
87+
window.addEventListener('message', handleClick); //cleanup for memory purposes. ensures handleclick isn't called after the component is no longer rendered
88+
};
89+
}, [bottomPanelRef]);
90+
91+
return bottomPanelRef;
92+
};
93+
94+
const ref = useOutsideClick();
95+
96+
const handleClose = () => {
97+
setBottomShow(false);
98+
};
99+
100+
let showPanel = bottomShow ? 'bottom-show' : 'bottom-hide';
101+
68102
return (
69103
<div className="main-container" style={style} ref={containerRef}>
70104
<div className="main" >
71105
<CanvasContainer isThemeLight={props.isThemeLight} />
72106
<DemoRender />
73107
</div>
74-
<div className="bottom-hide" >
108+
<div onMouseOver={()=>setBottomShow(true)} className={showPanel} ref={ref}>
75109
<BottomPanel isThemeLight={props.isThemeLight} />
76110
</div>
77111
</div>

app/src/public/styles/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ BOTTOM PANEL
507507

508508
.bottom-show {
509509
max-height: 100%;
510+
transition: all 0.5s ease-in-out;
510511
}
511512

512513
.bottom-hide:focus-within {
@@ -527,6 +528,11 @@ BOTTOM PANEL
527528
background-color: #191919;
528529
}
529530

531+
.MuiDataGrid-menuList {
532+
533+
background-color: #333333
534+
}
535+
530536
#resize-drag {
531537

532538
cursor: row-resize;

0 commit comments

Comments
 (0)