This commit is contained in:
Daniel Shleifman
2022-06-26 14:28:40 +03:00
parent 86df13a01c
commit 3d2e669af8

View File

@@ -7,11 +7,16 @@ import IOSShareIcon from './IOSShareIcon'
import { StyledWrapper, StyledHeader, StyledContent } from './style' import { StyledWrapper, StyledHeader, StyledContent } from './style'
export function PWAInstallationGuide() { export function PWAInstallationGuide() {
const [isOpen, setIsOpen] = useState(!JSON.parse(localStorage.getItem('pwaNotificationIsClosed'))) const pwaNotificationIsClosed = JSON.parse(localStorage.getItem('pwaNotificationIsClosed'))
const [isOpen, setIsOpen] = useState(!pwaNotificationIsClosed)
const [shouldBeOpened, setShouldBeOpened] = useState(!pwaNotificationIsClosed)
const { t } = useTranslation() const { t } = useTranslation()
if (!isOpen) return null
return ( return (
<StyledWrapper isOpen={isOpen}> <StyledWrapper isOpen={shouldBeOpened}>
<StyledHeader> <StyledHeader>
<img src='/apple-icon-180.png' width={50} alt='ts-icon' /> <img src='/apple-icon-180.png' width={50} alt='ts-icon' />
@@ -22,8 +27,12 @@ export function PWAInstallationGuide() {
aria-label='close' aria-label='close'
color='inherit' color='inherit'
onClick={() => { onClick={() => {
setShouldBeOpened(false)
setTimeout(() => {
setIsOpen(false) setIsOpen(false)
localStorage.setItem('pwaNotificationIsClosed', true) localStorage.setItem('pwaNotificationIsClosed', true)
}, 300)
}} }}
> >
<CloseIcon fontSize='small' /> <CloseIcon fontSize='small' />