forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Svg.js
107 lines (98 loc) · 3.44 KB
/
Svg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
const React = require("react");
import InlineSVG from "svg-inline-react";
const svg = {
"angle-brackets": require("./angle-brackets.svg"),
angular: require("./angular.svg"),
arrow: require("./arrow.svg"),
babel: require("./babel.svg"),
backbone: require("./backbone.svg"),
blackBox: require("./blackBox.svg"),
breadcrumb: require("./breadcrumbs-divider.svg"),
breakpoint: require("./breakpoint.svg"),
"column-breakpoint": require("./column-breakpoint.svg"),
"case-match": require("./case-match.svg"),
choo: require("./choo.svg"),
close: require("./close.svg"),
coffeescript: require(`./coffeescript.svg`),
dojo: require("./dojo.svg"),
domain: require("./domain.svg"),
extension: require("./extension.svg"),
file: require("./file.svg"),
folder: require("./folder.svg"),
globe: require("./globe.svg"),
home: require("./home.svg"),
javascript: require("./javascript.svg"),
jquery: require("./jquery.svg"),
underscore: require("./underscore.svg"),
lodash: require("./lodash.svg"),
ember: require("./ember.svg"),
vuejs: require("./vuejs.svg"),
"magnifying-glass": require("./magnifying-glass.svg"),
"arrow-up": require("./arrow-up.svg"),
"arrow-down": require("./arrow-down.svg"),
pause: require("./pause.svg"),
"pause-exceptions": require("./pause-exceptions.svg"),
plus: require("./plus.svg"),
preact: require("./preact.svg"),
aframe: require("./aframe.svg"),
prettyPrint: require("./prettyPrint.svg"),
react: require("./react.svg"),
"regex-match": require("./regex-match.svg"),
redux: require("./redux.svg"),
immutable: require("./immutable.svg"),
resume: require("./resume.svg"),
settings: require("./settings.svg"),
stepIn: require("./stepIn.svg"),
stepOut: require("./stepOut.svg"),
stepOver: require("./stepOver.svg"),
subSettings: require("./subSettings.svg"),
tab: require("./tab.svg"),
toggleBreakpoints: require("./toggle-breakpoints.svg"),
togglePanes: require("./toggle-panes.svg"),
typescript: require("./typescript.svg"),
"whole-word-match": require("./whole-word-match.svg"),
worker: require("./worker.svg"),
"sad-face": require("devtools-mc-assets/assets/devtools/client/themes/images/sad-face.svg"),
refresh: require("devtools-mc-assets/assets/devtools/client/themes/images/reload.svg"),
webpack: require("./webpack.svg"),
node: require("./node.svg"),
express: require("./express.svg"),
pug: require("./pug.svg"),
extjs: require("./sencha-extjs.svg"),
mobx: require("./mobx.svg"),
marko: require("./marko.svg"),
nextjs: require("./nextjs.svg"),
showSources: require("./showSources.svg"),
showOutline: require("./showOutline.svg"),
nuxtjs: require("./nuxtjs.svg"),
rxjs: require("./rxjs.svg")
};
type SvgType = {
name: string,
className?: string,
onClick?: () => void,
"aria-label"?: string
};
function Svg({ name, className, onClick, "aria-label": ariaLabel }) {
if (!svg[name]) {
const error = `Unknown SVG: ${name}`;
console.warn(error);
return null;
}
className = `${name} ${className || ""}`;
if (name === "subSettings") {
className = "";
}
const props = {
className,
onClick,
["aria-label"]: ariaLabel,
src: svg[name]
};
return <InlineSVG {...props} />;
}
Svg.displayName = "Svg";
module.exports = Svg;