From fabe01478ab449cc4870b7e2a9a1db3911bb14bd Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 23 Mar 2024 19:45:11 +0100 Subject: [PATCH] Migrate font-weight helpers to tailwind (#30027) Commands ran: ```sh perl -p -i -e 's#gt-font-light#tw-font-light#g' web_src/js/**/* templates/**/* perl -p -i -e 's#gt-font-normal#tw-font-normal#g' web_src/js/**/* templates/**/* perl -p -i -e 's#gt-font-medium#tw-font-medium#g' web_src/js/**/* templates/**/* perl -p -i -e 's#gt-font-semibold#tw-font-semibold#g' web_src/js/**/* templates/**/* perl -p -i -e 's#gt-font-bold#tw-font-bold#g' web_src/js/**/* templates/**/* ``` --- tailwind.config.js | 7 +++++++ templates/repo/diff/box.tmpl | 2 +- templates/repo/diff/comments.tmpl | 2 +- templates/repo/header.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 2 +- templates/repo/issue/view_content/comments.tmpl | 4 ++-- templates/repo/pulls/tab_menu.tmpl | 2 +- templates/repo/sub_menu.tmpl | 2 +- templates/shared/user/authorlink.tmpl | 2 +- templates/user/settings/account.tmpl | 2 +- web_src/css/helpers.css | 6 ------ web_src/js/components/DiffFileList.vue | 2 +- 12 files changed, 18 insertions(+), 17 deletions(-) diff --git a/tailwind.config.js b/tailwind.config.js index e2e8f23656..01fc9ee24c 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -66,5 +66,12 @@ export default { '3xl': '24px', 'full': 'var(--border-radius-circle)', // 50% }, + fontWeight: { + light: 'var(--font-weight-light)', + normal: 'var(--font-weight-normal)', + medium: 'var(--font-weight-medium)', + semibold: 'var(--font-weight-semibold)', + bold: 'var(--font-weight-bold)', + }, }, }; diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 42eaf9d30e..4ea1d2c621 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -119,7 +119,7 @@ {{svg "octicon-chevron-down" 18}} {{end}} -
+
{{if $file.IsBin}} {{ctx.Locale.Tr "repo.diff.bin"}} diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 4b626ba2b0..070fe92317 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -11,7 +11,7 @@
{{if .OriginalAuthor}} - + {{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}} {{.OriginalAuthor}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 187a56bdcc..54f72943e4 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -8,7 +8,7 @@
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 7966fc7e1c..759de75662 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -23,7 +23,7 @@
{{if .Issue.OriginalAuthor}} - + {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}} {{.Issue.OriginalAuthor}} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index c0c4df925b..b137dd0a9c 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -28,7 +28,7 @@
{{if .OriginalAuthor}} - + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} {{.OriginalAuthor}} @@ -411,7 +411,7 @@ {{end}} {{if .OriginalAuthor}} - + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} {{.OriginalAuthor}} diff --git a/templates/repo/pulls/tab_menu.tmpl b/templates/repo/pulls/tab_menu.tmpl index 2a653c7c69..7f4c460b8e 100644 --- a/templates/repo/pulls/tab_menu.tmpl +++ b/templates/repo/pulls/tab_menu.tmpl @@ -15,7 +15,7 @@ {{ctx.Locale.Tr "repo.pulls.tab_files"}} {{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}} - + {{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}} {{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}
diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl index 8edb0c1516..654a65fa5c 100644 --- a/templates/repo/sub_menu.tmpl +++ b/templates/repo/sub_menu.tmpl @@ -25,7 +25,7 @@ {{range .LanguageStats}}
- + {{if eq .Language "other"}} {{ctx.Locale.Tr "repo.language_other"}} {{else}} diff --git a/templates/shared/user/authorlink.tmpl b/templates/shared/user/authorlink.tmpl index 64ccc62cd0..4d8ad736be 100644 --- a/templates/shared/user/authorlink.tmpl +++ b/templates/shared/user/authorlink.tmpl @@ -1 +1 @@ -{{.GetDisplayName}}{{if .IsBot}}bot{{end}} +{{.GetDisplayName}}{{if .IsBot}}bot{{end}} diff --git a/templates/user/settings/account.tmpl b/templates/user/settings/account.tmpl index efc09156e6..fb46dfbd2d 100644 --- a/templates/user/settings/account.tmpl +++ b/templates/user/settings/account.tmpl @@ -136,7 +136,7 @@

{{svg "octicon-alert"}} {{ctx.Locale.Tr "settings.delete_prompt"}}

{{if .UserDeleteWithComments}} -

{{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime}}

+

{{ctx.Locale.Tr "settings.delete_with_all_comments" .UserDeleteWithCommentsMaxTime}}

{{end}}
diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css index c7097e631b..dd32c3fb31 100644 --- a/web_src/css/helpers.css +++ b/web_src/css/helpers.css @@ -36,12 +36,6 @@ Gitea's private styles use `g-` prefix. text-overflow: ellipsis; } -.gt-font-light { font-weight: var(--font-weight-light) !important; } -.gt-font-normal { font-weight: var(--font-weight-normal) !important; } -.gt-font-medium { font-weight: var(--font-weight-medium) !important; } -.gt-font-semibold { font-weight: var(--font-weight-semibold) !important; } -.gt-font-bold { font-weight: var(--font-weight-bold) !important; } - .interact-fg { color: inherit !important; } .interact-fg:hover { color: var(--color-primary) !important; } .interact-fg:active { color: var(--color-primary-active) !important; } diff --git a/web_src/js/components/DiffFileList.vue b/web_src/js/components/DiffFileList.vue index 3a0e287808..66fe49c50b 100644 --- a/web_src/js/components/DiffFileList.vue +++ b/web_src/js/components/DiffFileList.vue @@ -38,7 +38,7 @@ export default {