]> source.dussan.org Git - gitea.git/commitdiff
fix media query edge case (#13546)
authorNorwin <noerw@users.noreply.github.com>
Tue, 17 Nov 2020 05:33:19 +0000 (05:33 +0000)
committerGitHub <noreply@github.com>
Tue, 17 Nov 2020 05:33:19 +0000 (00:33 -0500)
* 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>
12 files changed:
web_src/less/_admin.less
web_src/less/_base.less
web_src/less/_dashboard.less
web_src/less/_form.less
web_src/less/_home.less
web_src/less/_repository.less
web_src/less/_review.less
web_src/less/_user.less
web_src/less/features/heatmap.less
web_src/less/index.less
web_src/less/themes/theme-arc-green.less
web_src/less/variables.less [new file with mode: 0644]

index d1bcfb6e25a2ef9cc6affc068b1f53b5da73b32a..0487a5b2ad53e2d11a9a9b9df0fdd1cdb12dc4c2 100644 (file)
 
   #notice-table {
     .notice-description {
-      @media only screen and (max-width: 767px) {
+      @media @mediaSm {
         max-width: 80vw;
       }
-      @media only screen and (max-width: 991px) and (min-width: 768px) {
+      @media @mediaMd {
         max-width: 360px;
       }
-      @media only screen and (min-width: 992px) and (max-width: 1199.98px) {
+      @media @mediaLg {
         max-width: 510px;
       }
-      @media only screen and (min-width: 1200px) {
+      @media @mediaXl {
         max-width: 640px;
       }
     }
index 293c460fd944901ff95abe3ab0acab22621f3895..b313e216376d58d82b1cf05d4349bd52972c9ce8 100644 (file)
@@ -334,7 +334,7 @@ a:hover,
     margin-right: 0 !important;
   }
 
-  @media only screen and (max-width: 767px) {
+  @media @mediaSm {
     #navbar:not(.shown) > *:not(:first-child) {
       display: none;
     }
@@ -774,7 +774,7 @@ a:hover,
   }
 
   &.pagination.menu {
-    @media only screen and (max-width: 767px) {
+    @media @mediaSm {
       .item:not(.active):not(.navigation),
       .item.navigation span.navigation_label {
         display: none;
@@ -900,7 +900,7 @@ footer {
 }
 
 // Conditional display
-@media only screen and (min-width: 768px) {
+@media @mediaMdAndUp {
   .mobile-only,
   .ui.button.mobile-only {
     display: none;
@@ -913,7 +913,7 @@ footer {
   }
 }
 
-@media only screen and (max-width: 767px) {
+@media @mediaSm {
   .not-mobile {
     display: none;
   }
@@ -941,7 +941,7 @@ footer {
   clip: auto;
 }
 
-@media only screen and (max-width: 991px) and (min-width: 768px) {
+@media @mediaMd {
   .ui.container {
     width: 95%;
   }
@@ -956,7 +956,7 @@ footer {
   border-width: 1px !important;
 }
 
-@media only screen and (max-width: 1200px) {
+@media @mediaLgAndDown {
   .ui.menu.new-menu {
     overflow-x: auto !important;
     justify-content: left !important;
@@ -1398,7 +1398,7 @@ table th[data-sortt-desc] {
 }
 
 .dropdown:not(.selection) > .menu.review-box > * {
-  @media only screen and (max-height: 700px) {
+  @media (max-height: 700px) {
     .CodeMirror,
     .CodeMirror-scroll {
       min-height: 100px;
index d798f2bed5ffc1c7cf792374571c3f3f6a4f240a..b73aa83d7da39415d52cdd1ff9045ca8dfe5f8f2 100644 (file)
@@ -33,7 +33,7 @@
           left: 90%;
           width: 15%;
 
-          @media only screen and (max-width: 768px) {
+          @media @mediaSm {
             top: 10px;
             left: auto;
             width: auto;
@@ -55,7 +55,7 @@
         left: auto !important;
       }
 
-      @media only screen and (max-width: 768px) {
+      @media @mediaSm {
         width: 100%;
       }
     }
index 1f9a02b26342ee5f956c4447d48878ec8849e6ae..03f5c83bcaad8f4d09c4468c2482b6fdbe329f60 100644 (file)
@@ -142,7 +142,7 @@ textarea:focus,
       text-align: center;
     }
 
-    @media only screen and (min-width: 768px) {
+    @media @mediaMdAndUp {
       width: 800px !important;
 
       .header {
@@ -169,7 +169,7 @@ textarea:focus,
       }
     }
 
-    @media only screen and (max-width: 767px) {
+    @media @mediaSm {
       .optional .title {
         margin-left: 15px;
       }
@@ -211,7 +211,7 @@ textarea:focus,
   }
 }
 
-@media only screen and (min-width: 768px) {
+@media @mediaMdAndUp {
   .g-recaptcha,
   .h-captcha {
     margin: 0 auto !important;
@@ -220,7 +220,7 @@ textarea:focus,
   }
 }
 
-@media screen and (max-height: 575px) {
+@media (max-height: 575px) {
   #rc-imageselect,
   .g-recaptcha,
   .h-captcha {
@@ -252,7 +252,7 @@ textarea:focus,
 
     .inline.field > label,
     input {
-      @media only screen and (max-width: 768px) {
+      @media @mediaSm {
         width: 100% !important;
       }
     }
@@ -290,7 +290,7 @@ textarea:focus,
         width: 50% !important;
       }
 
-      @media only screen and (max-width: 768px) {
+      @media @mediaSm {
         label,
         input,
         .selection.dropdown {
@@ -308,7 +308,7 @@ textarea:focus,
 
   &.new.repo {
     .ui.form {
-      @media only screen and (min-width: 768px) {
+      @media @mediaMdAndUp {
         #auto-init {
           margin-left: @create-page-form-input-padding+15px;
         }
@@ -317,7 +317,7 @@ textarea:focus,
       .selection.dropdown:not(.owner) {
         width: 50% !important;
 
-        @media only screen and (max-width: 768px) {
+        @media @mediaSm {
           width: 100% !important;
         }
       }
@@ -346,7 +346,7 @@ textarea:focus,
 }
 
 .new.org .ui.form {
-  @media only screen and (max-width: 768px) {
+  @media @mediaSm {
     .field button,
     .field a {
       margin-bottom: 1em;
index 707c8732799de8e236185144cae5d214e0d6657e..fb31bedfa9fda17c471ac2787865c2ee9784d11a 100644 (file)
@@ -4,7 +4,7 @@
   }
 
   .hero {
-    @media only screen and (max-width: 767px) {
+    @media @mediaSm {
       h1 {
         font-size: 3.5em;
       }
@@ -14,7 +14,7 @@
       }
     }
 
-    @media only screen and (min-width: 768px) {
+    @media @mediaMdAndUp {
       h1 {
         font-size: 5.5em;
       }
@@ -52,7 +52,7 @@
 footer {
   .ui.container .left,
   .ui.container .right {
-    @media only screen and (max-width: 880px) {
+    @media (max-width: 880px) {
       display: block;
       text-align: center;
       float: none;
index 3058ec0cce74c77e1b54aad032062f18d542de95..8b131e50bfd68fcdb9ddd71c36c89bf40d567329 100644 (file)
         text-overflow: ellipsis;
       }
 
-      @media (max-width: 1200px) {
+      @media @mediaLgAndDown {
         .title {
           max-width: 150px;
         }
   #clone-panel {
     width: 350px;
 
-    @media only screen and (max-width: 768px) {
+    @media @mediaSm {
       width: 100%;
     }
 
       }
 
       .ui.tiny.blue.buttons {
-        @media only screen and (max-width: 768px) {
+        @media @mediaSm {
           width: 100%;
         }
       }
             width: 100%;
           }
 
-          @media only screen and (max-width: 768px) {
+          @media @mediaSm {
             flex-direction: column;
 
             h1 {
               }
             }
 
-            @media only screen and (max-width: 767px) {
+            @media @mediaSm {
               .form .button {
                 width: 100%;
 
     background: #ffffff;
     line-height: 30px;
 
-    @media only screen and (max-width: 992px) {
+    @media @mediaMdAndDown {
       flex-direction: column;
       align-items: flex-start;
     }
 
       button,
       input {
-        @media only screen and (max-width: 438px) {
+        @media (max-width: 438px) {
           width: 100%;
         }
       }
 
       button {
-        @media only screen and (max-width: 768px) {
+        @media @mediaSm {
           margin-bottom: 1em;
         }
       }
       }
     }
 
-    @media only screen and (max-width: 767px) {
+    @media @mediaSm {
       .dividing.header .stackable.grid .button {
         margin-top: 2px;
         margin-bottom: 2px;
@@ -3002,7 +3002,7 @@ tbody.commit-list {
   vertical-align: middle;
 }
 
-@media only screen and (max-width: 767.98px) {
+@media @mediaSm {
   tr.commit-list {
     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 {
     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 {
     width: 933px;
   }
@@ -3030,7 +3030,7 @@ tbody.commit-list {
   }
 }
 
-@media only screen and (min-width: 1200px) {
+@media @mediaXl {
   tr.commit-list {
     width: 1127px;
   }
@@ -3076,7 +3076,7 @@ tbody.commit-list {
   }
 }
 
-@media only screen and (max-width: 767px) {
+@media @mediaSm {
   .ui.stackable.menu {
     &.mobile--margin-between-items > .item {
       margin-top: 5px;
@@ -3336,7 +3336,7 @@ td.blob-excerpt {
 .repository .ui.menu.new-menu {
   background: none !important;
 
-  @media only screen and (max-width: 1200px) {
+  @media @mediaLgAndDown {
     &::after {
       background: none !important;
     }
index 23b8a3178fae6dd7ccad72b3932892a72ffaffd0..79b97d6b94d5b657a359149f2b34fdf9865cb55f 100644 (file)
@@ -1,3 +1,5 @@
+@import "variables.less";
+
 .ui.button.add-code-comment {
   padding: 2px;
   position: absolute;
@@ -146,7 +148,7 @@ a.blob-excerpt:hover {
   margin-left: .5rem;
 }
 
-@media only screen and (max-width: 768px) {
+@media @mediaSm {
   #review-box > .menu {
     > .ui.segment {
       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 {
     max-width: 700px;
   }
 }
 
-@media only screen and (min-width: 992px) and (max-width: 1200px) {
+@media @mediaLg {
   #review-box .CodeMirror-scroll {
     max-width: 800px;
   }
 }
 
-@media only screen and (min-width: 1200px) {
+@media @mediaXl {
   #review-box .CodeMirror-scroll {
     max-width: 900px;
   }
index 9fa319deb643cce948a7691a7a52bcd5c073ce49..47095dd2af602a10d6c01029cf98eee89aad5925 100644 (file)
@@ -1,3 +1,5 @@
+@import "variables.less";
+
 .user {
   &:not(.icon) {
     padding-top: 15px;
         img {
           width: 100%;
         }
-        @media only screen and (max-width: 768px) {
+        @media @mediaSm {
           height: 250px;
           overflow: hidden;
 
           img {
-            max-height: 768px;
-            max-width: 768px;
+            max-height: 767px;
+            max-width: 767px;
           }
         }
       }
 
-      @media only screen and (max-width: 768px) {
+      @media @mediaSm {
         width: 100%;
       }
     }
index 3c11e0593e2ade16ad79bde1ab8ca321991a817e..5383847387cdd59f35831385c04c2b002d86bc1a 100644 (file)
@@ -7,7 +7,7 @@
     padding: 0 !important;
   }
 
-  @media (max-width: 1200px) {
+  @media @mediaLgAndDown {
     & {
       display: none;
     }
@@ -30,7 +30,7 @@
   left: 25px;
 }
 
-@media (max-width: 1200px) {
+@media @mediaLgAndDown {
   .heatmap-container .total-contributions {
     left: 21px;
   }
index 15b9062e1c1225970307b2c2217e81ccb5b6bbd8..1b0701ae81495c902ec41d8460a17739010c846d 100644 (file)
@@ -1,5 +1,6 @@
 @import "~font-awesome/css/font-awesome.css";
 
+@import "./variables.less";
 @import "./features/gitgraph.less";
 @import "./features/animations.less";
 @import "./features/heatmap.less";
index a4412145a9708933c16d6ca85e0088c7beca1f23..ad3d49194288ddbb0e9518c0feefff0ea3a1e7aa 100644 (file)
@@ -1,3 +1,5 @@
+@import "../variables.less";
+
 :root {
   --color-primary: #87ab63;
   --color-primary-dark-1: #93b373;
@@ -1222,7 +1224,7 @@ td.blob-hunk {
   background: #2a2e3a;
   border-color: transparent !important;
 
-  @media only screen and (max-width: 1200px) {
+  @media @mediaLgAndDown {
     &::after {
       background: linear-gradient(to right, transparent 0%, #2a2e3a 100%);
     }
diff --git a/web_src/less/variables.less b/web_src/less/variables.less
new file mode 100644 (file)
index 0000000..23f6ac6
--- /dev/null
@@ -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)";