Skip to content

Commit 7017953

Browse files
committed
slider no longer changes viewed state
1 parent 22670dd commit 7017953

File tree

9 files changed

+37
-32
lines changed

9 files changed

+37
-32
lines changed

src/app/components/Action.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ const Action = (props) => {
1212
role="presentation"
1313
>
1414
<div className="action-component-text">{index}</div>
15-
<div
15+
<button
1616
className="jump-button"
1717
onClick={(e) => {
1818
e.stopPropagation();
1919
handleJumpSnapshot(index);
2020
}}
2121
tabIndex={index}
22-
role="button"
22+
type="button"
2323
>
2424
Jump
25-
</div>
25+
</button>
2626
</div>
2727
);
2828
};

src/app/components/MainSlider.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const handle = (props) => {
2525

2626
const MainSlider = ({
2727
snapshotLength,
28-
handleChangeSnapshot,
2928
sliderIndex,
3029
handleJumpSnapshot,
3130
pause,
@@ -37,7 +36,6 @@ const MainSlider = ({
3736
value={sliderIndex}
3837
onChange={(index) => {
3938
const newIndex = index === -1 ? 0 : index;
40-
handleChangeSnapshot(newIndex);
4139
handleJumpSnapshot(newIndex);
4240
pause();
4341
}}
@@ -47,7 +45,6 @@ const MainSlider = ({
4745

4846
MainSlider.propTypes = {
4947
snapshotLength: PropTypes.number.isRequired,
50-
handleChangeSnapshot: PropTypes.func.isRequired,
5148
sliderIndex: PropTypes.number.isRequired,
5249
handleJumpSnapshot: PropTypes.func.isRequired,
5350
pause: PropTypes.func.isRequired,

src/app/containers/ActionContainer.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ const ActionContainer = ({
2828
return (
2929
<div className="action-container">
3030
<div className="action-component exclude">
31-
<div className="empty-button" onClick={emptySnapshot}>
31+
<button className="empty-button" onClick={emptySnapshot} type="button">
3232
emptySnapshot
33-
</div>
33+
</button>
3434
</div>
3535
<div>{actionsArr}</div>
3636
</div>

src/app/containers/ButtonsContainer.jsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33

4-
const ButtonsContainer = ({ mode: { paused, locked, persist }, toggleMode, importSnapshots, exportSnapshots }) => (
5-
<div className="buttons-container">
6-
<div className="pause-button" onClick={() => toggleMode('paused')}>{(paused) ? 'Resume' : 'Pause'}</div>
7-
<div className="lock-button" onClick={() => toggleMode('locked')}>{(locked) ? 'Unlock' : 'Lock'}</div>
8-
<div className="persist-button" onClick={() => toggleMode('persist')}>{(persist) ? 'Unpersist' : 'Persist'}</div>
9-
<div className="import-button" onClick={importSnapshots}>Import</div>
10-
<div className="export-button" onClick={exportSnapshots}>Export</div>
11-
</div>
12-
);
4+
const ButtonsContainer = ({
5+
mode: { paused, locked, persist },
6+
toggleMode,
7+
importSnapshots,
8+
exportSnapshots,
9+
}) =>
10+
(
11+
<div className="buttons-container">
12+
<button className="pause-button" type="button" onClick={() => toggleMode('paused')}>{(paused) ? 'Resume' : 'Pause'}</button>
13+
<button className="lock-button" type="button" onClick={() => toggleMode('locked')}>{(locked) ? 'Unlock' : 'Lock'}</button>
14+
<button className="persist-button" type="button" onClick={() => toggleMode('persist')}>{(persist) ? 'Unpersist' : 'Persist'}</button>
15+
<button className="import-button" type="button" onClick={importSnapshots}>Import</button>
16+
<button className="export-button" type="button" onClick={exportSnapshots}>Export</button>
17+
</div>
18+
);
1319

1420
ButtonsContainer.propTypes = {
1521
toggleMode: PropTypes.func.isRequired,

src/app/containers/MainContainer.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ class MainContainer extends Component {
208208
<TravelContainer
209209
snapshotsLength={snapshots.length}
210210
sliderIndex={sliderIndex}
211-
handleChangeSnapshot={this.handleChangeSnapshot}
212211
handleJumpSnapshot={this.handleJumpSnapshot}
213212
moveBackward={this.moveBackward}
214213
moveForward={this.moveForward}

src/app/containers/TravelContainer.jsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class TravelContainer extends Component {
2727
moveBackward,
2828
moveForward,
2929
snapshotsLength,
30-
handleChangeSnapshot,
3130
handleJumpSnapshot,
3231
sliderIndex,
3332
play,
@@ -37,22 +36,21 @@ class TravelContainer extends Component {
3736

3837
return (
3938
<div className="travel-container">
40-
<div className="play-button" onClick={() => play(playSpeed)}>
39+
<button className="play-button" onClick={() => play(playSpeed)} type="button">
4140
{playing ? 'Pause' : 'Play'}
42-
</div>
41+
</button>
4342
<MainSlider
4443
snapshotLength={snapshotsLength}
45-
handleChangeSnapshot={handleChangeSnapshot}
4644
sliderIndex={sliderIndex}
4745
handleJumpSnapshot={handleJumpSnapshot}
4846
pause={pause}
4947
/>
50-
<div className="backward-button" role="button" onClick={moveBackward}>
48+
<button className="backward-button" onClick={moveBackward} type="button">
5149
{'<'}
52-
</div>
53-
<div className="forward-button" role="button" onClick={moveForward}>
50+
</button>
51+
<button className="forward-button" onClick={moveForward} type="button">
5452
{'>'}
55-
</div>
53+
</button>
5654
<Dropdown
5755
options={options}
5856
selectedOption={selectedOption}
@@ -69,7 +67,6 @@ TravelContainer.propTypes = {
6967
moveBackward: PropTypes.func.isRequired,
7068
moveForward: PropTypes.func.isRequired,
7169
snapshotsLength: PropTypes.number.isRequired,
72-
handleChangeSnapshot: PropTypes.func.isRequired,
7370
handleJumpSnapshot: PropTypes.func.isRequired,
7471
sliderIndex: PropTypes.number.isRequired,
7572
playing: PropTypes.bool.isRequired,

src/app/styles/components/_buttons.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
.play-button {
3131
@extend %button-shared;
32-
width: 60px;
33-
margin: 10px;
32+
width: 100px;
33+
margin: 0 1% 0 2%;
3434
}
3535

3636
.backward-button {
@@ -54,6 +54,9 @@
5454
}
5555

5656
%button-shared {
57+
outline: none;
58+
background-color: $brand-color;
59+
color: white;
5760
display: flex;
5861
justify-content: center;
5962
align-items: center;

src/app/styles/layout/_buttonsContainer.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@
55
grid-gap: 1%;
66
padding: 1% 0 1% 0;
77
}
8+
9+
@media (max-width: 500px) {
10+
.buttons-container {
11+
grid-template-columns: repeat(2, 1fr);
12+
}
13+
}

src/app/styles/styles.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
.main-container {
22
height: 100%;
33
margin: 0 auto;
4-
padding: 0 auto;
54
background-color: $brand-color;
65
overflow: hidden;
76
}
87

98
.body-container {
109
height: 94%;
11-
width: 100%;
1210
display: grid;
1311
grid-template-columns: 1fr 2fr;
1412
grid-template-rows: 8fr 1fr;
@@ -19,7 +17,6 @@
1917
}
2018

2119
/* if extension width is less than 500px, stack the body containers */
22-
// this is not working for some reason
2320
@media (max-width: 500px) {
2421
.body-container {
2522
grid-template-rows: 3fr 5fr 1fr;

0 commit comments

Comments
 (0)