Skip to content

Commit 5e2a176

Browse files
authored
Merge pull request #2 from oslabs-beta/hideShowLeftContainer
Hide show left container
2 parents 2bf5089 + df5b56c commit 5e2a176

File tree

4 files changed

+56
-32
lines changed

4 files changed

+56
-32
lines changed

app/src/components/main/Canvas.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ function Canvas(props): JSX.Element {
2929
let id = (parentId) ? parentId : null;
3030
if (child.typeId < 1000){
3131
masterArr.push({
32-
type: "HTML Element",
33-
typeId: child.typeId,
32+
type: "HTML Element",
33+
typeId: child.typeId,
3434
childId: id
3535
})
3636
if (child.children.length) {
3737
deepChildCopy(child.children, child.childId);
38-
}
38+
}
3939
}
4040
}
4141
}
4242
deepChildCopy(children, null);
4343
setCopiedChildrenArr(masterArr);
4444
}
45-
45+
4646
const components = state.components
4747

4848
// find the ID of the newly created component
49-
const newId = components[components.length -1]['id']
49+
const newId = components[components.length -1]['id']
5050
dispatch({
5151
type: 'ADD CHILD',
5252
payload: {
@@ -56,8 +56,8 @@ function Canvas(props): JSX.Element {
5656
}
5757
});
5858
}
59-
setNewComp(false)
60-
}, [newComp])
59+
setNewComp(false) // initially set to false
60+
}, [newComp])
6161

