Skip to content

Commit 5777c2f

Browse files
committed
Added Sidebar View Animation
1 parent 668c376 commit 5777c2f

File tree

6 files changed

+112
-43
lines changed

6 files changed

+112
-43
lines changed

src/app/containers/ActionContainer.tsx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const resetSlider = () => {
1717
function ActionContainer(props) {
1818
const [{ tabs, currentTab }, dispatch] = useStoreContext();
1919
const { hierarchy, sliderIndex, viewIndex } = tabs[currentTab];
20+
const { toggleActionContainer, actionView } = props;
2021
let actionsArr = [];
2122
const hierarchyArr: any[] = [];
2223

@@ -115,21 +116,32 @@ function ActionContainer(props) {
115116
// this is not logging; the prop is not being udpdated or the component is not being re-rendered.
116117
return (
117118
<div id='action-id' className='action-container'>
118-
<SwitchAppDropdown />
119-
<div className='action-component exclude'>
120-
<button
121-
className='empty-button'
122-
onClick={() => {
123-
dispatch(emptySnapshots());
124-
// set slider back to zero
125-
resetSlider();
126-
}}
127-
type='button'
128-
>
129-
Empty
130-
</button>
119+
<div id = "arrow">
120+
<aside className='aside'>
121+
<a onClick={toggleActionContainer} className='toggle'>
122+
<i></i>
123+
</a>
124+
</aside>
131125
</div>
132-
<div>{actionsArr}</div>
126+
{actionView ? (
127+
<div>
128+
<SwitchAppDropdown />
129+
<div className='action-component exclude'>
130+
<button
131+
className='empty-button'
132+
onClick={() => {
133+
dispatch(emptySnapshots());
134+
// set slider back to zero
135+
resetSlider();
136+
}}
137+
type='button'
138+
>
139+
Empty
140+
</button>
141+
</div>
142+
<div>{actionsArr}</div>
143+
</div>
144+
) : null}
133145
</div>
134146
);
135147
}

src/app/containers/MainContainer.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,11 @@ function MainContainer(): any {
2323
const [store, dispatch] = useStoreContext();
2424
const { tabs, currentTab, port: currentPort } = store;
2525
const [actionView, setActionView] = useState(true);
26+
//this function handles Time Jump sidebar view
2627
const toggleActionContainer = () => {
27-
const bodyElem = document.getElementById('bodyContainer');
28-
const toggleElement = document.getElementById('side-bar-button');
29-
28+
const toggleElem = document.querySelector('aside');
29+
toggleElem.classList.toggle('no-aside');
3030
setActionView(!actionView);
31-
if (actionView) {
32-
bodyElem.style.gridTemplateColumns = '1fr 2fr';
33-
toggleElement.innerHTML = 'Close';
34-
} else {
35-
bodyElem.style.gridTemplateColumns = '0fr auto';
36-
toggleElement.innerHTML = '☰ Open Time Travel';
37-
}
3831
};
3932

4033
useEffect(() => {
@@ -196,7 +189,10 @@ function MainContainer(): any {
196189
<div className='main-container'>
197190
{/* <HeadContainer /> */}
198191
<div id='bodyContainer' className='body-container1'>
199-
<ActionContainer toggleActionContainer={toggleActionContainer} />
192+
<ActionContainer
193+
actionView={actionView}
194+
toggleActionContainer={toggleActionContainer}
195+
/>
200196
{snapshots.length ? (
201197
<StateContainer
202198
toggleActionContainer={toggleActionContainer}

src/app/containers/StateContainer.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,20 @@ const StateContainer = (props: StateContainerProps): JSX.Element => {
4848
<div className='main-navbar-container'>
4949
<div className='main-navbar-text'>
5050
{' '}
51-
<button
51+
{/* <button
5252
id='side-bar-button'
5353
className='toggleAC'
5454
onClick={() => toggleActionContainer()}
5555
>
5656
Close
57-
</button>
57+
</button> */}
58+
{/* <div className='toggleAC'>
59+
<aside className='no-aside'>
60+
<a className='toggle'>
61+
<i></i>
62+
</a>
63+
</aside>
64+
</div> */}
5865
</div>
5966
<div className='main-navbar'>
6067
<NavLink

src/app/styles/base/_base.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ body {
1515

1616
.travel-container {
1717
grid-area: travel;
18-
transition: margin-left 15s;
1918
}
2019
.action-container {
2120
grid-area: actions;
22-
transition: 15s;
21+
transition: 0.5s;
2322
}
2423
.state-container {
2524
grid-area: states;
26-
transition: margin-left 15s;
2725
}
2826
.buttons-container {
2927
grid-area: buttons;
30-
transition: margin-left 15s;
3128
border-color: rgba(41, 41, 41, 1);
3229
}
3330

src/app/styles/components/_buttons.scss

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,71 @@
297297
height: 30px;
298298
padding: 0 2rem;
299299
}
300+
/* sidebar button open and closing functionality */
301+
aside {
302+
width: 250px;
303+
background: #242529;
304+
color: #fff;
305+
transition: width 1s;
306+
}
307+
308+
.no-aside {
309+
width: 30px;
310+
}
311+
.toggle {
312+
width: 40px;
313+
height: 40px;
314+
display: block;
315+
position: relative;
316+
margin-top: 1rem;
317+
}
318+
319+
.toggle i,
320+
.toggle i::after,
321+
.toggle i::before {
322+
position: absolute;
323+
width: 27px;
324+
height: 4px;
325+
border-radius: 4px;
326+
transition: transform 0.15s;
327+
background-color: #00dffc;
328+
}
329+
330+
.toggle i {
331+
top: 46%;
332+
left: 18%;
333+
display: block;
334+
background: #00dffc;
335+
}
336+
337+
.toggle i::before {
338+
top: -5px;
339+
}
340+
341+
.toggle i::after {
342+
bottom: -6px;
343+
}
344+
345+
.toggle i::after,
346+
.toggle i::before {
347+
content: '';
348+
display: block;
349+
}
350+
351+
.toggle i::before {
352+
transform: translate3d(-8px, 0, 0) rotate(-45deg) scale(0.7, 1);
353+
}
354+
355+
.toggle i::after {
356+
transform: translate3d(-8px, 0, 0) rotate(45deg) scale(0.7, 1);
357+
}
358+
359+
.no-aside .toggle i::before,
360+
.no-aside .toggle i::after {
361+
transform: none;
362+
}
363+
#arrow {
364+
height: 20px !important;
365+
margin-bottom: 40px;
366+
margin-right: 20px;
367+
}

src/app/styles/layout/_bodyContainer.scss

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,14 @@
22
height: 94%;
33
overflow: hidden;
44
display: grid;
5-
grid-template-columns: 1fr 2fr;
5+
grid-template-columns: min-content 2fr;
66
grid-template-rows: 8fr 1fr;
77
grid-template-areas:
88
'actions states'
99
'actions travel'
1010
'actions buttons';
1111
}
1212

13-
.body-container2 {
14-
height: 94%;
15-
overflow: hidden;
16-
display: grid;
17-
grid-template-columns: 1fr 2fr;
18-
grid-template-rows: 8fr 1fr;
19-
grid-template-areas:
20-
'actions states'
21-
'travel travel'
22-
'buttons buttons';
23-
}
2413

2514
/* if extension width is less than 500px, stack the body containers */
2615
@media (max-width: 500px) {

0 commit comments

Comments
 (0)