From 76315e0919ece6ce38352c64293ff33e43d6f6df 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/**/* ``` (cherry picked from commit fabe01478ab449cc4870b7e2a9a1db3911bb14bd) Conflicts: templates/repo/header.tmpl prefered Forgejo file & re-ran the commands to ensure the migration is done --- 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 34194ebbdc..c1d0c4fe8e 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 b561f094c5..bcf91f74e8 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 b6f5ed4996..a5bfb5f25b 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -6,7 +6,7 @@
{{template "repo/icon" .}}
diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index d885b47908..c885f2e93a 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 a6d0b801f0..a48ae1947b 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}} @@ -412,7 +412,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 6b3d3957cb..24a7d236fe 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 7a328aeb20..346184f04b 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 {