From 64462a69808f18321a1f0446165f3cb03920c934 Mon Sep 17 00:00:00 2001
From: 0ko <0ko@noreply.codeberg.org>
Date: Sun, 7 Jul 2024 03:21:58 +0000
Subject: [PATCH] ui: improve button gap consistency in repos (#4365)

Improve UI in a few areas in a similar way to https://codeberg.org/forgejo/forgejo/commit/dc0d3a40ab008f5ff20ad50d8b4a58277595f2fa. Ensure consistent 0.5em gaps in button rows, make buttons have more consistent horizontal paddings for better clickability.

Preview:
https://codeberg.org/attachments/cfca200a-3b68-4ba8-9876-75cea7822a00
https://codeberg.org/attachments/aaa5d387-919b-45af-8854-6d0f5273125f
https://codeberg.org/attachments/989225b7-b1dd-491d-bf76-7e4a962ea54e

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4365
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
(cherry picked from commit c19222b22f728f3ddad397a3801e10da238ac6c3)
---
 templates/repo/diff/box.tmpl                        | 4 ++--
 templates/repo/diff/conversation.tmpl               | 6 +++---
 templates/repo/header.tmpl                          | 2 +-
 templates/repo/issue/view_content/conversation.tmpl | 4 ++--
 web_src/css/repo.css                                | 9 ++++-----
 web_src/css/repo/header.css                         | 1 -
 6 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 71154f9768..230e49752f 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -23,7 +23,7 @@
 				</div>
 			{{end}}
 		</div>
-		<div class="diff-detail-actions">
+		<div class="diff-detail-actions button-row">
 			{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}}
 				<div class="not-mobile tw-flex tw-items-center tw-flex-col tw-whitespace-nowrap tw-mr-1">
 					<label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{ctx.Locale.Tr "repo.pulls.viewed_files_label"}}">
@@ -146,7 +146,7 @@
 									{{end}}
 								</span>
 							</div>
-							<div class="diff-file-header-actions tw-flex tw-items-center tw-gap-1 tw-flex-wrap">
+							<div class="diff-file-header-actions tw-flex tw-items-center button-row tw-flex-wrap">
 								{{if $showFileViewToggle}}
 									<div class="ui compact icon buttons">
 										<button class="ui tiny basic button file-view-toggle" data-toggle-selector="#diff-source-{{$file.NameHash}}" data-tooltip-content="{{ctx.Locale.Tr "repo.file_view_source"}}">{{svg "octicon-code"}}</button>
diff --git a/templates/repo/diff/conversation.tmpl b/templates/repo/diff/conversation.tmpl
index ef92f3bdfc..c80d999f47 100644
--- a/templates/repo/diff/conversation.tmpl
+++ b/templates/repo/diff/conversation.tmpl
@@ -37,8 +37,8 @@
 				{{template "repo/diff/comments" dict "root" $ "comments" .comments}}
 			</ui>
 		</div>
-		<div class="tw-flex tw-justify-end tw-items-center tw-flex-wrap tw-mt-2">
-			<div class="ui buttons tw-mr-1">
+		<div class="button-row tw-flex tw-justify-end tw-items-center tw-flex-wrap tw-mt-2">
+			<div class="ui buttons">
 				<button class="ui icon tiny basic button previous-conversation">
 					{{svg "octicon-arrow-up" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.previous"}}
 				</button>
@@ -56,7 +56,7 @@
 				</button>
 			{{end}}
 			{{if and $.SignedUserID (not $.Repository.IsArchived)}}
-				<button class="comment-form-reply ui primary tiny labeled icon button tw-ml-1 tw-mr-0">
+				<button class="comment-form-reply ui primary tiny labeled icon button">
 					{{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
 				</button>
 			{{end}}
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index d8c53d08be..e81e65bc7d 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -35,7 +35,7 @@
 				</div>
 			</div>
 			{{if not (or .IsBeingCreated .IsBroken)}}
-				<div class="repo-buttons">
+				<div class="repo-buttons button-row">
 					{{if $.RepoTransfer}}
 						<form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}">
 							{{$.CsrfTokenHtml}}
diff --git a/templates/repo/issue/view_content/conversation.tmpl b/templates/repo/issue/view_content/conversation.tmpl
index 8e37b5487f..2526e5c848 100644
--- a/templates/repo/issue/view_content/conversation.tmpl
+++ b/templates/repo/issue/view_content/conversation.tmpl
@@ -115,7 +115,7 @@
 					</div>
 				{{end}}
 			</div>
-			<div class="code-comment-buttons-buttons">
+			<div class="code-comment-buttons-buttons button-row">
 				{{if and $.CanMarkConversation $isNotPending}}
 					<button class="ui tiny basic button resolve-conversation" data-origin="timeline" data-action="{{if not $resolved}}Resolve{{else}}UnResolve{{end}}" data-comment-id="{{(index .comments 0).ID}}" data-update-url="{{$.RepoLink}}/issues/resolve_conversation">
 						{{if $resolved}}
@@ -126,7 +126,7 @@
 					</button>
 				{{end}}
 				{{if and $.SignedUserID (not $.Repository.IsArchived)}}
-					<button class="comment-form-reply ui primary tiny labeled icon button tw-ml-1 tw-mr-0">
+					<button class="comment-form-reply ui primary tiny labeled icon button">
 						{{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
 					</button>
 				{{end}}
diff --git a/web_src/css/repo.css b/web_src/css/repo.css
index e90e0ec4fe..1a901e07a2 100644
--- a/web_src/css/repo.css
+++ b/web_src/css/repo.css
@@ -601,7 +601,7 @@ td .commit-summary {
   align-items: center;
 }
 
-.repository.view.issue .button-row,
+.issue-title .button-row,
 .repository.releases .button-row {
   display: flex;
 }
@@ -610,7 +610,7 @@ td .commit-summary {
   .repository.view.issue .issue-title {
     flex-direction: column;
   }
-  .repository.view.issue .button-row {
+  .issue-title .button-row {
     width: 100%;
     margin-top: .5rem;
     justify-content: space-between;
@@ -1539,7 +1539,6 @@ td .commit-summary {
 .diff-detail-actions {
   display: flex;
   align-items: center;
-  gap: 0.25em;
   justify-content: end;
 }
 
@@ -1574,7 +1573,7 @@ td .commit-summary {
 }
 
 .repository .diff-detail-box .ui.button {
-  padding: 0 12px;
+  padding: 0 1.125em;
   height: 30px;
 }
 
@@ -1596,7 +1595,7 @@ td .commit-summary {
 }
 
 .repository .diff-box .header:not(.resolved-placeholder) .button {
-  padding: 0 12px;
+  padding: 0 1.125em;
   flex: 0 0 auto;
   margin-right: 0;
   height: 30px;
diff --git a/web_src/css/repo/header.css b/web_src/css/repo/header.css
index 55e704ed10..9da5fe6acd 100644
--- a/web_src/css/repo/header.css
+++ b/web_src/css/repo/header.css
@@ -33,7 +33,6 @@
   display: flex;
   flex-flow: row wrap;
   word-break: keep-all;
-  gap: 0.25em;
 }
 
 .repo-buttons .ui.labeled.button > .label:hover {