From 4803766f7a5d1ca86a1e62949dcd9a9ff8d0f64c Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 28 Aug 2023 22:14:51 +0800 Subject: [PATCH] Refactor some CSS styles and simplify code (#26771) Refactor some CSS styles and simplify code. Some styles are not in use, remove them. --- templates/code/searchresults.tmpl | 4 +- templates/projects/view.tmpl | 8 +--- templates/repo/branch/list.tmpl | 6 +-- templates/repo/icon.tmpl | 30 +++++++------- templates/repo/issue/label_precolors.tmpl | 38 ++++++++++-------- .../repo/issue/labels/edit_delete_label.tmpl | 4 +- templates/repo/issue/labels/label_new.tmpl | 4 +- templates/repo/search.tmpl | 4 +- web_src/css/base.css | 40 ++++++------------- 9 files changed, 60 insertions(+), 78 deletions(-) diff --git a/templates/code/searchresults.tmpl b/templates/code/searchresults.tmpl index 684e2860b..faac69670 100644 --- a/templates/code/searchresults.tmpl +++ b/templates/code/searchresults.tmpl @@ -1,6 +1,6 @@ -
+ @@ -125,9 +123,7 @@
-
- {{template "repo/issue/label_precolors"}} -
+ {{template "repo/issue/label_precolors"}}
diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index bd045995b..d2535e1e3 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -132,11 +132,11 @@ {{else}} {{if not .LatestPullRequest.IsSameRepo}}{{.LatestPullRequest.BaseRepo.FullName}}{{end}}#{{.LatestPullRequest.Issue.Index}} {{if .LatestPullRequest.HasMerged}} - {{svg "octicon-git-merge" 16 "gt-mr-2"}}{{$.locale.Tr "repo.pulls.merged"}} + {{svg "octicon-git-merge" 16 "gt-mr-2"}}{{$.locale.Tr "repo.pulls.merged"}} {{else if .LatestPullRequest.Issue.IsClosed}} - {{svg "octicon-git-pull-request" 16 "gt-mr-2"}}{{$.locale.Tr "repo.issues.closed_title"}} + {{svg "octicon-git-pull-request" 16 "gt-mr-2"}}{{$.locale.Tr "repo.issues.closed_title"}} {{else}} - {{svg "octicon-git-pull-request" 16 "gt-mr-2"}}{{$.locale.Tr "repo.issues.open_title"}} + {{svg "octicon-git-pull-request" 16 "gt-mr-2"}}{{$.locale.Tr "repo.issues.open_title"}} {{end}} {{end}} diff --git a/templates/repo/icon.tmpl b/templates/repo/icon.tmpl index 6c63e6eca..0568b74f6 100644 --- a/templates/repo/icon.tmpl +++ b/templates/repo/icon.tmpl @@ -1,16 +1,14 @@ -
- {{$avatarLink := .RelAvatarLink}} - {{if $avatarLink}} - {{.FullName}} - {{else if $.IsTemplate}} - {{svg "octicon-repo-template" 32}} - {{else if $.IsPrivate}} - {{svg "octicon-lock" 32}} - {{else if $.IsMirror}} - {{svg "octicon-mirror" 32}} - {{else if $.IsFork}} - {{svg "octicon-repo-forked" 32}} - {{else}} - {{svg "octicon-repo" 32}} - {{end}} -
+{{$avatarLink := .RelAvatarLink}} +{{if $avatarLink}} + {{.FullName}} +{{else if $.IsTemplate}} + {{svg "octicon-repo-template" 32}} +{{else if $.IsPrivate}} + {{svg "octicon-lock" 32}} +{{else if $.IsMirror}} + {{svg "octicon-mirror" 32}} +{{else if $.IsFork}} + {{svg "octicon-repo-forked" 32}} +{{else}} + {{svg "octicon-repo" 32}} +{{end}} diff --git a/templates/repo/issue/label_precolors.tmpl b/templates/repo/issue/label_precolors.tmpl index 555595fc1..146119b97 100644 --- a/templates/repo/issue/label_precolors.tmpl +++ b/templates/repo/issue/label_precolors.tmpl @@ -1,16 +1,22 @@ - - - - - - - - - - - - - - - - +
+
+ + + + + + + + +
+
+ + + + + + + + +
+
diff --git a/templates/repo/issue/labels/edit_delete_label.tmpl b/templates/repo/issue/labels/edit_delete_label.tmpl index d64782090..98efc6aa9 100644 --- a/templates/repo/issue/labels/edit_delete_label.tmpl +++ b/templates/repo/issue/labels/edit_delete_label.tmpl @@ -54,9 +54,7 @@
-
- {{template "repo/issue/label_precolors"}} -
+ {{template "repo/issue/label_precolors"}}
diff --git a/templates/repo/issue/labels/label_new.tmpl b/templates/repo/issue/labels/label_new.tmpl index 41dced4a5..1d3069f1b 100644 --- a/templates/repo/issue/labels/label_new.tmpl +++ b/templates/repo/issue/labels/label_new.tmpl @@ -29,9 +29,7 @@
-
- {{template "repo/issue/label_precolors"}} -
+ {{template "repo/issue/label_precolors"}}
diff --git a/templates/repo/search.tmpl b/templates/repo/search.tmpl index 816be9d12..cf088442b 100644 --- a/templates/repo/search.tmpl +++ b/templates/repo/search.tmpl @@ -27,9 +27,9 @@ {{.locale.Tr "repo.search.results" (.Keyword|Escape) (.RepoLink|Escape) (.RepoName|Escape) | Str2html}} {{if .SearchResults}} -
+
{{range $term := .SearchResultLanguages}} - + {{$term.Language}}
{{$term.Count}}
diff --git a/web_src/css/base.css b/web_src/css/base.css index d9c57932f..481e231f3 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -474,7 +474,7 @@ a.label, /* fix Fomantic's line-height cutting off "g" on Windows Chrome with Segoe UI */ .ui.input > input { - line-height: 1.3; + line-height: var(--line-height-default); } .ui.input.focus > input, @@ -951,6 +951,7 @@ img.ui.avatar, filter: saturate(2); } +/* TODO: use gt-word-break instead */ .dont-break-out { overflow-wrap: break-word; word-wrap: break-word; @@ -1456,10 +1457,6 @@ img.ui.avatar, border-color: var(--color-gold) !important; } -.ui .branch-tag-choice { - line-height: 20px; -} - @media (max-width: 767.98px) { .ui.pagination.menu .item:not(.active,.navigation), .ui.pagination.menu .item.navigation span.navigation_label { @@ -1640,10 +1637,6 @@ img.ui.avatar, margin-left: 0.5rem; } -.repo-icon { - display: inline-block; -} - .activity-bar-graph { background-color: var(--color-primary); color: var(--color-primary-contrast); @@ -1681,10 +1674,6 @@ i.icons .icon:first-child { margin-right: 0; } -i.icon.centerlock { - top: 1em; -} - .ui.label { padding: 0.3em 0.5em; transition: none; @@ -1879,10 +1868,6 @@ a.ui.active.label:hover { width: 100%; } -.octicon-tiny { - font-size: 0.85714286rem; -} - .ui.primary.label, .ui.primary.labels .label, .ui.ui.ui.primary.label { @@ -2037,6 +2022,7 @@ a.ui.basic.label:hover { margin-left: 0; } +/* TODO: replace it with gt-invisible */ .invisible { visibility: hidden; } @@ -2123,11 +2109,6 @@ table th[data-sortt-desc] .svg { box-shadow: 0 0 0 1px var(--color-secondary) inset; } -.text-label { - display: inline-flex !important; - align-items: center !important; -} - .emoji, .reaction { font-size: 1.25em; @@ -2241,14 +2222,14 @@ table th[data-sortt-desc] .svg { } .precolors { - padding-left: 0 !important; - padding-right: 0 !important; - margin: 3px 10px auto !important; - width: 120px !important; + display: flex; + flex-direction: column; + justify-content: center; + margin-left: 1em; } .precolors .color { - float: left; + display: inline-block; width: 15px; height: 15px; } @@ -2303,6 +2284,7 @@ table th[data-sortt-desc] .svg { .ui.ui.button, .ui.ui.dropdown, +.ui.ui.label, .flex-items-inline > .item, .flex-text-inline { display: inline-flex; @@ -2319,6 +2301,10 @@ table th[data-sortt-desc] .svg { vertical-align: middle; } +.ui.ui.circular.label { + justify-content: center; +} + .ui.ui.labeled.button { gap: 0; align-items: stretch;