refactor: only include xmlns:xlink for icon badges

pull/11/head
James Harris 2018-08-16 20:29:53 +01:00 zatwierdzone przez Amio
rodzic a17b9c543e
commit f48f62fb52
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -12,16 +12,17 @@ module.exports = ({ subject, status, color, style, emoji, icon, iconWidth = 13 }
const sbRectWidth = sbTextWidth + 10.2 + iconSpanWidth
const stRectWidth = stTextWidth + 10
const width = sbRectWidth + stRectWidth
const xlink = icon ? ' xmlns:xlink="http://www.w3.org/1999/xlink"' : ''
if (style === 'flat') {
return `
<svg width="${width}" height="20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g>
<rect width="${sbRectWidth}" height="20" fill="#555"/>
<rect x="${sbRectWidth}" width="${stRectWidth}" height="20" fill="#${color}"/>
</g>
<g fill="#fff" text-anchor="start" font-family="Verdana,DejaVu Sans,sans-serif" font-size="11">
<text x="${icon ? '22.5' : '6.3'}" y="14.8" textLength="${sbTextWidth}" fill="#000" opacity="0.1">${subject}</text>
<svg width="${width}" height="20" xmlns="http://www.w3.org/2000/svg"${xlink}>
<text x="${icon ? '21.5' : '5.3'}" y="13.8" textLength="${sbTextWidth}">${subject}</text>
<text x="${sbRectWidth + 5.5}" y="14.8" fill="#000" opacity="0.1" textLength="${stTextWidth}">${status}</text>
<text x="${sbRectWidth + 4.5}" y="13.8" textLength="${stTextWidth}">${status}</text>
@ -32,7 +33,7 @@ module.exports = ({ subject, status, color, style, emoji, icon, iconWidth = 13 }
}
return `
<svg width="${width}" height="20" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="${width}" height="20" xmlns="http://www.w3.org/2000/svg"${xlink}>
<linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-color="#EEE" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>