diff options
author | Kerwin Bryant <kerwin612@qq.com> | 2025-04-10 09:10:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-09 18:10:16 -0700 |
commit | 02e49a0f471fcd50e70835458d196615f03c39cc (patch) | |
tree | 2c60bf0a60bfc078cbd049ebf089ab394e828293 | |
parent | fac6b87dd24be5021d9c656edc2072397cfd6bed (diff) | |
download | gitea-02e49a0f471fcd50e70835458d196615f03c39cc.tar.gz gitea-02e49a0f471fcd50e70835458d196615f03c39cc.zip |
Fix vertical centering of file tree icons and use entryIcon for submodules/symlinks (#34137)
In the file tree, the icons are not vertically centered, which affects
the overall visual consistency.
Currently, the icons of submodules and symlinks do not adopt the value
of entryIcon, resulting in inconsistent icon display.
before:

after:

---------
Co-authored-by: silverwind <me@silverwind.io>
-rw-r--r-- | templates/repo/actions/status.tmpl | 2 | ||||
-rw-r--r-- | web_src/css/base.css | 12 | ||||
-rw-r--r-- | web_src/css/modules/animations.css | 10 | ||||
-rw-r--r-- | web_src/css/repo/home-file-list.css | 11 | ||||
-rw-r--r-- | web_src/js/components/ActionRunStatus.vue | 2 | ||||
-rw-r--r-- | web_src/js/components/RepoActionView.vue | 12 | ||||
-rw-r--r-- | web_src/js/components/RepoCodeFrequency.vue | 2 | ||||
-rw-r--r-- | web_src/js/components/RepoContributors.vue | 2 | ||||
-rw-r--r-- | web_src/js/components/RepoRecentCommits.vue | 2 | ||||
-rw-r--r-- | web_src/js/components/ViewFileTreeItem.vue | 15 |
10 files changed, 36 insertions, 34 deletions
diff --git a/templates/repo/actions/status.tmpl b/templates/repo/actions/status.tmpl index 64c2543302..f2020bc160 100644 --- a/templates/repo/actions/status.tmpl +++ b/templates/repo/actions/status.tmpl @@ -16,7 +16,7 @@ {{else if eq .status "blocked"}} {{svg "octicon-blocked" $size (printf "text yellow %s" $className)}} {{else if eq .status "running"}} - {{svg "octicon-meter" $size (printf "text yellow job-status-rotate %s" $className)}} + {{svg "octicon-meter" $size (printf "text yellow circular-spin %s" $className)}} {{else}}{{/*failure, unknown*/}} {{svg "octicon-x-circle-fill" $size (printf "text red %s" $className)}} {{end}} diff --git a/web_src/css/base.css b/web_src/css/base.css index de656c0d95..5a0579f356 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1181,3 +1181,15 @@ the "!important" is necessary to override Fomantic UI menu item styles, meanwhil flex-grow: 1; justify-content: space-between; } + +.svg.octicon-file-directory-fill, +.svg.octicon-file-directory-open-fill, +.svg.octicon-file-submodule { + color: var(--color-primary); +} + +.svg.octicon-file, +.svg.octicon-file-symlink-file, +.svg.octicon-file-directory-symlink { + color: var(--color-secondary-dark-7); +} diff --git a/web_src/css/modules/animations.css b/web_src/css/modules/animations.css index 481e997d4f..173ca73314 100644 --- a/web_src/css/modules/animations.css +++ b/web_src/css/modules/animations.css @@ -116,3 +116,13 @@ code.language-math.is-loading::after { animation-duration: 100ms; animation-timing-function: ease-in-out; } + +.circular-spin { + animation: circular-spin-keyframes 1s linear infinite; +} + +@keyframes circular-spin-keyframes { + 100% { + transform: rotate(-360deg); + } +} diff --git a/web_src/css/repo/home-file-list.css b/web_src/css/repo/home-file-list.css index 46128457ed..f2ab052a54 100644 --- a/web_src/css/repo/home-file-list.css +++ b/web_src/css/repo/home-file-list.css @@ -14,17 +14,6 @@ } } -#repo-files-table .svg.octicon-file-directory-fill, -#repo-files-table .svg.octicon-file-submodule { - color: var(--color-primary); -} - -#repo-files-table .svg.octicon-file, -#repo-files-table .svg.octicon-file-symlink-file, -#repo-files-table .svg.octicon-file-directory-symlink { - color: var(--color-secondary-dark-7); -} - #repo-files-table .repo-file-item { display: contents; } diff --git a/web_src/js/components/ActionRunStatus.vue b/web_src/js/components/ActionRunStatus.vue index 487d2460cc..bc3b99ab89 100644 --- a/web_src/js/components/ActionRunStatus.vue +++ b/web_src/js/components/ActionRunStatus.vue @@ -24,7 +24,7 @@ withDefaults(defineProps<{ <SvgIcon name="octicon-stop" class="text yellow" :size="size" :class="className" v-else-if="status === 'cancelled'"/> <SvgIcon name="octicon-clock" class="text yellow" :size="size" :class="className" v-else-if="status === 'waiting'"/> <SvgIcon name="octicon-blocked" class="text yellow" :size="size" :class="className" v-else-if="status === 'blocked'"/> - <SvgIcon name="octicon-meter" class="text yellow" :size="size" :class="'job-status-rotate ' + className" v-else-if="status === 'running'"/> + <SvgIcon name="octicon-meter" class="text yellow" :size="size" :class="'circular-spin ' + className" v-else-if="status === 'running'"/> <SvgIcon name="octicon-x-circle-fill" class="text red" :size="size" v-else/><!-- failure, unknown --> </span> </template> diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 640ad8341f..5a4c22bc90 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -574,7 +574,7 @@ export default defineComponent({ <!-- If the job is done and the job step log is loaded for the first time, show the loading icon currentJobStepsStates[i].cursor === null means the log is loaded for the first time --> - <SvgIcon v-if="isDone(run.status) && currentJobStepsStates[i].expanded && currentJobStepsStates[i].cursor === null" name="octicon-sync" class="tw-mr-2 job-status-rotate"/> + <SvgIcon v-if="isDone(run.status) && currentJobStepsStates[i].expanded && currentJobStepsStates[i].cursor === null" name="octicon-sync" class="tw-mr-2 circular-spin"/> <SvgIcon v-else :name="currentJobStepsStates[i].expanded ? 'octicon-chevron-down': 'octicon-chevron-right'" :class="['tw-mr-2', !isExpandable(jobStep.status) && 'tw-invisible']"/> <ActionRunStatus :status="jobStep.status" class="tw-mr-2"/> @@ -896,16 +896,6 @@ export default defineComponent({ <style> /* eslint-disable-line vue-scoped-css/enforce-style-type */ /* some elements are not managed by vue, so we need to use global style */ -.job-status-rotate { - animation: job-status-rotate-keyframes 1s linear infinite; -} - -@keyframes job-status-rotate-keyframes { - 100% { - transform: rotate(-360deg); - } -} - .job-step-section { margin: 10px; } diff --git a/web_src/js/components/RepoCodeFrequency.vue b/web_src/js/components/RepoCodeFrequency.vue index 7696996cf6..f04fc065b6 100644 --- a/web_src/js/components/RepoCodeFrequency.vue +++ b/web_src/js/components/RepoCodeFrequency.vue @@ -150,7 +150,7 @@ const options: ChartOptions<'line'> = { <div class="tw-flex ui segment main-graph"> <div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto"> <div v-if="isLoading"> - <SvgIcon name="octicon-sync" class="tw-mr-2 job-status-rotate"/> + <SvgIcon name="octicon-sync" class="tw-mr-2 circular-spin"/> {{ locale.loadingInfo }} </div> <div v-else class="text red"> diff --git a/web_src/js/components/RepoContributors.vue b/web_src/js/components/RepoContributors.vue index 6ad2c848b1..b725f272a7 100644 --- a/web_src/js/components/RepoContributors.vue +++ b/web_src/js/components/RepoContributors.vue @@ -375,7 +375,7 @@ export default defineComponent({ <div class="tw-flex ui segment main-graph"> <div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto"> <div v-if="isLoading"> - <SvgIcon name="octicon-sync" class="tw-mr-2 job-status-rotate"/> + <SvgIcon name="octicon-sync" class="tw-mr-2 circular-spin"/> {{ locale.loadingInfo }} </div> <div v-else class="text red"> diff --git a/web_src/js/components/RepoRecentCommits.vue b/web_src/js/components/RepoRecentCommits.vue index 10e1fdd70c..1b3d8fd459 100644 --- a/web_src/js/components/RepoRecentCommits.vue +++ b/web_src/js/components/RepoRecentCommits.vue @@ -128,7 +128,7 @@ const options: ChartOptions<'bar'> = { <div class="tw-flex ui segment main-graph"> <div v-if="isLoading || errorText !== ''" class="gt-tc tw-m-auto"> <div v-if="isLoading"> - <SvgIcon name="octicon-sync" class="tw-mr-2 job-status-rotate"/> + <SvgIcon name="octicon-sync" class="tw-mr-2 circular-spin"/> {{ locale.loadingInfo }} </div> <div v-else class="text red"> diff --git a/web_src/js/components/ViewFileTreeItem.vue b/web_src/js/components/ViewFileTreeItem.vue index 69e26dbc33..c39fa1f4ae 100644 --- a/web_src/js/components/ViewFileTreeItem.vue +++ b/web_src/js/components/ViewFileTreeItem.vue @@ -58,7 +58,8 @@ const doGotoSubModule = () => { > <!-- submodule --> <div class="item-content"> - <SvgIcon class="text primary" name="octicon-file-submodule"/> + <!-- eslint-disable-next-line vue/no-v-html --> + <span class="tw-contents" v-html="item.entryIcon"/> <span class="gt-ellipsis tw-flex-1">{{ item.entryName }}</span> </div> </div> @@ -70,7 +71,8 @@ const doGotoSubModule = () => { > <!-- symlink --> <div class="item-content"> - <SvgIcon name="octicon-file-symlink-file"/> + <!-- eslint-disable-next-line vue/no-v-html --> + <span class="tw-contents" v-html="item.entryIcon"/> <span class="gt-ellipsis tw-flex-1">{{ item.entryName }}</span> </div> </div> @@ -83,7 +85,7 @@ const doGotoSubModule = () => { <!-- file --> <div class="item-content"> <!-- eslint-disable-next-line vue/no-v-html --> - <span v-html="item.entryIcon"/> + <span class="tw-contents" v-html="item.entryIcon"/> <span class="gt-ellipsis tw-flex-1">{{ item.entryName }}</span> </div> </div> @@ -95,13 +97,12 @@ const doGotoSubModule = () => { > <!-- directory --> <div class="item-toggle"> - <!-- FIXME: use a general and global class for this animation --> - <SvgIcon v-if="isLoading" name="octicon-sync" class="job-status-rotate"/> + <SvgIcon v-if="isLoading" name="octicon-sync" class="circular-spin"/> <SvgIcon v-else :name="collapsed ? 'octicon-chevron-right' : 'octicon-chevron-down'" @click.stop="doLoadChildren"/> </div> <div class="item-content"> <!-- eslint-disable-next-line vue/no-v-html --> - <span class="text primary" v-html="(!collapsed && item.entryIconOpen) ? item.entryIconOpen : item.entryIcon"/> + <span class="tw-contents" v-html="(!collapsed && item.entryIconOpen) ? item.entryIconOpen : item.entryIcon"/> <span class="gt-ellipsis">{{ item.entryName }}</span> </div> </div> @@ -154,7 +155,7 @@ const doGotoSubModule = () => { grid-area: content; display: flex; align-items: center; - gap: 0.25em; + gap: 0.5em; text-overflow: ellipsis; min-width: 0; } |