fix(theme): fix custom social icon rendering misalignment (#812)

This commit is contained in:
pengzhanbo 2026-01-09 15:19:25 +08:00 committed by GitHub
parent 36c0eddd86
commit 7ed70230af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 4 deletions

View File

@ -65,7 +65,8 @@ const binding = computed(() => ({
<template>
<VPIconImage
v-if="type === 'link' || type === 'svg'"
:type="type" :name="name" :color="color" :size="rect"
:type="type"
v-bind="binding"
/>
<VPIconfont
v-else-if="type === 'iconfont'"

View File

@ -3,6 +3,10 @@ import { computed } from 'vue'
import { withBase } from 'vuepress/client'
import { isLinkHttp } from 'vuepress/shared'
defineOptions({
inheritAttrs: false,
})
const { type, name, color, size } = defineProps<{
type: 'link' | 'svg'
name: string | { svg: string }
@ -31,7 +35,7 @@ const link = computed(() => {
</span>
<span
v-else-if="type === 'svg'"
class="vp-icon"
class="vp-icon is-svg"
:style="{ color, ...size }"
aria-hidden
v-html="svg"
@ -50,4 +54,9 @@ const link = computed(() => {
.vp-icon-img img {
height: 100%;
}
.vp-icon.is-svg :deep(svg) {
width: inherit;
height: inherit;
}
</style>

View File

@ -56,8 +56,8 @@ const label = computed(() => {
color: var(--vp-c-text-1);
}
.vp-social-link > :deep(svg),
.vp-social-link > :deep([class*="vpi-"]) {
.vp-social-link > :deep([class*="vpi-"]),
.vp-social-link > :deep(.vp-icon.is-svg) {
width: 20px;
height: 20px;
fill: currentcolor;