Responsive CSS

This commit is contained in:
narcolepticinsomniac 2018-07-02 12:10:41 -04:00 committed by GitHub
parent d207ef9e22
commit 1db66de6c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 64 deletions

View File

@ -1,4 +1,5 @@
body { body {
overflow: hidden;
margin: 0; margin: 0;
font: 12px arial, sans-serif; font: 12px arial, sans-serif;
background: white; background: white;
@ -37,20 +38,13 @@ input:disabled + span {
.container { .container {
display: flex; display: flex;
height: 100vh; height: 100vh;
align-items: stretch;
} }
.main { #header,
display: flex;
flex-direction: column;
flex-grow: 1;
}
.header,
.warnings { .warnings {
flex: 0 0 280px; flex: 0 0 280px;
box-sizing: border-box; box-sizing: border-box;
padding: 15px; padding: 1rem;
border-right: 1px dashed #aaa; border-right: 1px dashed #aaa;
box-shadow: 0 0 50px -18px black; box-shadow: 0 0 50px -18px black;
overflow-wrap: break-word; overflow-wrap: break-word;
@ -58,7 +52,7 @@ input:disabled + span {
z-index: 100; z-index: 100;
} }
.header.meta-init-error { #header.meta-init-error {
display: none; display: none;
} }
@ -279,19 +273,21 @@ li {
overflow: hidden; overflow: hidden;
} }
.main,
.main .CodeMirror { .main .CodeMirror {
height: auto; height: 100% !important;
width: 100% !important;
border: none; border: none;
} }
/* spinner-related */ /* spinner-related */
.header { #header {
position: relative; position: relative;
} }
.header:not(.meta-init) > *:not(.lds-spinner), #header:not(.meta-init) > *:not(.lds-spinner),
.header.meta-init > .lds-spinner { #header.meta-init > .lds-spinner {
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
@ -300,7 +296,7 @@ li {
opacity: 0; opacity: 0;
} }
.header.meta-init > * { #header.meta-init > * {
opacity: 1; opacity: 1;
transition: opacity .5s; transition: opacity .5s;
-webkit-user-select: auto; -webkit-user-select: auto;
@ -450,19 +446,48 @@ label {
/************ reponsive layouts ************/ /************ reponsive layouts ************/
@media (max-width:10in) { @media (max-width:800px) {
body {
overflow: hidden;
}
.container { .container {
flex-direction: column; flex-direction: column;
} }
.header { #header {
flex-basis: auto; flex: 0 1 auto;
border-right: none; border-right: none;
border-bottom: 1px dashed #AAA; border-bottom: 1px dashed #AAA;
max-height: 50%;
overflow-x: auto; overflow-x: auto;
overflow-y: hidden; 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; min-height: 4em;
max-height: 20%; max-height: 20%;
} }
@ -473,53 +498,18 @@ label {
border-bottom: 1px dashed #b57c7c; border-bottom: 1px dashed #b57c7c;
padding-bottom: 1em; padding-bottom: 1em;
} }
.header, ul.applies-to,
.warning { .actions label {
-webkit-column-count: 3; margin: 0;
-moz-column-count: 3;
column-count: 3;
} }
h1 { #header-content-wrapper > * h3 {
-webkit-column-span: all; margin-top: 0;
column-span: all;
margin-bottom: .5em;
}
.actions {
display: flex;
align-items: flex-start;
} }
.install { .install {
margin-right: 1em; 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 */ /* Retina-specific stuff here */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
.install:after { .install:after {

View File

@ -49,7 +49,7 @@
setTimeout(() => { setTimeout(() => {
if (!installed) { if (!installed) {
$('.header').appendChild($create('.lds-spinner', $('#header').appendChild($create('.lds-spinner',
new Array(12).fill($create('div')).map(e => e.cloneNode()))); new Array(12).fill($create('div')).map(e => e.cloneNode())));
} }
}, 200); }, 200);
@ -133,8 +133,8 @@
$('.external-link').appendChild(externalLink); $('.external-link').appendChild(externalLink);
} }
$('.header').classList.add('meta-init'); $('#header').classList.add('meta-init');
$('.header').classList.remove('meta-init-error'); $('#header').classList.remove('meta-init-error');
setTimeout(() => $.remove('.lds-spinner'), 1000); setTimeout(() => $.remove('.lds-spinner'), 1000);
showError(''); showError('');
@ -222,7 +222,7 @@
API.buildUsercss({sourceCode, checkDup: true}) API.buildUsercss({sourceCode, checkDup: true})
.then(init) .then(init)
.catch(err => { .catch(err => {
$('.header').classList.add('meta-init-error'); $('#header').classList.add('meta-init-error');
showError(err); showError(err);
}); });
} }