aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-09-08 21:57:18 +0800
committerGitHub <noreply@github.com>2023-09-08 13:57:18 +0000
commitffa4949eaaf645995c5a20cd302d0256417b97ed (patch)
tree9457c20c4f3f54ca7c8d0b1760eefad8ab8666fa
parent4807f7be22c2cf5ceffab241cec24058f1628125 (diff)
downloadgitea-ffa4949eaaf645995c5a20cd302d0256417b97ed.tar.gz
gitea-ffa4949eaaf645995c5a20cd302d0256417b97ed.zip
Improve flex list UI (#26970)
1. There is already `gt-ac`, so no need to introduce `flex-item-center` 2. The `flex-item-baseline` and `.flex-item-icon svg { margin-top: 1px }` seem to be a tricky patch, they don't resolve the root problem, and still cause misalignment in some cases. * The root problem is: the "icon" needs to align with the sibling "title" * So, make the "icon" and the "title" both have the same height 3. `flex-text-inline` could only be used if the element is really "inline", otherwise its `vertical-align` would make the box size change. In most cases, `flex-text-block` is good enough. ![image](https://github.com/go-gitea/gitea/assets/2114189/1b7acfc2-b1c7-4e9c-a983-2fa932026479) --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
-rw-r--r--templates/explore/user_list.tmpl2
-rw-r--r--templates/org/member/members.tmpl2
-rw-r--r--templates/org/team/members.tmpl4
-rw-r--r--templates/org/team/repositories.tmpl2
-rw-r--r--templates/repo/actions/runs_list.tmpl2
-rw-r--r--templates/repo/settings/branches.tmpl2
-rw-r--r--templates/repo/settings/collaboration.tmpl2
-rw-r--r--templates/repo/settings/options.tmpl2
-rw-r--r--templates/shared/issuelist.tmpl8
-rw-r--r--templates/shared/secrets/add_list.tmpl2
-rw-r--r--templates/shared/variables/variable_list.tmpl2
-rw-r--r--templates/user/settings/applications_oauth2_list.tmpl2
-rw-r--r--templates/user/settings/security/openid.tmpl2
-rw-r--r--web_src/css/shared/flex-list.css15
14 files changed, 23 insertions, 26 deletions
diff --git a/templates/explore/user_list.tmpl b/templates/explore/user_list.tmpl
index cf6a2933b0..9abbff6d9c 100644
--- a/templates/explore/user_list.tmpl
+++ b/templates/explore/user_list.tmpl
@@ -1,6 +1,6 @@
<div class="flex-list">
{{range .Users}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
{{ctx.AvatarUtils.Avatar . 48}}
</div>
diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl
index a15254d041..65ef7b66e7 100644
--- a/templates/org/member/members.tmpl
+++ b/templates/org/member/members.tmpl
@@ -7,7 +7,7 @@
<div class="flex-list">
{{range .Members}}
{{$isPublic := index $.MembersIsPublicMember .ID}}
- <div class="flex-item {{if $.PublicOnly}}flex-item-center{{end}}">
+ <div class="flex-item {{if $.PublicOnly}}gt-ac{{end}}">
<div class="flex-item-leading">
<a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 48}}</a>
</div>
diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl
index 13c60d3945..cac0c1ce94 100644
--- a/templates/org/team/members.tmpl
+++ b/templates/org/team/members.tmpl
@@ -24,7 +24,7 @@
<div class="ui attached segment">
<div class="flex-list">
{{range .Team.Members}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
<a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a>
</div>
@@ -56,7 +56,7 @@
<div class="ui attached segment">
<div class="flex-list">
{{range .Invites}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-main">
{{.Email}}
</div>
diff --git a/templates/org/team/repositories.tmpl b/templates/org/team/repositories.tmpl
index 71c9bb9563..44fb1ee083 100644
--- a/templates/org/team/repositories.tmpl
+++ b/templates/org/team/repositories.tmpl
@@ -28,7 +28,7 @@
<div class="ui attached segment">
<div class="flex-list">
{{range .Team.Repos}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
{{template "repo/icon" .}}
</div>
diff --git a/templates/repo/actions/runs_list.tmpl b/templates/repo/actions/runs_list.tmpl
index d8e27fab52..37a584079f 100644
--- a/templates/repo/actions/runs_list.tmpl
+++ b/templates/repo/actions/runs_list.tmpl
@@ -6,7 +6,7 @@
</div>
{{end}}
{{range .Runs}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
{{template "repo/actions/status" (dict "status" .Status.String "locale" $.locale)}}
</div>
diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl
index fcc3615ced..ef227ff4aa 100644
--- a/templates/repo/settings/branches.tmpl
+++ b/templates/repo/settings/branches.tmpl
@@ -41,7 +41,7 @@
<div class="ui attached segment">
<div class="flex-list">
{{range .ProtectedBranches}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-main">
<div class="flex-item-title">
<div class="ui basic primary label">{{.RuleName}}</div>
diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl
index 900d044171..4c6721eb24 100644
--- a/templates/repo/settings/collaboration.tmpl
+++ b/templates/repo/settings/collaboration.tmpl
@@ -7,7 +7,7 @@
<div class="ui attached segment">
<div class="flex-list">
{{range .Collaborators}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
<a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a>
</div>
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 5def862f2d..16944506f1 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -774,7 +774,7 @@
</div>
</div>
{{if not .Repository.IsMirror}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-main">
{{if .Repository.IsArchived}}
<div class="flex-item-title">{{.locale.Tr "repo.settings.unarchive.header"}}</div>
diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl
index 2cd0fb92ac..8e91a58d51 100644
--- a/templates/shared/issuelist.tmpl
+++ b/templates/shared/issuelist.tmpl
@@ -1,10 +1,12 @@
<div id="issue-list" class="flex-list">
{{$approvalCounts := .ApprovalCounts}}
{{range .Issues}}
- <div class="flex-item flex-item-baseline">
- <div class="flex-item-leading gt-ac">
+ <div class="flex-item">
+ <div class="flex-item-leading">
{{if $.CanWriteIssuesOrPulls}}
+ <div class="flex-item-icon">
<input type="checkbox" autocomplete="off" class="issue-checkbox gt-mr-4" data-issue-id={{.ID}} aria-label="{{$.locale.Tr "repo.issues.action_check"}} &quot;{{.Title}}&quot;">
+ </div>
{{end}}
<div class="flex-item-icon">
{{template "shared/issueicon" .}}
@@ -44,7 +46,7 @@
{{end}}
{{if .NumComments}}
<div class="text grey">
- <a class="gt-no-underline muted flex-text-inline" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
+ <a class="gt-no-underline muted flex-text-block" href="{{if .Link}}{{.Link}}{{else}}{{$.Link}}/{{.Index}}{{end}}">
{{svg "octicon-comment" 16}}{{.NumComments}}
</a>
</div>
diff --git a/templates/shared/secrets/add_list.tmpl b/templates/shared/secrets/add_list.tmpl
index 6215eff369..5a464295f6 100644
--- a/templates/shared/secrets/add_list.tmpl
+++ b/templates/shared/secrets/add_list.tmpl
@@ -14,7 +14,7 @@
{{if .Secrets}}
<div class="flex-list">
{{range .Secrets}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
{{svg "octicon-key" 32}}
</div>
diff --git a/templates/shared/variables/variable_list.tmpl b/templates/shared/variables/variable_list.tmpl
index e62025caaf..a9456321e4 100644
--- a/templates/shared/variables/variable_list.tmpl
+++ b/templates/shared/variables/variable_list.tmpl
@@ -16,7 +16,7 @@
{{if .Variables}}
<div class="flex-list">
{{range .Variables}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
{{svg "octicon-pencil" 32}}
</div>
diff --git a/templates/user/settings/applications_oauth2_list.tmpl b/templates/user/settings/applications_oauth2_list.tmpl
index 1a536e50ac..348bc82b4e 100644
--- a/templates/user/settings/applications_oauth2_list.tmpl
+++ b/templates/user/settings/applications_oauth2_list.tmpl
@@ -4,7 +4,7 @@
{{.locale.Tr "settings.oauth2_application_create_description"}}
</div>
{{range .Applications}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
{{svg "octicon-apps" 32}}
</div>
diff --git a/templates/user/settings/security/openid.tmpl b/templates/user/settings/security/openid.tmpl
index 86cb161bce..9563910ba9 100644
--- a/templates/user/settings/security/openid.tmpl
+++ b/templates/user/settings/security/openid.tmpl
@@ -7,7 +7,7 @@
{{.locale.Tr "settings.openid_desc"}}
</div>
{{range .OpenIDs}}
- <div class="flex-item flex-item-center">
+ <div class="flex-item gt-ac">
<div class="flex-item-leading">
{{svg "fontawesome-openid" 20}}
</div>
diff --git a/web_src/css/shared/flex-list.css b/web_src/css/shared/flex-list.css
index b9c22c4a0b..b5ae5cbd49 100644
--- a/web_src/css/shared/flex-list.css
+++ b/web_src/css/shared/flex-list.css
@@ -9,14 +9,6 @@
padding: 1em 0;
}
-.flex-item-baseline {
- align-items: baseline;
-}
-
-.flex-item-center {
- align-items: center;
-}
-
.flex-item .flex-item-leading {
display: flex;
align-items: flex-start;
@@ -41,8 +33,10 @@
color: var(--color-primary) !important;
}
-.flex-item .flex-item-icon svg {
- margin-top: 1px;
+.flex-item .flex-item-icon {
+ display: flex;
+ align-items: center;
+ height: 20px; /* match the default flex-item-title height */
}
.flex-item .flex-item-trailing {
@@ -65,6 +59,7 @@
font-weight: var(--font-weight-semibold);
word-break: break-word;
min-width: 0;
+ min-height: 20px;
}
.flex-item .flex-item-title a {