From 160a739f7deecc0544cd630e9a0a582b0403eb76 Mon Sep 17 00:00:00 2001 From: Jos de Jong Date: Wed, 27 Mar 2024 15:43:29 +0100 Subject: [PATCH] feat: fullscreen support for modals (#420) --- src/lib/components/modals/Header.scss | 10 +----- src/lib/components/modals/Header.svelte | 19 ++++++++++- .../components/modals/JSONEditorModal.svelte | 13 ++++++- src/lib/components/modals/Modal.scss | 15 ++++++-- .../components/modals/TransformModal.svelte | 14 ++++++-- .../modals/TransformModalHeader.scss | 9 +++++ .../modals/TransformModalHeader.svelte | 34 +++++++++---------- src/lib/styles.scss | 12 +++++++ 8 files changed, 92 insertions(+), 34 deletions(-) create mode 100644 src/lib/components/modals/TransformModalHeader.scss diff --git a/src/lib/components/modals/Header.scss b/src/lib/components/modals/Header.scss index 903ab5ec..58f6c90e 100644 --- a/src/lib/components/modals/Header.scss +++ b/src/lib/components/modals/Header.scss @@ -12,14 +12,6 @@ } button { - border: none; - background: transparent; - min-width: 32px; - color: inherit; - cursor: pointer; - - &:hover { - background: rgba(255, 255, 255, 0.1); - } + @include jse-modal-menu-button; } } diff --git a/src/lib/components/modals/Header.svelte b/src/lib/components/modals/Header.svelte index 4cf32bd9..f1df3d7a 100644 --- a/src/lib/components/modals/Header.svelte +++ b/src/lib/components/modals/Header.svelte @@ -3,10 +3,16 @@ -
+
diff --git a/src/lib/components/modals/Modal.scss b/src/lib/components/modals/Modal.scss index bf14ba21..8fd1a213 100644 --- a/src/lib/components/modals/Modal.scss +++ b/src/lib/components/modals/Modal.scss @@ -57,6 +57,7 @@ :global(.bg.jse-modal-bg .jse-modal-window-wrap) { margin: 0; + overflow: auto; } :global(.bg.jse-modal-bg .jse-modal-window) { @@ -78,15 +79,23 @@ :global(.bg.jse-modal-bg .jse-modal-window.jse-modal-window-jsoneditor) { width: 800px; - height: auto; - min-height: 500px; - max-height: calc(100vh - 6rem); + max-height: 500px; display: flex; } +:global(.bg.jse-modal-bg .jse-modal-window:has(div.fullscreen)) { + margin: $padding; + padding: 0; + width: calc(100vw - 2 * $padding); + height: calc(100vh - 2 * $padding); + max-width: none; + max-height: none; +} + :global(.bg.jse-modal-bg .jse-modal-container) { flex: 1; display: flex; flex-direction: column; padding: 0; + max-height: none; } diff --git a/src/lib/components/modals/TransformModal.svelte b/src/lib/components/modals/TransformModal.svelte index 0c894c89..ca3bc76f 100644 --- a/src/lib/components/modals/TransformModal.svelte +++ b/src/lib/components/modals/TransformModal.svelte @@ -65,8 +65,9 @@ const { close } = getContext('simple-modal') - const stateId = `${id}:${compileJSONPointer(rootPath)}` + let fullscreen = false + const stateId = `${id}:${compileJSONPointer(rootPath)}` const state = transformModalStates[stateId] || {} // showWizard is not stored inside a stateId @@ -209,14 +210,23 @@ query = newSelectedQueryLanguage.createQuery(selectedJson, queryOptions) isManual = false } + + function handleEscape() { + if (fullscreen) { + fullscreen = !fullscreen + } else { + close() + } + } -
+
diff --git a/src/lib/components/modals/TransformModalHeader.scss b/src/lib/components/modals/TransformModalHeader.scss new file mode 100644 index 00000000..999e31b2 --- /dev/null +++ b/src/lib/components/modals/TransformModalHeader.scss @@ -0,0 +1,9 @@ +@import '../../styles'; + +.jse-config { + @include jse-modal-menu-button; + + &.hide { + display: none; + } +} diff --git a/src/lib/components/modals/TransformModalHeader.svelte b/src/lib/components/modals/TransformModalHeader.svelte index c18d6579..eedc4d3d 100644 --- a/src/lib/components/modals/TransformModalHeader.svelte +++ b/src/lib/components/modals/TransformModalHeader.svelte @@ -3,14 +3,16 @@ -
-
Transform
- {#if queryLanguages.length > 1} - - {/if} - -
+
- + diff --git a/src/lib/styles.scss b/src/lib/styles.scss index 1d0e1283..57b3db64 100644 --- a/src/lib/styles.scss +++ b/src/lib/styles.scss @@ -110,6 +110,18 @@ $errors-overview-max-height: 25%; } } +@mixin jse-modal-menu-button { + border: none; + background: transparent; + min-width: 32px; + color: inherit; + cursor: pointer; + + &:hover { + background: rgba(255, 255, 255, 0.1); + } +} + @mixin jse-column-header-mixin { background: none; border: none;