mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-04 22:57:19 +02:00
Refactor utils/html
This commit is contained in:
parent
1e644504ec
commit
b27cfc8215
@ -1,3 +1,4 @@
|
||||
// Credit: https://phosphoricons.com
|
||||
import iconBetterXcloud from "@assets/svg/better-xcloud.svg" with { type: "text" };
|
||||
import iconTrueAchievements from "@assets/svg/true-achievements.svg" with { type: "text" };
|
||||
import iconClose from "@assets/svg/close.svg" with { type: "text" };
|
||||
|
@ -101,16 +101,14 @@ function createElement<T=HTMLElement>(elmName: string, props: CreateElementOptio
|
||||
|
||||
export const CE = createElement;
|
||||
|
||||
// Credit: https://phosphoricons.com
|
||||
const svgParser = (svg: string) => new DOMParser().parseFromString(svg, 'image/svg+xml').documentElement;
|
||||
|
||||
export const createSvgIcon = (icon: typeof BxIcon) => {
|
||||
return svgParser(icon.toString());
|
||||
const domParser = new DOMParser();
|
||||
export function createSvgIcon(icon: typeof BxIcon) {
|
||||
return domParser.parseFromString(icon.toString(), 'image/svg+xml').documentElement;
|
||||
}
|
||||
|
||||
const ButtonStyleIndices = Object.keys(ButtonStyleClass).map(i => parseInt(i));
|
||||
|
||||
export const createButton = <T=HTMLButtonElement>(options: BxButton): T => {
|
||||
export function createButton<T=HTMLButtonElement>(options: BxButton): T {
|
||||
let $btn;
|
||||
if (options.url) {
|
||||
$btn = CE('a', {'class': 'bx-button'}) as HTMLAnchorElement;
|
||||
|
Loading…
x
Reference in New Issue
Block a user