Skip to content

Commit e7c9536

Browse files
committed
fixed collapse function with fixed action container width
1 parent af04286 commit e7c9536

File tree

4 files changed

+26
-32
lines changed

4 files changed

+26
-32
lines changed

src/app/containers/ActionContainer.tsx

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
130130
},
131131
);
132132

133-
// JR: this is questionable, why would you always set it to true?
134-
// useEffect(() => {
135-
// setActionView(true);
136-
// }, [setActionView]);
137-
138133
// Function sends message to background.js which sends message to the content script
139134
const toggleRecord = (): void => {
140135
port.postMessage({
@@ -174,22 +169,11 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
174169
className='toggle'
175170
>
176171
{' '}
177-
{/* JR: updating onClick to stop propagation so that it detects the click only on the arrow and not the parent*/}
178172
<i />
179173
</a>
180174
</aside>
181175
<div className='collapse'>Collapse</div>
182176
</div>
183-
{/* <a type='button' id='recordBtn' onClick={toggleRecord}>
184-
<i />
185-
<div
186-
className='toggle-record'
187-
style={{ display: 'flex', alignItems: 'center', textAlign: 'right' }}
188-
>
189-
Record
190-
</div>
191-
{recordingActions ? <Switch defaultChecked /> : <Switch />}
192-
</a> */}
193177
</div>
194178
{actionView ? (
195179
<div className='action-button-wrapper'>
@@ -218,8 +202,9 @@ function ActionContainer(props: ActionContainerProps): JSX.Element {
218202
</Button>
219203
</div>
220204
<div className='snapshots'>
221-
{dropdownSelection === 'Provider/Consumer' && <ProvConContainer currentSnapshot={currLocation.stateSnapshot}
222-
/>}
205+
{dropdownSelection === 'Provider/Consumer' && (
206+
<ProvConContainer currentSnapshot={currLocation.stateSnapshot} />
207+
)}
223208
{dropdownSelection === 'TimeJump' &&
224209
Object.keys(routes).map((route, i) => (
225210
<RouteDescription key={`route${i}`} actions={routes[route]} />

src/app/containers/MainContainer.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ function MainContainer(): JSX.Element {
4040
const toggleActionContainer = () => {
4141
setActionView(!actionView); // sets actionView to the opposite boolean value
4242

43+
const bodyContainer = document.getElementById('bodyContainer');
44+
bodyContainer.classList.toggle('collapsed');
45+
4346
const toggleElem = document.querySelector('aside'); // aside is like an added text that appears "on the side" aside some text.
4447
toggleElem.classList.toggle('no-aside'); // toggles the addition or the removal of the 'no-aside' class
4548

@@ -211,7 +214,7 @@ function MainContainer(): JSX.Element {
211214
actionView={actionView}
212215
setActionView={setActionView}
213216
toggleActionContainer={toggleActionContainer}
214-
snapshots={snapshots}
217+
snapshots={snapshots}
215218
currLocation={currLocation}
216219
/>
217220
{/* @ts-ignore */}

src/app/styles/layout/_actionContainer.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,22 @@
55
overflow-x: hidden;
66
overflow-y: auto;
77
height: 100%;
8+
9+
.action-button-wrapper {
10+
opacity: 1;
11+
visibility: visible;
12+
transition:
13+
opacity 0.2s ease,
14+
visibility 0.2s ease;
15+
}
816
}
917

18+
.collapsed .action-container {
19+
.action-button-wrapper {
20+
opacity: 0;
21+
visibility: hidden;
22+
}
23+
}
1024
.actionname {
1125
background-color: $indiv-action-input-bg;
1226
border: 1px solid $indiv-action-border;

src/app/styles/layout/_bodyContainer.scss

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,15 @@
22
height: 100%;
33
overflow: hidden;
44
display: grid;
5-
grid-template-columns: 280px 1fr; /* Set action container width to 320px */
6-
grid-template-rows: 1fr auto; /* Change to auto for the bottom row */
5+
grid-template-columns: 280px 1fr;
6+
grid-template-rows: 1fr auto;
77
grid-template-areas:
88
'actions states'
99
'bottom bottom';
10-
}
10+
transition: grid-template-columns 0.3s ease;
1111

12-
/* if extension width is less than 500px, stack the body containers */
13-
@media (max-width: 500px) {
14-
.body-container {
15-
grid-template-rows: 3fr 5fr 1fr;
16-
grid-template-columns: auto;
17-
grid-template-areas:
18-
'actions'
19-
'states'
20-
'travel'
21-
'buttons';
12+
&.collapsed {
13+
grid-template-columns: 45px 1fr;
2214
}
2315
}
2416

0 commit comments

Comments
 (0)