menu with toggle updated; even icons changed

This commit is contained in:
tmshv committed 2020-02-23 07:43:26 +03:00
1 parent 1181bd61fd
commit 79658002d5
10 files changed
+140 -147

No files matched your search

+16 -20
View File
@@ -1,46 +1,42 @@
import * as React from 'react'
import './styles.css'
import { Transition } from './Transition'
import { useReducedMotion } from '../../hooks/useReducedMotion'
import { useCallback, useEffect } from 'react'
export interface IOverlayProps {
show: boolean
onClickOverlay: () => void
style?: React.CSSProperties
}
export const Overlay: React.FC<IOverlayProps> = props => {
const motionDisabled = useReducedMotion()
const duration = motionDisabled ? 0 : 250
const onClick = React.useCallback((event: React.MouseEvent<HTMLDivElement>) => {
const onClick = useCallback((event: React.MouseEvent<HTMLDivElement>) => {
if (event.target === event.currentTarget) {
props.onClickOverlay()
}
}, [props.onClickOverlay])
const duration = motionDisabled ? 0 : 250
useEffect(() => {
if (props.show) {
document.body.classList.add('noscroll')
} else {
document.body.classList.remove('noscroll')
}
}, [props.show])
return (
<Transition
duration={duration}
show={props.show}
extraStyle={{
zIndex: 1000000,
}}
>
<div
onClick={onClick}
className={'overlay'}
style={props.style}
>
<style jsx>{`
div {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow-y: auto;
background-color: rgb(255, 255, 255);
}
`}</style>
{props.children}
</div>
</Transition>
+11
View File
@@ -0,0 +1,11 @@
.overlay {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
overflow-y: auto;
z-index: 1000000;
background-color: var(--color-back-main);
}