summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2024-03-28 09:31:07 +0100
committerGitHub <noreply@github.com>2024-03-28 08:31:07 +0000
commit226a82a9396dc94f362ba27bd1c9318630df74b4 (patch)
treecd4b4ff394c6e8d0e10ed700e0c3622c23c9493c /web_src
parent7443a10fc3d722d3326a0cb7b15b208f907c72d7 (diff)
downloadgitea-226a82a9396dc94f362ba27bd1c9318630df74b4.tar.gz
gitea-226a82a9396dc94f362ba27bd1c9318630df74b4.zip
Migrate font-family to tailwind (#30118)
Enable us to use tailwind's [`font-family`](https://tailwindcss.com/docs/font-family) classes as well as remove `gt-mono` in favor of `tw-font-mono`. I also merged the "compensation" to one selector, previously this was two different values 0.9em and 0.95em. I did not declare a `serif` font because I don't think there will ever be a use case for those. Command ran: ```sh perl -p -i -e 's#gt-mono#tw-font-mono#g' web_src/js/**/* templates/**/*
Diffstat (limited to 'web_src')
-rw-r--r--web_src/css/base.css9
-rw-r--r--web_src/css/helpers.css5
-rw-r--r--web_src/js/components/DiffCommitSelector.vue2
-rw-r--r--web_src/js/components/DiffFileList.vue2
-rw-r--r--web_src/js/features/comp/ComboMarkdownEditor.js2
5 files changed, 11 insertions, 9 deletions
diff --git a/web_src/css/base.css b/web_src/css/base.css
index 07f15cac2b..18db136bc9 100644
--- a/web_src/css/base.css
+++ b/web_src/css/base.css
@@ -62,10 +62,17 @@ pre,
code,
kbd,
samp {
- font-size: 0.9em; /* compensate for monospace fonts being usually slightly larger */
font-family: var(--fonts-monospace);
}
+pre,
+code,
+kbd,
+samp,
+.tw-font-mono {
+ font-size: 0.95em; /* compensate for monospace fonts being usually slightly larger */
+}
+
b,
strong,
h1,
diff --git a/web_src/css/helpers.css b/web_src/css/helpers.css
index 66d0f03257..13962f19d7 100644
--- a/web_src/css/helpers.css
+++ b/web_src/css/helpers.css
@@ -3,11 +3,6 @@ Gitea's tailwind-style CSS helper classes have `gt-` prefix.
Gitea's private styles use `g-` prefix.
*/
-.gt-mono {
- font-family: var(--fonts-monospace) !important;
- font-size: .95em !important; /* compensate for monospace fonts being usually slightly larger */
-}
-
.gt-word-break {
word-wrap: break-word !important;
word-break: break-word; /* compat: Safari */
diff --git a/web_src/js/components/DiffCommitSelector.vue b/web_src/js/components/DiffCommitSelector.vue
index cbb1f20873..352d085731 100644
--- a/web_src/js/components/DiffCommitSelector.vue
+++ b/web_src/js/components/DiffCommitSelector.vue
@@ -252,7 +252,7 @@ export default {
</span>
</div>
</div>
- <div class="gt-mono">
+ <div class="tw-font-mono">
{{ commit.short_sha }}
</div>
</div>
diff --git a/web_src/js/components/DiffFileList.vue b/web_src/js/components/DiffFileList.vue
index bc6f1bee7d..916780d913 100644
--- a/web_src/js/components/DiffFileList.vue
+++ b/web_src/js/components/DiffFileList.vue
@@ -47,7 +47,7 @@ export default {
</div>
<!-- todo finish all file status, now modify, add, delete and rename -->
<span :class="['status', diffTypeToString(file.Type)]" :data-tooltip-content="diffTypeToString(file.Type)">&nbsp;</span>
- <a class="file gt-mono" :href="'#diff-' + file.NameHash">{{ file.Name }}</a>
+ <a class="file tw-font-mono" :href="'#diff-' + file.NameHash">{{ file.Name }}</a>
</li>
<li v-if="store.isIncomplete" class="tw-pt-1">
<span class="file tw-flex tw-items-center tw-justify-between">{{ store.tooManyFilesMessage }}
diff --git a/web_src/js/features/comp/ComboMarkdownEditor.js b/web_src/js/features/comp/ComboMarkdownEditor.js
index 1e728ca201..d3fab375a9 100644
--- a/web_src/js/features/comp/ComboMarkdownEditor.js
+++ b/web_src/js/features/comp/ComboMarkdownEditor.js
@@ -105,7 +105,7 @@ class ComboMarkdownEditor {
e.preventDefault();
const enabled = localStorage?.getItem('markdown-editor-monospace') !== 'true';
localStorage.setItem('markdown-editor-monospace', String(enabled));
- this.textarea.classList.toggle('gt-mono', enabled);
+ this.textarea.classList.toggle('tw-font-mono', enabled);
const text = monospaceButton.getAttribute(enabled ? 'data-disable-text' : 'data-enable-text');
monospaceButton.setAttribute('data-tooltip-content', text);
monospaceButton.setAttribute('aria-checked', String(enabled));