]> source.dussan.org Git - gitea.git/commitdiff
Make fileheader sticky in diffs (#14616)
authorvnkmpf <tz@zztt.eu>
Thu, 11 Feb 2021 18:28:51 +0000 (19:28 +0100)
committerGitHub <noreply@github.com>
Thu, 11 Feb 2021 18:28:51 +0000 (19:28 +0100)
* Make fileheader sticky #12552

* Remove sticky filenames when width is 480px or less

On mobile phone sticky filename is hidden due to the combination
of many possible widths and lengths.

* Fix text color for .markdown-info

* Fix visual of sticky diff box on 480px or less

- Hide arrow for select buttons.
- Fix changes, additions and deletions.
With flexbox they look very broken.
This commit hides some words to, so the result is:
"123 changed files  987 additions  456 deletions"
- center text in buttons

Co-authored-by: zeripath <art27@cantab.net>
templates/repo/diff/box.tmpl
web_src/less/_base.less
web_src/less/_repository.less
web_src/less/_review.less

index f01795ad15b605b1e27a64264a0b094dc6fcd380..5110129b8d0e24d4a343dfa899c0637bf872bec5 100644 (file)
@@ -79,7 +79,7 @@
                                </div>
                        {{else}}
                                <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{.Index}}">
-                                       <h4 class="diff-file-header ui top attached normal header df ac sb">
+                                       <h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb">
                                                <div class="df ac">
                                                        {{$isImage := false}}
                                                        {{if $file.IsDeleted}}
index b5c890fd61144cd1003c1f8d83e43a5bc496529c..c054c1dc120834d9039855c02e53867e78a56517 100644 (file)
@@ -1830,6 +1830,10 @@ table th[data-sortt-desc] {
 .ui.button.dropdown > .dropdown.icon,
 .btn-review > .dropdown.icon {
   float: right !important;
+
+  @media (max-width: 480px) {
+    display: none;
+  }
 }
 .ui.selection.dropdown > .search.icon,
 .ui.selection.dropdown > .delete.icon,
index 57f101abb91860ba7646fd2963c7ebe48a28a466..88a1a38bb679b801c1209b5d41c1c22724bb8646 100644 (file)
       align-items: flex-start;
     }
 
+    @media (max-width: 480px) {
+      flex-wrap: wrap;
+    }
+
     &.sticky {
       position: sticky;
       top: 0;
       margin-right: .25rem;
     }
 
+    .diff-detail-stats {
+      @media (max-width: 480px) {
+        font-size: 0;
+        line-height: 1.6rem;
+
+        strong {
+          font-size: 1rem;
+        }
+      }
+    }
+
     .diff-detail-actions > * {
       margin-right: 0;
     }
       margin-left: .25rem;
     }
 
+    .diff-detail-actions {
+      @media (max-width: 480px) {
+        padding-top: .25rem;
+
+        .ui.button {
+          padding-left: .5rem;
+          padding-right: .5rem;
+          display: flex;
+          flex-wrap: wrap;
+          justify-content: center;
+          text-align: center;
+        }
+      }
+    }
+
     span.status {
       display: inline-block;
       width: 12px;
@@ -2996,6 +3026,26 @@ td.blob-excerpt {
   margin-left: .5rem !important;
 }
 
+.ui.attached.header.diff-file-header {
+  &.sticky-2nd-row {
+    position: sticky;
+    top: 46px;
+    z-index: 7;
+
+    @media @mediaMd {
+      top: 77px;
+    }
+
+    @media @mediaSm {
+      top: 77px;
+    }
+
+    @media (max-width: 480px) {
+      position: static;
+    }
+  }
+}
+
 .diff-stats-bar {
   display: inline-block;
   background-color: var(--color-red);
index 4d8b402bd3e082f75b903e0d517806839869ddaa..059e3d0ff569881f91091cc5383e3a9de93035c9 100644 (file)
@@ -95,7 +95,7 @@
       display: inline-block;
       margin: 5px 0;
       font-size: 12px;
-      color: rgba(0, 0, 0, .6);
+      color: var(--color-text-light);
     }
 
     .ui.right.floated {