kopia lustrzana https://github.com/badgen/badgen
refactor: only include xmlns:xlink for icon badges
rodzic
a17b9c543e
commit
f48f62fb52
|
@ -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"/>
|
||||
|
|
Ładowanie…
Reference in New Issue