From dad5b47f0bb480532043df8d488f5609f731b00d Mon Sep 17 00:00:00 2001 From: Josh Kingsley Date: Sat, 1 Nov 2025 15:52:38 +0200 Subject: feat(web): add icons --- web/src/components/icons/index.ts | 19 +++++++++++++++++++ web/src/components/icons/svgs/minus16.svg | 3 +++ web/src/components/icons/svgs/plus16.svg | 3 +++ 3 files changed, 25 insertions(+) create mode 100644 web/src/components/icons/index.ts create mode 100644 web/src/components/icons/svgs/minus16.svg create mode 100644 web/src/components/icons/svgs/plus16.svg (limited to 'web/src/components') diff --git a/web/src/components/icons/index.ts b/web/src/components/icons/index.ts new file mode 100644 index 0000000..5731026 --- /dev/null +++ b/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); diff --git a/web/src/components/icons/svgs/minus16.svg b/web/src/components/icons/svgs/minus16.svg new file mode 100644 index 0000000..d77dcfc --- /dev/null +++ b/web/src/components/icons/svgs/minus16.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/src/components/icons/svgs/plus16.svg b/web/src/components/icons/svgs/plus16.svg new file mode 100644 index 0000000..1d7b023 --- /dev/null +++ b/web/src/components/icons/svgs/plus16.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3