diff options
author | 2024-04-27 23:40:42 +0200 | |
---|---|---|
committer | 2024-04-27 23:40:42 +0200 | |
commit | 85a3ee2bcaf9a77b9d3751c5a18bdb6f6d20ad49 (patch) | |
tree | 19c0850d14ae6afae85515847163810ea25be711 /subprojects/frontend/src/graph/icons.tsx | |
parent | rfactor(frontend): scroll to top on initialization (diff) | |
download | refinery-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.tsx | 29 |
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 | |||
7 | import cancelSVG from '@material-icons/svg/svg/cancel/baseline.svg?raw'; | ||
8 | import labelSVG from '@material-icons/svg/svg/label/baseline.svg?raw'; | ||
9 | import labelOutlinedSVG from '@material-icons/svg/svg/label/outline.svg?raw'; | ||
10 | |||
11 | const icons: Map<string, Element> = new Map(); | ||
12 | |||
13 | export default icons; | ||
14 | |||
15 | function 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 | |||
27 | importSVG(labelSVG, 'icon-TRUE'); | ||
28 | importSVG(labelOutlinedSVG, 'icon-UNKNOWN'); | ||
29 | importSVG(cancelSVG, 'icon-ERROR'); | ||