fix auto-sized logo sizes (#10764)

This commit is contained in:
LitoMore
2024-12-30 01:04:24 +08:00
committed by GitHub
parent e6b66a8865
commit 00c73c872d

View File

@@ -93,10 +93,13 @@ function getSimpleIcon({ name, color, style, size }) {
if (size === 'auto') {
const { width: iconWidth, height: iconHeight } = getIconSize(key)
if (iconWidth > iconHeight) {
if (iconWidth !== iconHeight) {
const path = resetIconPosition(simpleIcons[key].path)
iconSvg = iconSvg
.replace('viewBox="0 0 24 24"', `viewBox="0 0 24 ${iconHeight}"`)
.replace(
'viewBox="0 0 24 24"',
`viewBox="0 0 ${iconWidth} ${iconHeight}"`,
)
.replace(/<path d=".*"\/>/, `<path d="${path}"/>`)
}
}