fix: enable scaling of "bare" badges as well (#66)

pull/68/head
Frantisek Vymazal 2020-11-30 14:08:03 +01:00 zatwierdzone przez GitHub
rodzic 484f212b8d
commit 2046b6f993
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -31,7 +31,7 @@ export function badgen ({
label = label === undefined ? subject : label // subject is deprecated
if (!label && !icon) {
return bare({ status, color, style })
return bare({ status, color, style, scale })
}
color = colorPresets[color] || color
@ -90,7 +90,7 @@ export function badgen ({
</svg>`
}
function bare ({ status, color, style }) {
function bare ({ status, color, style, scale }) {
typeAssert(typeof status === 'string', '<status> must be string')
color = colorPresets[color] || color || colorPresets.blue
@ -100,7 +100,7 @@ function bare ({ status, color, style }) {
status = sanitize(status)
if (style === 'flat') {
return `<svg width="${stRectWidth / 10}" height="20" viewBox="0 0 ${stRectWidth} 200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="${status}">
return `<svg width="${scale * stRectWidth / 10}" height="${scale * 20}" viewBox="0 0 ${stRectWidth} 200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="${status}">
<title>${status}</title>
<g>
<rect fill="#${color}" x="0" width="${stRectWidth}" height="200"/>
@ -112,7 +112,7 @@ function bare ({ status, color, style }) {
</svg>`
}
return `<svg width="${stRectWidth / 10}" height="20" viewBox="0 0 ${stRectWidth} 200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="${status}">
return `<svg width="${scale * stRectWidth / 10}" height="${scale * 20}" viewBox="0 0 ${stRectWidth} 200" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="${status}">
<title>${status}</title>
<linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-opacity=".1" stop-color="#EEE"/>