ui: improve button gap consistency in repos (#4365)

Improve UI in a few areas in a similar way to dc0d3a40ab. 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>
This commit is contained in:
0ko 2024-07-07 03:21:58 +00:00
parent 3ff661fe9e
commit c19222b22f
6 changed files with 12 additions and 14 deletions

View file

@ -23,7 +23,7 @@
</div> </div>
{{end}} {{end}}
</div> </div>
<div class="diff-detail-actions"> <div class="diff-detail-actions button-row">
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}} {{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"> <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"}}"> <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}} {{end}}
</span> </span>
</div> </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}} {{if $showFileViewToggle}}
<div class="ui compact icon buttons"> <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> <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>

View file

@ -37,8 +37,8 @@
{{template "repo/diff/comments" dict "root" $ "comments" .comments}} {{template "repo/diff/comments" dict "root" $ "comments" .comments}}
</ui> </ui>
</div> </div>
<div class="tw-flex tw-justify-end tw-items-center tw-flex-wrap tw-mt-2"> <div class="button-row tw-flex tw-justify-end tw-items-center tw-flex-wrap tw-mt-2">
<div class="ui buttons tw-mr-1"> <div class="ui buttons">
<button class="ui icon tiny basic button previous-conversation"> <button class="ui icon tiny basic button previous-conversation">
{{svg "octicon-arrow-up" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.previous"}} {{svg "octicon-arrow-up" 12 "icon"}} {{ctx.Locale.Tr "repo.issues.previous"}}
</button> </button>
@ -56,7 +56,7 @@
</button> </button>
{{end}} {{end}}
{{if and $.SignedUserID (not $.Repository.IsArchived)}} {{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"}} {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
</button> </button>
{{end}} {{end}}

View file

@ -35,7 +35,7 @@
</div> </div>
</div> </div>
{{if not (or .IsBeingCreated .IsBroken)}} {{if not (or .IsBeingCreated .IsBroken)}}
<div class="repo-buttons"> <div class="repo-buttons button-row">
{{if $.RepoTransfer}} {{if $.RepoTransfer}}
<form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}"> <form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}

View file

@ -115,7 +115,7 @@
</div> </div>
{{end}} {{end}}
</div> </div>
<div class="code-comment-buttons-buttons"> <div class="code-comment-buttons-buttons button-row">
{{if and $.CanMarkConversation $isNotPending}} {{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"> <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}} {{if $resolved}}
@ -126,7 +126,7 @@
</button> </button>
{{end}} {{end}}
{{if and $.SignedUserID (not $.Repository.IsArchived)}} {{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"}} {{svg "octicon-reply" 16 "reply icon tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.comment.reply"}}
</button> </button>
{{end}} {{end}}

View file

@ -601,7 +601,7 @@ td .commit-summary {
align-items: center; align-items: center;
} }
.repository.view.issue .button-row, .issue-title .button-row,
.repository.releases .button-row { .repository.releases .button-row {
display: flex; display: flex;
} }
@ -610,7 +610,7 @@ td .commit-summary {
.repository.view.issue .issue-title { .repository.view.issue .issue-title {
flex-direction: column; flex-direction: column;
} }
.repository.view.issue .button-row { .issue-title .button-row {
width: 100%; width: 100%;
margin-top: .5rem; margin-top: .5rem;
justify-content: space-between; justify-content: space-between;
@ -1539,7 +1539,6 @@ td .commit-summary {
.diff-detail-actions { .diff-detail-actions {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.25em;
justify-content: end; justify-content: end;
} }
@ -1574,7 +1573,7 @@ td .commit-summary {
} }
.repository .diff-detail-box .ui.button { .repository .diff-detail-box .ui.button {
padding: 0 12px; padding: 0 1.125em;
height: 30px; height: 30px;
} }
@ -1596,7 +1595,7 @@ td .commit-summary {
} }
.repository .diff-box .header:not(.resolved-placeholder) .button { .repository .diff-box .header:not(.resolved-placeholder) .button {
padding: 0 12px; padding: 0 1.125em;
flex: 0 0 auto; flex: 0 0 auto;
margin-right: 0; margin-right: 0;
height: 30px; height: 30px;

View file

@ -33,7 +33,6 @@
display: flex; display: flex;
flex-flow: row wrap; flex-flow: row wrap;
word-break: keep-all; word-break: keep-all;
gap: 0.25em;
} }
.repo-buttons .ui.labeled.button > .label:hover { .repo-buttons .ui.labeled.button > .label:hover {