From d724cc0bf6ff6d351319e6fb00f5184a04e16ac0 Mon Sep 17 00:00:00 2001 From: Josh Kingsley Date: Mon, 24 Nov 2025 15:46:22 +0200 Subject: chore: improve dev tasks --- apps/web/src/components/icons/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 apps/web/src/components/icons/index.ts (limited to 'apps/web/src/components/icons/index.ts') diff --git a/apps/web/src/components/icons/index.ts b/apps/web/src/components/icons/index.ts new file mode 100644 index 0000000..5731026 --- /dev/null +++ b/apps/web/src/components/icons/index.ts @@ -0,0 +1,19 @@ +import plus16 from "./svgs/plus16.svg?raw"; +import minus16 from "./svgs/minus16.svg?raw"; + +function makeIconFactory(source: string) { + return (attrs?: object): SVGElement => { + const parser = new DOMParser(); + const doc = parser.parseFromString(source, "image/svg+xml"); + const svg = doc.documentElement as unknown as SVGElement; + + if (attrs) { + Object.entries(attrs).forEach(([k, v]) => svg.setAttribute(k, v)); + } + + return svg; + }; +} + +export const plus16Icon = makeIconFactory(plus16); +export const minus16Icon = makeIconFactory(minus16); -- cgit v1.2.3