Skip to content

Commit 156ded8

Browse files
authored
Merge pull request #2 from oslabs-beta/jon
Fix customization menu to be activated on click/drag, not hover / mouse over (T40-4)
2 parents 6dea774 + 3aaa3b0 commit 156ded8

File tree

5 files changed

+136
-95
lines changed

5 files changed

+136
-95
lines changed

app/src/components/bottom/BottomPanel.tsx

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useRef } from 'react';
22
import BottomTabs from './BottomTabs';
3+
import { ExpandLess, ExpandMore } from '@mui/icons-material';
34

45
const BottomPanel = (props): JSX.Element => {
56
let y: number = 0;
@@ -15,18 +16,17 @@ const BottomPanel = (props): JSX.Element => {
1516
//Start listeners when the user clicks the bottom panel tab
1617
document.addEventListener('mousemove', mouseMoveHandler);
1718
document.addEventListener('mouseup', mouseUpHandler);
18-
window.addEventListener('message', handleIframeMessage);//listens for messages from the iframe when the mouse is over it
19+
window.addEventListener('message', handleIframeMessage); //listens for messages from the iframe when the mouse is over it
1920
};
20-
21+
2122
//Interpret the messages from the iframe
2223
const handleIframeMessage = (e) => {
2324
if (e.data === 'iframeMouseUp') {
2425
mouseUpHandler();
25-
}else if(e.data.type === 'iframeMouseMove'){
26-
mouseMoveHandler(e.data)
26+
} else if (e.data.type === 'iframeMouseMove') {
27+
mouseMoveHandler(e.data);
2728
}
28-
}
29-
29+
};
3030

3131
const mouseMoveHandler = function (e: MouseEvent): void {
3232
// How far the mouse has been moved
@@ -54,12 +54,21 @@ const BottomPanel = (props): JSX.Element => {
5454

5555
return (
5656
<>
57-
<div className="bottom-panel" id="resize" ref={node}>
58-
<div id="resize-drag" onMouseDown={mouseDownHandler} tabIndex={0}>
59-
......
57+
<div className="bottom-panel" id="resize" ref={node}>
58+
<div
59+
id="resize-drag"
60+
onMouseDown={mouseDownHandler}
61+
onClick={() => props.setBottomShow(true)}
62+
tabIndex={0}
63+
>
64+
{props.bottomShow ? <ExpandMore /> : <ExpandLess />}
65+
</div>
66+
<BottomTabs
67+
setBottomShow={props.setBottomShow}
68+
isThemeLight={props.isThemeLight}
69+
/>
6070
</div>
61-
<BottomTabs setBottomShow = {props.setBottomShow} isThemeLight={props.isThemeLight} />
62-
</div></>
71+
</>
6372
);
6473
};
6574

app/src/components/bottom/BottomTabs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const BottomTabs = (props): JSX.Element => {
5757
zIndex: 1,
5858
borderTop: '2px solid grey'
5959
}}
60-
onMouseOver={() => {
60+
onClick={() => {
6161
props.setBottomShow(true);
6262
}}
6363
>

app/src/containers/MainContainer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ const MainContainer = (props): JSX.Element => {
119119
</div>
120120
<div className={showPanel} ref={ref}>
121121
<BottomPanel
122+
bottomShow={bottomShow}
122123
setBottomShow={setBottomShow}
123124
isThemeLight={props.isThemeLight}
124125
/>

0 commit comments

Comments
 (0)