From b05e822c4b5946f5c59371c6a60d6470e99e37bd Mon Sep 17 00:00:00 2001 From: gravel Date: Mon, 22 May 2023 14:54:59 +0000 Subject: [PATCH] Introduce tabbed modal layout --- output/index.css | 93 ++++++++++----- output/main.js | 12 ++ sites/+components/qr_modals.php | 193 +++++++++++++++++--------------- 3 files changed, 180 insertions(+), 118 deletions(-) diff --git a/output/index.css b/output/index.css index adaf84e..10bf61a 100644 --- a/output/index.css +++ b/output/index.css @@ -417,17 +417,28 @@ footer nav a { #details-modal { padding: 0; width: 80vw; - max-height: 80vh; + --modal-height: calc(80vh - 4em); + height: var(var(--modal-height)); color: var(--primary-color); background-color: var(--secondary-color); --icon-size: 4rem; } #details-modal-contents { + display: flex; + flex-direction: column; + box-sizing: border-box; +} + +#details-modal-flow { display: flex; flex-direction: column; padding: 3em; + height: var(--modal-height); + overflow: auto; box-sizing: border-box; + justify-content: space-between; + gap: 1em; } #details-modal-close { @@ -449,11 +460,16 @@ footer nav a { font-style: italic; } -#details-modal-pane { +#details-modal-panes { display: flex; flex-direction: row; } +#details-modal-panes, .details-modal-pane { + /* Jank overlap with actions when overflows */ + /* height: 100%; */ +} + #details-modal-start { display: flex; flex-direction: column; @@ -518,11 +534,6 @@ footer nav a { filter: blur(3px); } -#details-modal-start #details-modal-description { - max-height: 50vh; - overflow: auto; -} - #details-modal-start #details-modal-description-inner:empty::after { content: "No description"; font-style: italic; @@ -535,8 +546,8 @@ footer nav a { #details-modal-end #details-modal-qr-code { aspect-ratio: 1; - width: 20em; - height: 20em; + width: 15em; + height: 15em; margin: 1em; } @@ -544,6 +555,15 @@ footer nav a { text-align: center; } +#details-modal-actions { + display: flex; + width: 100%; + flex-direction: row; + flex-wrap: wrap; + gap: .5em; + row-gap: .5em; +} + #details-modal .themed-button { color: var(--primary-color); background-color: var(--secondary-color); @@ -629,24 +649,7 @@ footer nav a { } } -@media (max-width: 950px) { - #details-modal-pane { - flex-direction: column; - } - - #details-modal-end { - align-items: start; - } - - #details-modal #details-modal-qr-code { - width: 12.5em; - height: 12.5em; - } - - #details-modal-qr-code-label-name { - display: inline; - } - +@media (max-height: 1100px) { #details-modal-language, #details-modal-users, #details-modal-created { display: inline-block; text-align: center; @@ -662,6 +665,42 @@ footer nav a { } } +@media (max-width: 1000px) { + #details-modal-pane-selection { + display: inline-flex; + flex-direction: row; + } + + #details-modal-panes[data-pane="0"] > .details-modal-pane:not([data-pane="0"]), + #details-modal-panes[data-pane="1"] > .details-modal-pane:not([data-pane="1"]) { + display: none; + } + + #details-modal-panes[data-pane="0"] ~ #details-modal-actions .details-modal-pane-button[data-pane="0"], + #details-modal-panes[data-pane="1"] ~ #details-modal-actions .details-modal-pane-button[data-pane="1"] { + display:none + } + + #details-modal-panes { + flex-direction: column; + align-items: stretch; + flex-grow: 500; + } + + #details-modal-panes > gap { + display: none; + } + + #details-modal #details-modal-qr-code { + width: 30vh; + height: 30vh; + } + + #details-modal-qr-code-label-name { + display: inline; + } +} + @media (max-width: 500px) { :root { /* ! For when descriptions don't wrap and 100vw doesn't work. */ diff --git a/output/main.js b/output/main.js index a29d4b2..b43dd21 100644 --- a/output/main.js +++ b/output/main.js @@ -135,6 +135,8 @@ function displayQRModal(communityID) { dom.details_modal_qr_code().src = communityQRCodeURL(communityID); + document.getElementById('details-modal-panes').setAttribute('data-pane', 0); + modal.showModal(); } @@ -181,6 +183,16 @@ function addQRModalHandlers() { } }); + for (const button of document.querySelectorAll('.details-modal-pane-button')) { + button.addEventListener( + 'click', + function () { + const targetPane = this.getAttribute('data-pane'); + document.getElementById('details-modal-panes')?.setAttribute('data-pane', targetPane); + } + ) + } + document.querySelector('#details-modal-copy-button').addEventListener( 'click', function () { diff --git a/sites/+components/qr_modals.php b/sites/+components/qr_modals.php index 4bac8a0..5347c79 100644 --- a/sites/+components/qr_modals.php +++ b/sites/+components/qr_modals.php @@ -1,7 +1,6 @@ -
@@ -9,103 +8,115 @@
(Esc to close.) -
-
-
-
-

-
-

- -

- -
-

- -

-

- Language: -

-

- Users: -

-

- Created: -

-

- Server: - +

+
+
+
+

+ >

+
+

+ +

+

+ +
+

+ Language: +

+

+ Users: +

+

+ Created: +

+

+ Server: + +

+
+
+ +
+ +
+ Scan QR code in Session to join + '' +
- -
- + + + + +
- -

- - - - - -

-