fix media query edge case (#13546)

* fix media query edge case

was failing for 768px width before

* code review

* define responsive breakpoints as less variables

* add missing variables.less

* rename variables, drop screen constraints

* fix less import

* Apply suggestions from code review

Co-authored-by: silverwind <me@silverwind.io>

* code review

altough it doesnt matter, LESS lazy evals variables

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
Norwin 2020-11-17 05:33:19 +00:00 committed by GitHub
parent b83825253e
commit 75ebf7c5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 72 additions and 51 deletions

View File

@ -88,16 +88,16 @@
#notice-table { #notice-table {
.notice-description { .notice-description {
@media only screen and (max-width: 767px) { @media @mediaSm {
max-width: 80vw; max-width: 80vw;
} }
@media only screen and (max-width: 991px) and (min-width: 768px) { @media @mediaMd {
max-width: 360px; max-width: 360px;
} }
@media only screen and (min-width: 992px) and (max-width: 1199.98px) { @media @mediaLg {
max-width: 510px; max-width: 510px;
} }
@media only screen and (min-width: 1200px) { @media @mediaXl {
max-width: 640px; max-width: 640px;
} }
} }

View File

@ -334,7 +334,7 @@ a:hover,
margin-right: 0 !important; margin-right: 0 !important;
} }
@media only screen and (max-width: 767px) { @media @mediaSm {
#navbar:not(.shown) > *:not(:first-child) { #navbar:not(.shown) > *:not(:first-child) {
display: none; display: none;
} }
@ -774,7 +774,7 @@ a:hover,
} }
&.pagination.menu { &.pagination.menu {
@media only screen and (max-width: 767px) { @media @mediaSm {
.item:not(.active):not(.navigation), .item:not(.active):not(.navigation),
.item.navigation span.navigation_label { .item.navigation span.navigation_label {
display: none; display: none;
@ -900,7 +900,7 @@ footer {
} }
// Conditional display // Conditional display
@media only screen and (min-width: 768px) { @media @mediaMdAndUp {
.mobile-only, .mobile-only,
.ui.button.mobile-only { .ui.button.mobile-only {
display: none; display: none;
@ -913,7 +913,7 @@ footer {
} }
} }
@media only screen and (max-width: 767px) { @media @mediaSm {
.not-mobile { .not-mobile {
display: none; display: none;
} }
@ -941,7 +941,7 @@ footer {
clip: auto; clip: auto;
} }
@media only screen and (max-width: 991px) and (min-width: 768px) { @media @mediaMd {
.ui.container { .ui.container {
width: 95%; width: 95%;
} }
@ -956,7 +956,7 @@ footer {
border-width: 1px !important; border-width: 1px !important;
} }
@media only screen and (max-width: 1200px) { @media @mediaLgAndDown {
.ui.menu.new-menu { .ui.menu.new-menu {
overflow-x: auto !important; overflow-x: auto !important;
justify-content: left !important; justify-content: left !important;
@ -1398,7 +1398,7 @@ table th[data-sortt-desc] {
} }
.dropdown:not(.selection) > .menu.review-box > * { .dropdown:not(.selection) > .menu.review-box > * {
@media only screen and (max-height: 700px) { @media (max-height: 700px) {
.CodeMirror, .CodeMirror,
.CodeMirror-scroll { .CodeMirror-scroll {
min-height: 100px; min-height: 100px;

View File

@ -33,7 +33,7 @@
left: 90%; left: 90%;
width: 15%; width: 15%;
@media only screen and (max-width: 768px) { @media @mediaSm {
top: 10px; top: 10px;
left: auto; left: auto;
width: auto; width: auto;
@ -55,7 +55,7 @@
left: auto !important; left: auto !important;
} }
@media only screen and (max-width: 768px) { @media @mediaSm {
width: 100%; width: 100%;
} }
} }

View File

@ -142,7 +142,7 @@ textarea:focus,
text-align: center; text-align: center;
} }
@media only screen and (min-width: 768px) { @media @mediaMdAndUp {
width: 800px !important; width: 800px !important;
.header { .header {
@ -169,7 +169,7 @@ textarea:focus,
} }
} }
@media only screen and (max-width: 767px) { @media @mediaSm {
.optional .title { .optional .title {
margin-left: 15px; margin-left: 15px;
} }
@ -211,7 +211,7 @@ textarea:focus,
} }
} }
@media only screen and (min-width: 768px) { @media @mediaMdAndUp {
.g-recaptcha, .g-recaptcha,
.h-captcha { .h-captcha {
margin: 0 auto !important; margin: 0 auto !important;
@ -220,7 +220,7 @@ textarea:focus,
} }
} }
@media screen and (max-height: 575px) { @media (max-height: 575px) {
#rc-imageselect, #rc-imageselect,
.g-recaptcha, .g-recaptcha,
.h-captcha { .h-captcha {
@ -252,7 +252,7 @@ textarea:focus,
.inline.field > label, .inline.field > label,
input { input {
@media only screen and (max-width: 768px) { @media @mediaSm {
width: 100% !important; width: 100% !important;
} }
} }
@ -290,7 +290,7 @@ textarea:focus,
width: 50% !important; width: 50% !important;
} }
@media only screen and (max-width: 768px) { @media @mediaSm {
label, label,
input, input,
.selection.dropdown { .selection.dropdown {
@ -308,7 +308,7 @@ textarea:focus,
&.new.repo { &.new.repo {
.ui.form { .ui.form {
@media only screen and (min-width: 768px) { @media @mediaMdAndUp {
#auto-init { #auto-init {
margin-left: @create-page-form-input-padding+15px; margin-left: @create-page-form-input-padding+15px;
} }
@ -317,7 +317,7 @@ textarea:focus,
.selection.dropdown:not(.owner) { .selection.dropdown:not(.owner) {
width: 50% !important; width: 50% !important;
@media only screen and (max-width: 768px) { @media @mediaSm {
width: 100% !important; width: 100% !important;
} }
} }
@ -346,7 +346,7 @@ textarea:focus,
} }
.new.org .ui.form { .new.org .ui.form {
@media only screen and (max-width: 768px) { @media @mediaSm {
.field button, .field button,
.field a { .field a {
margin-bottom: 1em; margin-bottom: 1em;

View File

@ -4,7 +4,7 @@
} }
.hero { .hero {
@media only screen and (max-width: 767px) { @media @mediaSm {
h1 { h1 {
font-size: 3.5em; font-size: 3.5em;
} }
@ -14,7 +14,7 @@
} }
} }
@media only screen and (min-width: 768px) { @media @mediaMdAndUp {
h1 { h1 {
font-size: 5.5em; font-size: 5.5em;
} }
@ -52,7 +52,7 @@
footer { footer {
.ui.container .left, .ui.container .left,
.ui.container .right { .ui.container .right {
@media only screen and (max-width: 880px) { @media (max-width: 880px) {
display: block; display: block;
text-align: center; text-align: center;
float: none; float: none;

View File

@ -122,7 +122,7 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@media (max-width: 1200px) { @media @mediaLgAndDown {
.title { .title {
max-width: 150px; max-width: 150px;
} }
@ -216,7 +216,7 @@
#clone-panel { #clone-panel {
width: 350px; width: 350px;
@media only screen and (max-width: 768px) { @media @mediaSm {
width: 100%; width: 100%;
} }
@ -279,7 +279,7 @@
} }
.ui.tiny.blue.buttons { .ui.tiny.blue.buttons {
@media only screen and (max-width: 768px) { @media @mediaSm {
width: 100%; width: 100%;
} }
} }
@ -629,7 +629,7 @@
width: 100%; width: 100%;
} }
@media only screen and (max-width: 768px) { @media @mediaSm {
flex-direction: column; flex-direction: column;
h1 { h1 {
@ -1025,7 +1025,7 @@
} }
} }
@media only screen and (max-width: 767px) { @media @mediaSm {
.form .button { .form .button {
width: 100%; width: 100%;
@ -1578,7 +1578,7 @@
background: #ffffff; background: #ffffff;
line-height: 30px; line-height: 30px;
@media only screen and (max-width: 992px) { @media @mediaMdAndDown {
flex-direction: column; flex-direction: column;
align-items: flex-start; align-items: flex-start;
} }
@ -2019,13 +2019,13 @@
button, button,
input { input {
@media only screen and (max-width: 438px) { @media (max-width: 438px) {
width: 100%; width: 100%;
} }
} }
button { button {
@media only screen and (max-width: 768px) { @media @mediaSm {
margin-bottom: 1em; margin-bottom: 1em;
} }
} }
@ -2110,7 +2110,7 @@
} }
} }
@media only screen and (max-width: 767px) { @media @mediaSm {
.dividing.header .stackable.grid .button { .dividing.header .stackable.grid .button {
margin-top: 2px; margin-top: 2px;
margin-bottom: 2px; margin-bottom: 2px;
@ -3002,7 +3002,7 @@ tbody.commit-list {
vertical-align: middle; vertical-align: middle;
} }
@media only screen and (max-width: 767.98px) { @media @mediaSm {
tr.commit-list { tr.commit-list {
width: 100%; width: 100%;
} }
@ -3012,7 +3012,7 @@ tbody.commit-list {
} }
} }
@media only screen and (min-width: 768px) and (max-width: 991.98px) { @media @mediaMd {
tr.commit-list { tr.commit-list {
width: 723px; width: 723px;
} }
@ -3021,7 +3021,7 @@ tbody.commit-list {
} }
} }
@media only screen and (min-width: 992px) and (max-width: 1199.98px) { @media @mediaLg {
tr.commit-list { tr.commit-list {
width: 933px; width: 933px;
} }
@ -3030,7 +3030,7 @@ tbody.commit-list {
} }
} }
@media only screen and (min-width: 1200px) { @media @mediaXl {
tr.commit-list { tr.commit-list {
width: 1127px; width: 1127px;
} }
@ -3076,7 +3076,7 @@ tbody.commit-list {
} }
} }
@media only screen and (max-width: 767px) { @media @mediaSm {
.ui.stackable.menu { .ui.stackable.menu {
&.mobile--margin-between-items > .item { &.mobile--margin-between-items > .item {
margin-top: 5px; margin-top: 5px;
@ -3336,7 +3336,7 @@ td.blob-excerpt {
.repository .ui.menu.new-menu { .repository .ui.menu.new-menu {
background: none !important; background: none !important;
@media only screen and (max-width: 1200px) { @media @mediaLgAndDown {
&::after { &::after {
background: none !important; background: none !important;
} }

View File

@ -1,3 +1,5 @@
@import "variables.less";
.ui.button.add-code-comment { .ui.button.add-code-comment {
padding: 2px; padding: 2px;
position: absolute; position: absolute;
@ -146,7 +148,7 @@ a.blob-excerpt:hover {
margin-left: .5rem; margin-left: .5rem;
} }
@media only screen and (max-width: 768px) { @media @mediaSm {
#review-box > .menu { #review-box > .menu {
> .ui.segment { > .ui.segment {
width: 94vw; width: 94vw;
@ -161,19 +163,19 @@ a.blob-excerpt:hover {
} }
} }
@media only screen and (min-width: 768px) and (max-width: 992px) { @media @mediaMd {
#review-box .CodeMirror-scroll { #review-box .CodeMirror-scroll {
max-width: 700px; max-width: 700px;
} }
} }
@media only screen and (min-width: 992px) and (max-width: 1200px) { @media @mediaLg {
#review-box .CodeMirror-scroll { #review-box .CodeMirror-scroll {
max-width: 800px; max-width: 800px;
} }
} }
@media only screen and (min-width: 1200px) { @media @mediaXl {
#review-box .CodeMirror-scroll { #review-box .CodeMirror-scroll {
max-width: 900px; max-width: 900px;
} }

View File

@ -1,3 +1,5 @@
@import "variables.less";
.user { .user {
&:not(.icon) { &:not(.icon) {
padding-top: 15px; padding-top: 15px;
@ -51,18 +53,18 @@
img { img {
width: 100%; width: 100%;
} }
@media only screen and (max-width: 768px) { @media @mediaSm {
height: 250px; height: 250px;
overflow: hidden; overflow: hidden;
img { img {
max-height: 768px; max-height: 767px;
max-width: 768px; max-width: 767px;
} }
} }
} }
@media only screen and (max-width: 768px) { @media @mediaSm {
width: 100%; width: 100%;
} }
} }

View File

@ -7,7 +7,7 @@
padding: 0 !important; padding: 0 !important;
} }
@media (max-width: 1200px) { @media @mediaLgAndDown {
& { & {
display: none; display: none;
} }
@ -30,7 +30,7 @@
left: 25px; left: 25px;
} }
@media (max-width: 1200px) { @media @mediaLgAndDown {
.heatmap-container .total-contributions { .heatmap-container .total-contributions {
left: 21px; left: 21px;
} }

View File

@ -1,5 +1,6 @@
@import "~font-awesome/css/font-awesome.css"; @import "~font-awesome/css/font-awesome.css";
@import "./variables.less";
@import "./features/gitgraph.less"; @import "./features/gitgraph.less";
@import "./features/animations.less"; @import "./features/animations.less";
@import "./features/heatmap.less"; @import "./features/heatmap.less";

View File

@ -1,3 +1,5 @@
@import "../variables.less";
:root { :root {
--color-primary: #87ab63; --color-primary: #87ab63;
--color-primary-dark-1: #93b373; --color-primary-dark-1: #93b373;
@ -1222,7 +1224,7 @@ td.blob-hunk {
background: #2a2e3a; background: #2a2e3a;
border-color: transparent !important; border-color: transparent !important;
@media only screen and (max-width: 1200px) { @media @mediaLgAndDown {
&::after { &::after {
background: linear-gradient(to right, transparent 0%, #2a2e3a 100%); background: linear-gradient(to right, transparent 0%, #2a2e3a 100%);
} }

View File

@ -0,0 +1,14 @@
// here a standard set of media queries is defined, that is compatible with the
// responsive grid used in fomantic css. As there only is a precompiled build
// of fomantic checked in (since 946bbbe), we can't use their less variables
// here, but these breakpoints shouldn't change in the foreseeable future.
@mediaMdAndUp: ~"(min-width: 768px)";
@mediaMdAndDown: ~"(max-width: 991px)";
@mediaLgAndUp: ~"(min-width: 992px)";
@mediaLgAndDown: ~"(max-width: 1200px)";
@mediaSm: ~"(max-width: 767px)";
@mediaMd: @mediaMdAndUp and @mediaMdAndDown;
@mediaLg: @mediaLgAndUp and @mediaLgAndDown;
@mediaXl: ~"(min-width: 1201px)";