aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/graph/icons.tsx
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-04-27 23:40:42 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-04-27 23:40:42 +0200
commit85a3ee2bcaf9a77b9d3751c5a18bdb6f6d20ad49 (patch)
tree19c0850d14ae6afae85515847163810ea25be711 /subprojects/frontend/src/graph/icons.tsx
parentrfactor(frontend): scroll to top on initialization (diff)
downloadrefinery-85a3ee2bcaf9a77b9d3751c5a18bdb6f6d20ad49.tar.gz
refinery-85a3ee2bcaf9a77b9d3751c5a18bdb6f6d20ad49.tar.zst
refinery-85a3ee2bcaf9a77b9d3751c5a18bdb6f6d20ad49.zip
refactor(frontend): fix icon placement in Safari
Also affected WebKitGTK
Diffstat (limited to 'subprojects/frontend/src/graph/icons.tsx')
-rw-r--r--subprojects/frontend/src/graph/icons.tsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/subprojects/frontend/src/graph/icons.tsx b/subprojects/frontend/src/graph/icons.tsx
new file mode 100644
index 00000000..4f4407a0
--- /dev/null
+++ b/subprojects/frontend/src/graph/icons.tsx
@@ -0,0 +1,29 @@
1/*
2 * SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
7import cancelSVG from '@material-icons/svg/svg/cancel/baseline.svg?raw';
8import labelSVG from '@material-icons/svg/svg/label/baseline.svg?raw';
9import labelOutlinedSVG from '@material-icons/svg/svg/label/outline.svg?raw';
10
11const icons: Map<string, Element> = new Map();
12
13export default icons;
14
15function importSVG(svgSource: string, className: string): void {
16 const parser = new DOMParser();
17 const svgDocument = parser.parseFromString(svgSource, 'image/svg+xml');
18 const root = svgDocument.children[0];
19 if (root === undefined) {
20 return;
21 }
22 root.id = className;
23 root.classList.add(className);
24 icons.set(className, root);
25}
26
27importSVG(labelSVG, 'icon-TRUE');
28importSVG(labelOutlinedSVG, 'icon-UNKNOWN');
29importSVG(cancelSVG, 'icon-ERROR');