mirror of https://github.com/zer0bin-dev/zer0bin
refactor: ♻️ Still use extraSVGAttrs with new method
This commit is contained in:
parent
bbccfc4314
commit
be7617476f
|
@ -29,13 +29,14 @@ const singleViewButton = <HTMLButtonElement>(
|
|||
document.getElementById("single-view-button")
|
||||
)
|
||||
|
||||
function renderIcon(elem: HTMLButtonElement, icon: IconDefinition) {
|
||||
elem.innerHTML += renderIconDefinitionToSVGElement(icon, {
|
||||
extraSVGAttrs: {
|
||||
const extraSVGAttrs = {
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
fill: "currentColor",
|
||||
},
|
||||
}
|
||||
function renderIcon(elem: HTMLButtonElement, icon: IconDefinition) {
|
||||
elem.innerHTML += renderIconDefinitionToSVGElement(icon, {
|
||||
extraSVGAttrs: extraSVGAttrs,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -91,11 +92,11 @@ tippy("#copy-button", {
|
|||
tippy("#github-button", {
|
||||
content: `GitHub<br><span class='keybind'>
|
||||
${renderIconDefinitionToSVGElement(StarOutlined, {
|
||||
extraSVGAttrs: { fill: "currentColor" },
|
||||
extraSVGAttrs: extraSVGAttrs,
|
||||
})} ${renderIconDefinitionToSVGElement(ForkOutlined, {
|
||||
extraSVGAttrs: { fill: "currentColor" },
|
||||
extraSVGAttrs: extraSVGAttrs,
|
||||
})} ${renderIconDefinitionToSVGElement(HeartOutlined, {
|
||||
extraSVGAttrs: { fill: "currentColor" },
|
||||
extraSVGAttrs: extraSVGAttrs,
|
||||
})}</span>`,
|
||||
placement: "bottom",
|
||||
animation: "scale",
|
||||
|
@ -137,20 +138,12 @@ export function toggleHiddenIcon(hidden: boolean) {
|
|||
hideButton.innerHTML = renderIconDefinitionToSVGElement(
|
||||
EyeInvisibleOutlined,
|
||||
{
|
||||
extraSVGAttrs: {
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
fill: "currentColor",
|
||||
},
|
||||
extraSVGAttrs: extraSVGAttrs,
|
||||
}
|
||||
)
|
||||
} else {
|
||||
hideButton.innerHTML = renderIconDefinitionToSVGElement(EyeOutlined, {
|
||||
extraSVGAttrs: {
|
||||
width: "1em",
|
||||
height: "1em",
|
||||
fill: "currentColor",
|
||||
},
|
||||
extraSVGAttrs: extraSVGAttrs,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue