diff --git a/src/components/ColorPicker.scss b/src/components/ColorPicker.scss index 86b0d9328..23a6aac82 100644 --- a/src/components/ColorPicker.scss +++ b/src/components/ColorPicker.scss @@ -218,7 +218,7 @@ left: 2px; } - @media #{$media-query} { + @media #{$is-mobile-query} { display: none; } } diff --git a/src/components/ContextMenu.scss b/src/components/ContextMenu.scss index 089c9013b..fe8059e09 100644 --- a/src/components/ContextMenu.scss +++ b/src/components/ContextMenu.scss @@ -74,7 +74,7 @@ z-index: 1; } - @media #{$media-query} { + @media #{$is-mobile-query} { .context-menu-option { display: block; diff --git a/src/components/Dialog.scss b/src/components/Dialog.scss index 5c94a9069..3ca5d6258 100644 --- a/src/components/Dialog.scss +++ b/src/components/Dialog.scss @@ -18,7 +18,7 @@ margin: 0; } - @media #{$media-query} { + @media #{$is-mobile-query} { .Dialog { --metric: calc(var(--space-factor) * 4); --inset-left: #{"max(var(--metric), var(--sal))"}; diff --git a/src/components/ExportDialog.scss b/src/components/ExportDialog.scss index 9a479d58f..3086d72b1 100644 --- a/src/components/ExportDialog.scss +++ b/src/components/ExportDialog.scss @@ -37,7 +37,7 @@ } } - @media (max-width: 550px) { + @media #{$is-mobile-query} { .ExportDialog { display: flex; flex-direction: column; @@ -51,9 +51,7 @@ .ExportDialog__actions > * { margin-bottom: calc(var(--space-factor) * 3); } - } - @media #{$media-query} { .ExportDialog__preview canvas { max-height: 30vh; } diff --git a/src/components/HintViewer.scss b/src/components/HintViewer.scss index 63db75114..87b502b64 100644 --- a/src/components/HintViewer.scss +++ b/src/components/HintViewer.scss @@ -1,5 +1,8 @@ @import "../css/_variables"; +// this is loosely based on the longest hint text +$wide-viewport-width: 1000px; + .excalidraw { .HintViewer { pointer-events: none; @@ -16,12 +19,9 @@ color: $oc-gray-6; font-size: 0.8rem; - @media (min-width: 1200px) { - white-space: pre; - } - - @media #{$media-query} { + @media #{$is-mobile-query} { position: static; + padding-right: 2em; } > span { diff --git a/src/components/IconPicker.scss b/src/components/IconPicker.scss index 9521e7eda..62c2b5d49 100644 --- a/src/components/IconPicker.scss +++ b/src/components/IconPicker.scss @@ -110,7 +110,7 @@ :root[dir="rtl"] & { left: 2px; } - @media #{$media-query} { + @media #{$is-mobile-query} { display: none; } } diff --git a/src/components/Modal.scss b/src/components/Modal.scss index 10620e1f7..c009b4e49 100644 --- a/src/components/Modal.scss +++ b/src/components/Modal.scss @@ -40,7 +40,7 @@ background: var(--bg-color-island); backdrop-filter: none; - @media #{$media-query} { + @media #{$is-mobile-query} { max-width: 100%; } } @@ -74,7 +74,7 @@ top: calc(var(--space-factor) * 5); } - @media #{$media-query} { + @media #{$is-mobile-query} { .Modal { padding: 0; } diff --git a/src/components/ToolIcon.scss b/src/components/ToolIcon.scss index 3c542aea0..91e8e1bc5 100644 --- a/src/components/ToolIcon.scss +++ b/src/components/ToolIcon.scss @@ -142,6 +142,7 @@ user-select: none; } + // shrink shape icons on small viewports to make them fit @media (max-width: 425px) { .Shape .ToolIcon__icon { width: 2rem; @@ -153,6 +154,8 @@ } } + // move the lock button out of the way on small viewports + // it begins to collide with the GitHub icon before we switch to mobile mode @media (max-width: 760px) { .ToolIcon.ToolIcon__lock { display: inline-block; @@ -162,6 +165,7 @@ margin-left: 0; border-radius: 20px 0 0 20px; + z-index: 1; background-color: var(--button-gray-1); @@ -189,7 +193,7 @@ margin-left: 5px; margin-top: 1px; - @media #{$media-query} { + @media #{$is-mobile-query} { display: none; } } diff --git a/src/css/_variables.scss b/src/css/_variables.scss index 142d1756b..4e4ac861d 100644 --- a/src/css/_variables.scss +++ b/src/css/_variables.scss @@ -1,3 +1,4 @@ @import "open-color/open-color.scss"; -$media-query: "(max-width: 600px), (max-height: 500px) and (max-width: 1000px)"; +// keep up to date with is-mobile.tsx +$is-mobile-query: "(max-width: 600px), (max-height: 500px) and (max-width: 1000px)"; diff --git a/src/css/styles.scss b/src/css/styles.scss index 28edcc7ee..c2fcd527b 100644 --- a/src/css/styles.scss +++ b/src/css/styles.scss @@ -441,7 +441,7 @@ } } - @media #{$media-query} { + @media #{$is-mobile-query} { aside { display: none; } diff --git a/src/is-mobile.tsx b/src/is-mobile.tsx index 9a8d5fe2b..c20bf89de 100644 --- a/src/is-mobile.tsx +++ b/src/is-mobile.tsx @@ -11,6 +11,7 @@ export const IsMobileProvider = ({ if (!query.current) { query.current = window.matchMedia ? window.matchMedia( + // keep up to date with _variables.scss "(max-width: 640px), (max-height: 500px) and (max-width: 1000px)", ) : (({