@jobber/design 0.27.9 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/buildColors.js +15 -0
- package/buildFoundation.js +15 -0
- package/buildIconStyles.js +44 -0
- package/colors.js +138 -0
- package/foundation.css +33 -26
- package/foundation.js +7 -7
- package/foundation.scss +6 -6
- package/foundation_config/postcss-filter-rules/index.js +17 -0
- package/foundation_config/postcss.config.js +58 -0
- package/jobberStyle.js +244 -0
- package/npm-shrinkwrap.json +8594 -0
- package/package.json +18 -11
- package/rollup.config.js +41 -0
- package/src/Borders.mdx +65 -0
- package/src/Colors.mdx +295 -0
- package/src/Elevations.mdx +107 -0
- package/src/Radii.mdx +40 -0
- package/src/ResponsiveBreakpoints.mdx +48 -0
- package/src/Spacing.mdx +121 -0
- package/src/Typography.mdx +191 -0
- package/src/animation.mdx +82 -0
- package/src/borders.css +6 -0
- package/src/colors.css +178 -0
- package/src/elevations.css +12 -0
- package/src/foundation.css +11 -0
- package/src/icons/Colors.css +187 -0
- package/src/icons/Colors.css.d.ts +51 -0
- package/src/icons/Icon.css +102 -0
- package/src/icons/Icon.css.d.ts +37 -0
- package/src/icons/Sizes.css +14 -0
- package/src/icons/Sizes.css.d.ts +7 -0
- package/src/icons/getIcon.test.ts +73 -0
- package/src/icons/getIcon.ts +116 -0
- package/src/icons/iconMap.ts +430 -0
- package/src/icons/iconStyles.d.ts +262 -0
- package/src/icons/iconStyles.ts +269 -0
- package/src/index.ts +10 -0
- package/src/radii.css +6 -0
- package/src/responsiveBreakpoints.css +3 -0
- package/src/shadows.css +13 -0
- package/src/spacing.css +13 -0
- package/src/styles.css +9 -0
- package/src/timings.css +7 -0
- package/src/typography.css +53 -0
- package/tsconfig.json +70 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
.white {
|
|
2
|
+
fill: var(--color-white);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.grey {
|
|
6
|
+
fill: var(--color-grey);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.greyBlue {
|
|
10
|
+
fill: var(--color-greyBlue);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.greyBlueDark {
|
|
14
|
+
fill: var(--color-greyBlue--dark);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.blue {
|
|
18
|
+
fill: var(--color-blue);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.lightBlue {
|
|
22
|
+
fill: var(--color-lightBlue);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.green {
|
|
26
|
+
fill: var(--color-green);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.yellow {
|
|
30
|
+
fill: var(--color-yellow);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.red {
|
|
34
|
+
fill: var(--color-red);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.navy {
|
|
38
|
+
fill: var(--color-navy);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.orange {
|
|
42
|
+
fill: var(--color-orange);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.interactive {
|
|
46
|
+
fill: var(--color-interactive);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.interactiveHover {
|
|
50
|
+
fill: var(--color-interactive--hover);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.destructive {
|
|
54
|
+
fill: var(--color-destructive);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.destructiveHover {
|
|
58
|
+
fill: var(--color-destructive--hover);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.interactiveSubtle {
|
|
62
|
+
fill: var(--color-interactive--subtle);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.interactiveSubtleHover {
|
|
66
|
+
fill: var(--color-interactive--subtle--hover);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.disabled {
|
|
70
|
+
fill: var(--color-disabled);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.disabledSecondary {
|
|
74
|
+
fill: var(--color-disabled--secondary);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.focus {
|
|
78
|
+
fill: var(--color-focus);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.critical {
|
|
82
|
+
fill: var(--color-critical);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.criticalSurface {
|
|
86
|
+
fill: var(--color-critical--surface);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.criticalOnSurface {
|
|
90
|
+
fill: var(--color-critical--onSurface);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.warning {
|
|
94
|
+
fill: var(--color-warning);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.warningSurface {
|
|
98
|
+
fill: var(--color-warning--surface);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.warningOnSurface {
|
|
102
|
+
fill: var(--color-warning--onSurface);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.success {
|
|
106
|
+
fill: var(--color-success);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.successSurface {
|
|
110
|
+
fill: var(--color-success--surface);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.successOnSurface {
|
|
114
|
+
fill: var(--color-success--onSurface);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.informative {
|
|
118
|
+
fill: var(--color-informative);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.informativeSurface {
|
|
122
|
+
fill: var(--color-informative--surface);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.informativeOnSurface {
|
|
126
|
+
fill: var(--color-informative--onSurface);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.inactive {
|
|
130
|
+
fill: var(--color-inactive);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.inactiveSurface {
|
|
134
|
+
fill: var(--color-inactive--surface);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.inactiveOnSurface {
|
|
138
|
+
fill: var(--color-inactive--onSurface);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.heading {
|
|
142
|
+
fill: var(--color-heading);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.text {
|
|
146
|
+
fill: var(--color-text);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.textSecondary {
|
|
150
|
+
fill: var(--color-text--secondary);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.textReverse {
|
|
154
|
+
fill: var(--color-text--reverse);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.textReverseSecondary {
|
|
158
|
+
fill: var(--color-text--reverse--secondary);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.surface {
|
|
162
|
+
fill: var(--color-surface);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.surfaceHover {
|
|
166
|
+
fill: var(--color-surface--hover);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.surfaceActive {
|
|
170
|
+
fill: var(--color-surface--active);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.surfaceBackground {
|
|
174
|
+
fill: var(--color-surface--background);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.surfaceReverse {
|
|
178
|
+
fill: var(--color-surface--reverse);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.brand {
|
|
182
|
+
fill: var(--color-brand);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.brandHighlight {
|
|
186
|
+
fill: var(--color-brand--highlight);
|
|
187
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
readonly "white": string;
|
|
3
|
+
readonly "grey": string;
|
|
4
|
+
readonly "greyBlue": string;
|
|
5
|
+
readonly "greyBlueDark": string;
|
|
6
|
+
readonly "blue": string;
|
|
7
|
+
readonly "lightBlue": string;
|
|
8
|
+
readonly "green": string;
|
|
9
|
+
readonly "yellow": string;
|
|
10
|
+
readonly "red": string;
|
|
11
|
+
readonly "navy": string;
|
|
12
|
+
readonly "orange": string;
|
|
13
|
+
readonly "interactive": string;
|
|
14
|
+
readonly "interactiveHover": string;
|
|
15
|
+
readonly "destructive": string;
|
|
16
|
+
readonly "destructiveHover": string;
|
|
17
|
+
readonly "interactiveSubtle": string;
|
|
18
|
+
readonly "interactiveSubtleHover": string;
|
|
19
|
+
readonly "disabled": string;
|
|
20
|
+
readonly "disabledSecondary": string;
|
|
21
|
+
readonly "focus": string;
|
|
22
|
+
readonly "critical": string;
|
|
23
|
+
readonly "criticalSurface": string;
|
|
24
|
+
readonly "criticalOnSurface": string;
|
|
25
|
+
readonly "warning": string;
|
|
26
|
+
readonly "warningSurface": string;
|
|
27
|
+
readonly "warningOnSurface": string;
|
|
28
|
+
readonly "success": string;
|
|
29
|
+
readonly "successSurface": string;
|
|
30
|
+
readonly "successOnSurface": string;
|
|
31
|
+
readonly "informative": string;
|
|
32
|
+
readonly "informativeSurface": string;
|
|
33
|
+
readonly "informativeOnSurface": string;
|
|
34
|
+
readonly "inactive": string;
|
|
35
|
+
readonly "inactiveSurface": string;
|
|
36
|
+
readonly "inactiveOnSurface": string;
|
|
37
|
+
readonly "heading": string;
|
|
38
|
+
readonly "text": string;
|
|
39
|
+
readonly "textSecondary": string;
|
|
40
|
+
readonly "textReverse": string;
|
|
41
|
+
readonly "textReverseSecondary": string;
|
|
42
|
+
readonly "surface": string;
|
|
43
|
+
readonly "surfaceHover": string;
|
|
44
|
+
readonly "surfaceActive": string;
|
|
45
|
+
readonly "surfaceBackground": string;
|
|
46
|
+
readonly "surfaceReverse": string;
|
|
47
|
+
readonly "brand": string;
|
|
48
|
+
readonly "brandHighlight": string;
|
|
49
|
+
};
|
|
50
|
+
export = styles;
|
|
51
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
.icon {
|
|
2
|
+
fill: var(--color-greyBlue);
|
|
3
|
+
display: inline-block;
|
|
4
|
+
vertical-align: middle;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.longArrowUp {
|
|
8
|
+
transform: rotate(90deg);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.longArrowDown {
|
|
12
|
+
transform: rotate(-90deg);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.thumbsDown {
|
|
16
|
+
transform: scaleY(-1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.person,
|
|
20
|
+
.clients,
|
|
21
|
+
.company,
|
|
22
|
+
.property {
|
|
23
|
+
fill: var(--color-teal);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.job,
|
|
27
|
+
.jobOnHold {
|
|
28
|
+
fill: var(--color-job);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.visit,
|
|
32
|
+
.moveVisits {
|
|
33
|
+
fill: var(--color-lime);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.event {
|
|
37
|
+
fill: var(--color-yellow);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.quote {
|
|
41
|
+
fill: var(--color-quote);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.request {
|
|
45
|
+
fill: var(--color-request);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.task {
|
|
49
|
+
fill: var(--color-navy);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.userUnassigned,
|
|
53
|
+
.reminder,
|
|
54
|
+
.trash {
|
|
55
|
+
fill: var(--color-destructive);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.checkmark {
|
|
59
|
+
fill: var(--color-success);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.timer {
|
|
63
|
+
fill: var(--color-lightBlue);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.invoice,
|
|
67
|
+
.invoiceLater,
|
|
68
|
+
.sendInvoice,
|
|
69
|
+
.paidInvoice {
|
|
70
|
+
fill: var(--color-invoice);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.badInvoice {
|
|
74
|
+
fill: var(--color-critical);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.payment,
|
|
78
|
+
.expense {
|
|
79
|
+
fill: var(--color-orange);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.archive {
|
|
83
|
+
fill: var(--color-blue);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.video {
|
|
87
|
+
fill: var(--color-lightBlue);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* non-Atlantis colors to match brand colors of these file-types */
|
|
91
|
+
|
|
92
|
+
.excel {
|
|
93
|
+
fill: rgb(31, 115, 71);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.pdf {
|
|
97
|
+
fill: rgb(195, 27, 0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.word {
|
|
101
|
+
fill: rgb(41, 86, 154);
|
|
102
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
readonly "icon": string;
|
|
3
|
+
readonly "longArrowUp": string;
|
|
4
|
+
readonly "longArrowDown": string;
|
|
5
|
+
readonly "thumbsDown": string;
|
|
6
|
+
readonly "person": string;
|
|
7
|
+
readonly "clients": string;
|
|
8
|
+
readonly "company": string;
|
|
9
|
+
readonly "property": string;
|
|
10
|
+
readonly "job": string;
|
|
11
|
+
readonly "jobOnHold": string;
|
|
12
|
+
readonly "visit": string;
|
|
13
|
+
readonly "moveVisits": string;
|
|
14
|
+
readonly "event": string;
|
|
15
|
+
readonly "quote": string;
|
|
16
|
+
readonly "request": string;
|
|
17
|
+
readonly "task": string;
|
|
18
|
+
readonly "userUnassigned": string;
|
|
19
|
+
readonly "reminder": string;
|
|
20
|
+
readonly "trash": string;
|
|
21
|
+
readonly "checkmark": string;
|
|
22
|
+
readonly "timer": string;
|
|
23
|
+
readonly "invoice": string;
|
|
24
|
+
readonly "invoiceLater": string;
|
|
25
|
+
readonly "sendInvoice": string;
|
|
26
|
+
readonly "paidInvoice": string;
|
|
27
|
+
readonly "badInvoice": string;
|
|
28
|
+
readonly "payment": string;
|
|
29
|
+
readonly "expense": string;
|
|
30
|
+
readonly "archive": string;
|
|
31
|
+
readonly "video": string;
|
|
32
|
+
readonly "excel": string;
|
|
33
|
+
readonly "pdf": string;
|
|
34
|
+
readonly "word": string;
|
|
35
|
+
};
|
|
36
|
+
export = styles;
|
|
37
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.small {
|
|
2
|
+
width: var(--base-unit);
|
|
3
|
+
height: var(--base-unit);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.base {
|
|
7
|
+
width: calc(var(--base-unit) * 1.5);
|
|
8
|
+
height: calc(var(--base-unit) * 1.5);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.large {
|
|
12
|
+
width: calc(var(--base-unit) * 2);
|
|
13
|
+
height: calc(var(--base-unit) * 2);
|
|
14
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { getIcon } from "./getIcon";
|
|
2
|
+
import { iconMap } from "./iconMap";
|
|
3
|
+
|
|
4
|
+
it("returns dashboard icon", () => {
|
|
5
|
+
const name = "dashboard";
|
|
6
|
+
const { svgClassNames, pathClassNames, paths, viewBox } = getIcon({
|
|
7
|
+
name,
|
|
8
|
+
});
|
|
9
|
+
expect(svgClassNames).toBe("icon base");
|
|
10
|
+
expect(pathClassNames).toBe("");
|
|
11
|
+
expect(paths).toEqual(iconMap.icons[name]);
|
|
12
|
+
expect(viewBox).toBe("0 0 1024 1024");
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("returns apple icon", () => {
|
|
16
|
+
const name = "apple";
|
|
17
|
+
const { svgClassNames, pathClassNames, paths, viewBox } = getIcon({
|
|
18
|
+
name,
|
|
19
|
+
});
|
|
20
|
+
expect(svgClassNames).toBe("icon base");
|
|
21
|
+
expect(pathClassNames).toBe("");
|
|
22
|
+
expect(paths).toEqual(iconMap.icons[name]);
|
|
23
|
+
expect(viewBox).toBe("0 0 1024 1024");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("returns large arrowDown icon", () => {
|
|
27
|
+
const name = "arrowDown";
|
|
28
|
+
const size = "large";
|
|
29
|
+
const { svgClassNames, pathClassNames, paths, viewBox } = getIcon({
|
|
30
|
+
name,
|
|
31
|
+
size,
|
|
32
|
+
});
|
|
33
|
+
expect(svgClassNames).toBe(`icon ${size}`);
|
|
34
|
+
expect(pathClassNames).toBe("");
|
|
35
|
+
expect(paths).toEqual(iconMap.icons[name]);
|
|
36
|
+
expect(viewBox).toBe("0 0 1024 1024");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("returns thumbsDown icon", () => {
|
|
40
|
+
const name = "thumbsDown";
|
|
41
|
+
const mapedName = "thumbsUp";
|
|
42
|
+
const { svgClassNames, pathClassNames, paths, viewBox } = getIcon({
|
|
43
|
+
name,
|
|
44
|
+
});
|
|
45
|
+
expect(svgClassNames).toBe("icon base thumbsDown");
|
|
46
|
+
expect(pathClassNames).toBe("");
|
|
47
|
+
expect(paths).toEqual(iconMap.icons[mapedName]);
|
|
48
|
+
expect(viewBox).toBe("0 0 1024 1024");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("returns small more icon", () => {
|
|
52
|
+
const name = "more";
|
|
53
|
+
const size = "small";
|
|
54
|
+
const { svgClassNames, pathClassNames, paths, viewBox } = getIcon({
|
|
55
|
+
name,
|
|
56
|
+
size,
|
|
57
|
+
});
|
|
58
|
+
expect(svgClassNames).toBe(`icon ${size}`);
|
|
59
|
+
expect(pathClassNames).toBe("");
|
|
60
|
+
expect(paths).toEqual(iconMap.icons[name]);
|
|
61
|
+
expect(viewBox).toBe("0 0 1024 1024");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("returns truck icon properties", () => {
|
|
65
|
+
const name = "truck";
|
|
66
|
+
const { svgClassNames, pathClassNames, paths, viewBox } = getIcon({
|
|
67
|
+
name,
|
|
68
|
+
});
|
|
69
|
+
expect(svgClassNames).toBe("icon base");
|
|
70
|
+
expect(pathClassNames).toBe("");
|
|
71
|
+
expect(paths).toEqual([]);
|
|
72
|
+
expect(viewBox).toBe("0 0 1024 1024");
|
|
73
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import classnames from "classnames";
|
|
2
|
+
import styles from "./Icon.css";
|
|
3
|
+
import sizes from "./Sizes.css";
|
|
4
|
+
import colors from "./Colors.css";
|
|
5
|
+
import { iconMap } from "./iconMap";
|
|
6
|
+
|
|
7
|
+
export const iconClassMap = getInvertedClassMap(styles);
|
|
8
|
+
export const sizesClassMap = getInvertedClassMap(sizes);
|
|
9
|
+
export const colorsClassMap = getInvertedClassMap(colors);
|
|
10
|
+
|
|
11
|
+
function getInvertedClassMap(classMap: Record<string, string>) {
|
|
12
|
+
return Object.keys(classMap).reduce(
|
|
13
|
+
(acc, value) => ({
|
|
14
|
+
...acc,
|
|
15
|
+
[classMap[value]]: value,
|
|
16
|
+
}),
|
|
17
|
+
{},
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type IconNames =
|
|
22
|
+
| keyof typeof iconMap.icons
|
|
23
|
+
| "longArrowUp"
|
|
24
|
+
| "longArrowDown"
|
|
25
|
+
| "remove"
|
|
26
|
+
| "thumbsDown"
|
|
27
|
+
| "truck";
|
|
28
|
+
export type IconColorNames = keyof typeof colors;
|
|
29
|
+
export type IconSizes = keyof typeof sizes;
|
|
30
|
+
interface IconProps {
|
|
31
|
+
/** The icon to show. */
|
|
32
|
+
readonly name: IconNames;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Changes the size to small or large.
|
|
36
|
+
* @default base
|
|
37
|
+
*/
|
|
38
|
+
readonly size?: IconSizes;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Determines the color of the icon. Some icons have a default system colour
|
|
42
|
+
* like quotes, jobs, and invoices. Others that doesn't have a system colour
|
|
43
|
+
* falls back to greyBlueDark.
|
|
44
|
+
*/
|
|
45
|
+
readonly color?: IconColorNames;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function getIcon({ name, color, size = "base" }: IconProps) {
|
|
49
|
+
const svgClassNames = classnames(styles.icon, sizes[size], {
|
|
50
|
+
[styles.longArrowUp]: name === "longArrowUp",
|
|
51
|
+
[styles.longArrowDown]: name === "longArrowDown",
|
|
52
|
+
[styles.thumbsDown]: name === "thumbsDown",
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const pathClassNames = getPathClassNames(name, color);
|
|
56
|
+
const paths = getPaths(name);
|
|
57
|
+
const viewBox = `0 0 ${iconMap.height} ${iconMap.height}`;
|
|
58
|
+
return { svgClassNames, pathClassNames, paths, viewBox } as const;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function getPaths(name: IconNames) {
|
|
62
|
+
const iconName = mapToCorrectIcon(name);
|
|
63
|
+
if (iconName === "truck") {
|
|
64
|
+
return [];
|
|
65
|
+
} else {
|
|
66
|
+
return iconMap.icons[iconName];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function mapToCorrectIcon(name: IconNames) {
|
|
71
|
+
switch (name) {
|
|
72
|
+
case "longArrowUp":
|
|
73
|
+
return "backArrow";
|
|
74
|
+
case "longArrowDown":
|
|
75
|
+
return "backArrow";
|
|
76
|
+
case "remove":
|
|
77
|
+
return "cross";
|
|
78
|
+
case "thumbsDown":
|
|
79
|
+
return "thumbsUp";
|
|
80
|
+
default:
|
|
81
|
+
return name;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getPathClassNames(name: string, color?: IconColorNames) {
|
|
85
|
+
return classnames(color && colors[color], {
|
|
86
|
+
[styles.person]: name === "person",
|
|
87
|
+
[styles.clients]: name === "clients",
|
|
88
|
+
[styles.company]: name === "company",
|
|
89
|
+
[styles.property]: name === "property",
|
|
90
|
+
[styles.userUnassigned]: name === "userUnassigned",
|
|
91
|
+
[styles.job]: name === "job",
|
|
92
|
+
[styles.jobOnHold]: name === "jobOnHold",
|
|
93
|
+
[styles.visit]: name === "visit",
|
|
94
|
+
[styles.moveVisits]: name === "moveVisits",
|
|
95
|
+
[styles.event]: name === "event",
|
|
96
|
+
[styles.request]: name === "request",
|
|
97
|
+
[styles.reminder]: name === "reminder",
|
|
98
|
+
[styles.trash]: name === "trash",
|
|
99
|
+
[styles.task]: name === "task",
|
|
100
|
+
[styles.timer]: name === "timer",
|
|
101
|
+
[styles.quote]: name === "quote",
|
|
102
|
+
[styles.invoice]: name === "invoice",
|
|
103
|
+
[styles.checkmark]: name === "checkmark",
|
|
104
|
+
[styles.invoiceLater]: name === "invoiceLater",
|
|
105
|
+
[styles.badInvoice]: name === "badInvoice",
|
|
106
|
+
[styles.sendInvoice]: name === "sendInvoice",
|
|
107
|
+
[styles.paidInvoice]: name === "paidInvoice",
|
|
108
|
+
[styles.payment]: name === "payment",
|
|
109
|
+
[styles.expense]: name === "expense",
|
|
110
|
+
[styles.archive]: name === "archive",
|
|
111
|
+
[styles.excel]: name === "excel",
|
|
112
|
+
[styles.pdf]: name === "pdf",
|
|
113
|
+
[styles.word]: name === "word",
|
|
114
|
+
[styles.video]: name === "video",
|
|
115
|
+
});
|
|
116
|
+
}
|