Skip to content

Commit a668ac2

Browse files
pushes main slider back to start when snapshots list is emptied with Empty buttom
1 parent 13a4a14 commit a668ac2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/app/containers/ActionContainer.jsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import Action from '../components/Action';
55
import { emptySnapshots } from '../actions/actions';
66
import { useStoreContext } from '../store';
77

8+
const resetSlider = () => {
9+
console.log('in reset slider');
10+
const slider = document.querySelector('.rc-slider-handle');
11+
console.log('my slider', slider);
12+
slider.setAttribute('style', 'left: 0');
13+
};
14+
815
function ActionContainer() {
916
const [{ tabs, currentTab }, dispatch] = useStoreContext();
1017
const { snapshots, sliderIndex, viewIndex } = tabs[currentTab];
@@ -28,7 +35,15 @@ function ActionContainer() {
2835
return (
2936
<div className="action-container">
3037
<div className="action-component exclude">
31-
<button className="empty-button" onClick={() => dispatch(emptySnapshots())} type="button">
38+
<button
39+
className="empty-button"
40+
onClick={() => {
41+
dispatch(emptySnapshots());
42+
// set slider back to zero
43+
resetSlider();
44+
}}
45+
type="button"
46+
>
3247
Empty
3348
</button>
3449
</div>

0 commit comments

Comments
 (0)