Skip to content

Commit 5962bd1

Browse files
committed
Merge branch 'release-2.19.6' into release
2 parents c302fe8 + ccc3936 commit 5962bd1

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

client/modules/App/components/Overlay.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useRef } from 'react';
2-
import MediaQuery from 'react-responsive';
2+
import { useMediaQuery } from 'react-responsive';
33
import { useSelector } from 'react-redux';
44
import { useHistory } from 'react-router-dom';
55
import { useTranslation } from 'react-i18next';
@@ -9,8 +9,8 @@ import type { RootState } from '../../../reducers';
99
import ExitIcon from '../../../images/exit.svg';
1010

1111
type OverlayProps = {
12-
children?: React.ReactElement;
13-
actions?: React.ReactElement;
12+
children?: React.ReactNode;
13+
actions?: React.ReactNode;
1414
closeOverlay?: () => void;
1515
title?: string;
1616
ariaLabel?: string;
@@ -35,6 +35,9 @@ export const Overlay = ({
3535

3636
const browserHistory = useHistory();
3737

38+
const isDesktop = useMediaQuery({ minWidth: 770 });
39+
const isMobile = useMediaQuery({ maxWidth: 769 });
40+
3841
const close = useCallback(() => {
3942
const node = ref.current;
4043
if (!node) return;
@@ -66,7 +69,7 @@ export const Overlay = ({
6669
<header className="overlay__header">
6770
<h2 className="overlay__title">{title}</h2>
6871
<div className="overlay__actions">
69-
<MediaQuery minWidth={770}>{actions}</MediaQuery>
72+
{isDesktop && actions}
7073
<button
7174
className="overlay__close-button"
7275
onClick={close}
@@ -76,11 +79,9 @@ export const Overlay = ({
7679
</button>
7780
</div>
7881
</header>
79-
<MediaQuery maxWidth={769}>
80-
{actions && (
81-
<div className="overlay__actions-mobile">{actions}</div>
82-
)}
83-
</MediaQuery>
82+
{isMobile && actions && (
83+
<div className="overlay__actions-mobile">{actions}</div>
84+
)}
8485
{children}
8586
</section>
8687
</div>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5.js-web-editor",
3-
"version": "2.19.5",
3+
"version": "2.19.6",
44
"description": "The web editor for p5.js.",
55
"scripts": {
66
"clean": "rimraf dist",

0 commit comments

Comments
 (0)