6262
// Caret start
6363
Arrow.deleteLines();
@@ -73,7 +73,7 @@ function Canvas(props): JSX.Element {
7373
// onClickHandler is responsible for changing the focused component and child component
7474
function onClickHandler(event) {
7575
event.stopPropagation();
76-
// note: a null value for the child id means that we are focusing on the top-level component rather than any child
76+
// note: a null value for the child id means that we are focusing on the top-level component rather than any child
7777
changeFocus(state.canvasFocus.componentId, null);
7878
};
7979

@@ -150,7 +150,7 @@ function Canvas(props): JSX.Element {
150150

151151
// able to duplicate a component in dev only does not work for prod
152152
// create a new component
153-
153+
154154
// let name = prompt("Component already has a parent. \nDo you want to create a new component and import its elements?", "Enter component name here");
155155
// while (components.some(comp => comp.name === name)) {
156156
// name = prompt(`${name} component already exists. \nPlease pick a new name.`);
@@ -160,20 +160,20 @@ function Canvas(props): JSX.Element {
160160
// type: 'ADD COMPONENT',
161161
// payload: { componentName: name, root: false }
162162
// });
163-
163+
164164
// setNewComp(true);
165165
// setNewComp(!newComp)
166166
// }
167-
167+
168168
}
169-
169+
170170
}
171171
},
172172
collect: monitor => ({
173173
isOver: !!monitor.isOver()
174174
})
175175
});
176-
176+
177177
// Styling for Canvas
178178
const defaultCanvasStyle = {
179179
width: '100%',
@@ -198,7 +198,7 @@ function Canvas(props): JSX.Element {
198198
// Combine the default styles of the canvas with the custom styles set by the user for that component
199199
// The render children function renders all direct children of a given component
200200
// Direct children are draggable/clickable
201-
201+
202202
// const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
203203
const canvasStyle = combineStyles(defaultCanvasStyle, currentComponent.style);
204204
const darkCombinedCanvasStyle = combineStyles(darkCanvasStyle, currentComponent.style);

app/src/containers/CustomizationPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
5656
.children.find((el) => {
5757
return el.childId === state.canvasFocus.childId;
5858
});
59-
59+
6060
useEffect( () => {
6161
currFocus?.attributes?.compLink && setCompLink(currFocus.attributes.compLink);
6262
}, [state]);
@@ -215,7 +215,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
215215
searchNestedChildren(state.components);
216216
return isLinked;
217217
};
218-
218+
219219
const updateAttributeWithState = (attributeName, componentProviderId, statePropsId, statePropsRow, stateKey='') => {
220220
const newInput = statePropsRow.value;
221221
// get the stateProps of the componentProvider
@@ -382,7 +382,7 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
382382
document.removeEventListener('keydown', keyBindedFunc);
383383
};
384384
}, []);
385-
385+
386386
if(state.canvasFocus.childId === null) {
387387
return (
388388
<div className="column right" id="rightContainer" style={style}>

app/src/containers/LeftContainer.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import ComponentDrag from '../components/right/ComponentDrag';
44
import DragDropPanel from '../components/left/DragDropPanel';
55
import StateContext from '../context/context';
66
import { styleContext } from './AppContainer';
7+
78
// Left-hand portion of the app, where component options are displayed
89
const LeftContainer = (props): JSX.Element => {
910
const { style } = useContext(styleContext);
@@ -23,16 +24,20 @@ const LeftContainer = (props): JSX.Element => {
2324
}, []);
2425

2526
return (
26-
<div className="column left" style={style}>
27-
<Grid container direction="column" alignItems="center">
28-
<h4>Drag and Drop</h4>
29-
<DragDropPanel isThemeLight={props.isThemeLight}/>
30-
<div id={'CompBottomHalf'}>
31-
<ComponentDrag isThemeLight={props.isThemeLight}/>
27+
<div style={{borderRight: "4px solid #3FD0A2"}}>
28+
<div className="column left hide-show" style={style}>
29+
<Grid container direction="column" alignItems="center">
30+
<h4>Drag and Drop</h4>
31+
<DragDropPanel isThemeLight={props.isThemeLight}/>
32+
<div id={'CompBottomHalf'}>
33+
<ComponentDrag isThemeLight={props.isThemeLight}/>
34+
</div>
35+
</Grid>
3236
</div>
33-
</Grid>
3437
</div>
3538
);
3639
};
3740

41+
{/* <div className="arrow-right"></div> */}
42+
3843
export default LeftContainer;

app/src/public/styles/style.css

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ h4 {
4747
height: 300px;
4848
width: 410px;
4949
flex-grow: 1;
50-
padding-left: 10px;
50+
padding-left: 10px;
5151
padding-right: 10px;
5252
}
5353
.HTMLItemCreate {
@@ -88,16 +88,34 @@ LEFT COLUMN
8888
/////////////////////////////////////////////////
8989
*/
9090

91+
.app-container {
92+
position: relative;
93+
}
94+
9195
.left {
9296
padding: 10px 10px 10px 0px;
9397
display: flex;
94-
width: 225px;
95-
min-width: 225px;
98+
/* width: 225px;
99+
min-width: 225px; */
96100
flex-direction: column;
97101
align-content: center;
98102
position: relative;
99103
overflow-x: hidden;
100104
}
105+
.hide-show {
106+
opacity: 0;
107+
width: 0;
108+
transition: opacity 0.5s linear, width 0.5s ease-in-out;
109+
position: absolute;
110+
height: 100%;
111+
}
112+
.hide-show:hover {
113+
opacity: 1;
114+
width: 225px;
115+
min-width: 225px;
116+
z-index: 289;
117+
}
118+
101119
.HTMLItems {
102120
display: flex;
103121
flex-direction: column;
@@ -281,7 +299,7 @@ h1 {
281299
//////////////////////////////////////////////////
282300
RIGHT COLUMN
283301
/////////////////////////////////////////////////
284-
// RIGHT NOW, I'M NOT SURE WHAT RIGHT COL IS REFERING TO
302+
// RIGHT NOW, I'M NOT SURE WHAT RIGHT COL IS REFERING TO
285303
*/
286304
#rightContainer {
287305
overflow-y: scroll;
@@ -357,9 +375,9 @@ RIGHT COLUMN
357375
cursor: pointer;
358376
}
359377

360-
/*
378+
/*
361379
/////////////////////////////////////////////////////
362-
BOTTOM PANEL
380+
BOTTOM PANEL
363381
/////////////////////////////////////////////////////
364382
*/
365383

@@ -409,6 +427,7 @@ BOTTOM PANEL
409427
background-color: 252526;
410428
}
411429

430+
412431
/*
413432
//////////////////////////////////////////
414433
NAVBAR
@@ -423,7 +442,7 @@ NAVBAR
423442
#customized-menu {
424443
width: 16%;
425444
}
426-
/*
445+
/*
427446
/////////////////////////////////////////////////
428447
ANNOTATIONS
429448
/////////////////////////////////////////////////
@@ -607,4 +626,4 @@ a.nav_link:hover {
607626
display: flex;
608627
flex-direction: column;
609628
align-items: center;
610-
}
629+
}

0 commit comments

Comments
 (0)