From 1db66de6c121bbc6a73213afcbb9bc23143e9491 Mon Sep 17 00:00:00 2001 From: narcolepticinsomniac Date: Mon, 2 Jul 2018 12:10:41 -0400 Subject: [PATCH] Responsive CSS --- install-usercss/install-usercss.css | 110 +++++++++++++--------------- install-usercss/install-usercss.js | 8 +- 2 files changed, 54 insertions(+), 64 deletions(-) diff --git a/install-usercss/install-usercss.css b/install-usercss/install-usercss.css index 1e0cdfef..db1b2c90 100644 --- a/install-usercss/install-usercss.css +++ b/install-usercss/install-usercss.css @@ -1,4 +1,5 @@ body { + overflow: hidden; margin: 0; font: 12px arial, sans-serif; background: white; @@ -37,20 +38,13 @@ input:disabled + span { .container { display: flex; height: 100vh; - align-items: stretch; } -.main { - display: flex; - flex-direction: column; - flex-grow: 1; -} - -.header, +#header, .warnings { flex: 0 0 280px; box-sizing: border-box; - padding: 15px; + padding: 1rem; border-right: 1px dashed #aaa; box-shadow: 0 0 50px -18px black; overflow-wrap: break-word; @@ -58,7 +52,7 @@ input:disabled + span { z-index: 100; } -.header.meta-init-error { +#header.meta-init-error { display: none; } @@ -279,19 +273,21 @@ li { overflow: hidden; } +.main, .main .CodeMirror { - height: auto; + height: 100% !important; + width: 100% !important; border: none; } /* spinner-related */ -.header { +#header { position: relative; } -.header:not(.meta-init) > *:not(.lds-spinner), -.header.meta-init > .lds-spinner { +#header:not(.meta-init) > *:not(.lds-spinner), +#header.meta-init > .lds-spinner { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; @@ -300,7 +296,7 @@ li { opacity: 0; } -.header.meta-init > * { +#header.meta-init > * { opacity: 1; transition: opacity .5s; -webkit-user-select: auto; @@ -450,19 +446,48 @@ label { /************ reponsive layouts ************/ -@media (max-width:10in) { +@media (max-width:800px) { + body { + overflow: hidden; + } .container { flex-direction: column; } - .header { - flex-basis: auto; + #header { + flex: 0 1 auto; border-right: none; border-bottom: 1px dashed #AAA; - max-height: 50%; overflow-x: auto; overflow-y: hidden; + padding: 0; } - .has-warnings .header { + .main { + flex: 1; + } + #header-content-wrapper { + display: flex; + flex-wrap: wrap; + padding: 1rem 0; + box-sizing: border-box; + height: min-content; + } + #header-content-wrapper > * { + flex-grow: 1; + margin: 0; + padding: 0 1rem .5rem; + } + #header-content-wrapper > .meta-description { + flex-basis: 100%; + } + #header-content-wrapper > :last-child { + padding-bottom: 0; + } + .actions { + display: flex; + flex-wrap: wrap; + align-items: center; + } + .has-warnings #header { min-height: 4em; max-height: 20%; } @@ -473,53 +498,18 @@ label { border-bottom: 1px dashed #b57c7c; padding-bottom: 1em; } - .header, - .warning { - -webkit-column-count: 3; - -moz-column-count: 3; - column-count: 3; + ul.applies-to, + .actions label { + margin: 0; } - h1 { - -webkit-column-span: all; - column-span: all; - margin-bottom: .5em; - } - .actions { - display: flex; - align-items: flex-start; + #header-content-wrapper > * h3 { + margin-top: 0; } .install { margin-right: 1em; } } -@media (max-width:7in) { - .header, - .warning { - -webkit-column-count: 2; - -moz-column-count: 2; - column-count: 2; - } -} - -@media (max-width:4in) { - .header { - overflow-x: hidden; - overflow-y: auto; - max-height: 100%; - } - .header, - .warning { - -webkit-column-count: 1; - -moz-column-count: 1; - column-count: 1; - } - .warning { - border: none; - padding-bottom: unset; - } -} - /* Retina-specific stuff here */ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { .install:after { diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index 2e1c3a36..95bea8f2 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -49,7 +49,7 @@ setTimeout(() => { if (!installed) { - $('.header').appendChild($create('.lds-spinner', + $('#header').appendChild($create('.lds-spinner', new Array(12).fill($create('div')).map(e => e.cloneNode()))); } }, 200); @@ -133,8 +133,8 @@ $('.external-link').appendChild(externalLink); } - $('.header').classList.add('meta-init'); - $('.header').classList.remove('meta-init-error'); + $('#header').classList.add('meta-init'); + $('#header').classList.remove('meta-init-error'); setTimeout(() => $.remove('.lds-spinner'), 1000); showError(''); @@ -222,7 +222,7 @@ API.buildUsercss({sourceCode, checkDup: true}) .then(init) .catch(err => { - $('.header').classList.add('meta-init-error'); + $('#header').classList.add('meta-init-error'); showError(err); }); }