From 3dcd9e81206427fbe0018dd58c245d3df716cb28 Mon Sep 17 00:00:00 2001 From: Ryczko Date: Tue, 14 May 2024 17:23:17 +0200 Subject: [PATCH] Fix/Open preview by default --- .../surveys/features/SurveyCreator/SurveyCreator.tsx | 2 +- .../components/PreviewPanel/PreviewPanel.tsx | 6 +++--- .../managers/previewPanelManager/previewPanelManager.ts | 8 +++++++- src/layout/ExternalRouteWrapper.tsx | 2 +- src/layout/StandardPageWrapper.tsx | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/features/surveys/features/SurveyCreator/SurveyCreator.tsx b/src/features/surveys/features/SurveyCreator/SurveyCreator.tsx index 11b8128..04da36f 100644 --- a/src/features/surveys/features/SurveyCreator/SurveyCreator.tsx +++ b/src/features/surveys/features/SurveyCreator/SurveyCreator.tsx @@ -17,7 +17,7 @@ export default function SurveyCreator() { isPanelOpened && 'xl:mr-[550px]' )} > -
+
diff --git a/src/features/surveys/features/SurveyCreator/components/PreviewPanel/PreviewPanel.tsx b/src/features/surveys/features/SurveyCreator/components/PreviewPanel/PreviewPanel.tsx index 6db0b87..4e81f67 100644 --- a/src/features/surveys/features/SurveyCreator/components/PreviewPanel/PreviewPanel.tsx +++ b/src/features/surveys/features/SurveyCreator/components/PreviewPanel/PreviewPanel.tsx @@ -29,11 +29,11 @@ export default function PreviewPanel() {
-
+
-
+
{ const [isPanelOpened, setIsPanelOpened] = useState(false); + useEffect(() => { + if (window.innerWidth > 1280) { + setIsPanelOpened(true); + } + }, []); + const togglePanel = () => { setIsPanelOpened((prev) => !prev); }; diff --git a/src/layout/ExternalRouteWrapper.tsx b/src/layout/ExternalRouteWrapper.tsx index 3e3d879..0ecbe7b 100644 --- a/src/layout/ExternalRouteWrapper.tsx +++ b/src/layout/ExternalRouteWrapper.tsx @@ -2,7 +2,7 @@ import React, { PropsWithChildren } from 'react'; export default function ExternalPageWrapper({ children }: PropsWithChildren) { return ( -
+
{children}
); diff --git a/src/layout/StandardPageWrapper.tsx b/src/layout/StandardPageWrapper.tsx index 43b547a..f8e2500 100644 --- a/src/layout/StandardPageWrapper.tsx +++ b/src/layout/StandardPageWrapper.tsx @@ -2,7 +2,7 @@ import React, { PropsWithChildren } from 'react'; export default function StandardPageWrapper({ children }: PropsWithChildren) { return ( -
+
{children}
);