Merge branch 'eadisor-add_swipe_gesture'
Small changes between the original branch by eadisor and the master branch prevented this from being a straightforward merge (photoGalleryReducer -> mediaGalleryReducer). Also bumped the version number of react-swipeable to avoid a breaking version change further down the line.
This commit is contained in:
commit
1a05b353e6
|
@ -39,6 +39,7 @@
|
||||||
"react-i18next": "^11.18.0",
|
"react-i18next": "^11.18.0",
|
||||||
"react-router-dom": "^6.3.0",
|
"react-router-dom": "^6.3.0",
|
||||||
"react-scripts": "^5.0.1",
|
"react-scripts": "^5.0.1",
|
||||||
|
"react-swipeable": "^7.0.0",
|
||||||
"react-test-renderer": "^18.2.0",
|
"react-test-renderer": "^18.2.0",
|
||||||
"styled-components": "^5.3.5",
|
"styled-components": "^5.3.5",
|
||||||
"subscriptions-transport-ws": "^0.11.0",
|
"subscriptions-transport-ws": "^0.11.0",
|
||||||
|
@ -20874,6 +20875,14 @@
|
||||||
"react": "^16.3.0 || ^17.0.0 || ^18.0.0"
|
"react": "^16.3.0 || ^17.0.0 || ^18.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-swipeable": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-swipeable/-/react-swipeable-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-NI7KGfQ6gwNFN0Hor3vytYW3iRfMMaivGEuxcADOOfBCx/kqwXE8IfHFxEcxSUkxCYf38COLKYd9EMYZghqaUA==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8.3 || ^17 || ^18"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-test-renderer": {
|
"node_modules/react-test-renderer": {
|
||||||
"version": "18.2.0",
|
"version": "18.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz",
|
||||||
|
@ -40414,6 +40423,12 @@
|
||||||
"integrity": "sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw==",
|
"integrity": "sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw==",
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
|
"react-swipeable": {
|
||||||
|
"version": "7.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-swipeable/-/react-swipeable-7.0.0.tgz",
|
||||||
|
"integrity": "sha512-NI7KGfQ6gwNFN0Hor3vytYW3iRfMMaivGEuxcADOOfBCx/kqwXE8IfHFxEcxSUkxCYf38COLKYd9EMYZghqaUA==",
|
||||||
|
"requires": {}
|
||||||
|
},
|
||||||
"react-test-renderer": {
|
"react-test-renderer": {
|
||||||
"version": "18.2.0",
|
"version": "18.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz",
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
"react-i18next": "^11.18.0",
|
"react-i18next": "^11.18.0",
|
||||||
"react-router-dom": "^6.3.0",
|
"react-router-dom": "^6.3.0",
|
||||||
"react-scripts": "^5.0.1",
|
"react-scripts": "^5.0.1",
|
||||||
|
"react-swipeable": "^7.0.0",
|
||||||
"react-test-renderer": "^18.2.0",
|
"react-test-renderer": "^18.2.0",
|
||||||
"styled-components": "^5.3.5",
|
"styled-components": "^5.3.5",
|
||||||
"subscriptions-transport-ws": "^0.11.0",
|
"subscriptions-transport-ws": "^0.11.0",
|
||||||
|
|
|
@ -3,6 +3,8 @@ import styled from 'styled-components'
|
||||||
import { debounce, DebouncedFn } from '../../../helpers/utils'
|
import { debounce, DebouncedFn } from '../../../helpers/utils'
|
||||||
import { closePresentModeAction, GalleryAction } from '../mediaGalleryReducer'
|
import { closePresentModeAction, GalleryAction } from '../mediaGalleryReducer'
|
||||||
|
|
||||||
|
import { useSwipeable } from 'react-swipeable'
|
||||||
|
|
||||||
import ExitIcon from './icons/Exit'
|
import ExitIcon from './icons/Exit'
|
||||||
import NextIcon from './icons/Next'
|
import NextIcon from './icons/Next'
|
||||||
import PrevIcon from './icons/Previous'
|
import PrevIcon from './icons/Previous'
|
||||||
|
@ -93,6 +95,13 @@ const PresentNavigationOverlay = ({
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
const handlers = useSwipeable({
|
||||||
|
onSwipedLeft: () => dispatchMedia({ type: 'nextImage' }),
|
||||||
|
onSwipedRight: () => dispatchMedia({ type: 'previousImage' }),
|
||||||
|
preventScrollOnSwipe: false,
|
||||||
|
trackMouse: false,
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledOverlayContainer
|
<StyledOverlayContainer
|
||||||
data-testid="present-overlay"
|
data-testid="present-overlay"
|
||||||
|
@ -100,6 +109,7 @@ const PresentNavigationOverlay = ({
|
||||||
onMouseMove.current && onMouseMove.current()
|
onMouseMove.current && onMouseMove.current()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<div {...handlers}>
|
||||||
{children}
|
{children}
|
||||||
<NavigationButton
|
<NavigationButton
|
||||||
aria-label="Previous image"
|
aria-label="Previous image"
|
||||||
|
@ -130,6 +140,7 @@ const PresentNavigationOverlay = ({
|
||||||
>
|
>
|
||||||
<ExitIcon />
|
<ExitIcon />
|
||||||
</ExitButton>
|
</ExitButton>
|
||||||
|
</div>
|
||||||
</StyledOverlayContainer>
|
</StyledOverlayContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue