From c1f78fc04dcf33e3327f236a60fccd96022d5d82 Mon Sep 17 00:00:00 2001 From: DrMint Date: Sun, 6 Mar 2022 03:44:09 +0100 Subject: [PATCH] Created a component for popup windows --- src/components/AppLayout.tsx | 47 ++++++++++++++---------------------- src/components/Popup.tsx | 33 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 29 deletions(-) create mode 100644 src/components/Popup.tsx diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx index bf6c1ed..d1751be 100644 --- a/src/components/AppLayout.tsx +++ b/src/components/AppLayout.tsx @@ -12,6 +12,7 @@ import { useMediaCoarse, useMediaMobile } from "hooks/useMediaQuery"; import ReactTooltip from "react-tooltip"; import { useAppLayout } from "contexts/AppLayoutContext"; import { ImageQuality } from "./Img"; +import Popup from "./Popup"; type AppLayoutProps = { subPanel?: React.ReactNode; @@ -218,37 +219,25 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element { - {/* Language selection background */} -
{ - appLayout.setLanguagePanelOpen(false); - }} + -
-

{props.langui.select_language}

-
- {router.locales?.sort().map((locale) => ( - - ))} -
+

{props.langui.select_language}

+
+ {router.locales?.sort().map((locale) => ( + + ))}
-
+
>; + state?: boolean; + children: React.ReactNode; +}; + +export default function Popup(props: PopupProps): JSX.Element { + return ( +
+
{ + props.setState(false); + }} + /> +
+ {props.children} +
+
+ ); +}