overlay reduced motion support

This commit is contained in:
tmshv committed 2019-10-15 23:05:31 +03:00
1 parent bdde0f79c1
commit fbcf204642
3 files changed
+15 -1

No files matched your search

+5
View File
@@ -1,5 +1,6 @@
import * as React from 'react'
import { Transition } from './Transition'
import { useReducedMotion } from '../../hooks/useReducedMotion'
export interface IOverlayProps {
show: boolean
@@ -7,6 +8,9 @@ export interface IOverlayProps {
}
export const Overlay: React.FC<IOverlayProps> = props => {
const motionDisabled = useReducedMotion()
const duration = motionDisabled ? 0 : 250
const onClick = React.useCallback((event: React.MouseEvent<HTMLDivElement>) => {
if (event.target === event.currentTarget) {
props.onClickOverlay()
@@ -19,6 +23,7 @@ export const Overlay: React.FC<IOverlayProps> = props => {
return (
<Transition
duration={duration}
show={props.show}
extraStyle={{
zIndex: 1000000,