@plusscommunities/pluss-core-web 1.6.13-beta.0 → 1.6.15-beta.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/package.json +1 -2
- package/rollup.config.js +45 -45
- package/src/actions/AuthActions.js +40 -40
- package/src/actions/LocalActions.js +5 -5
- package/src/actions/NavActions.js +5 -5
- package/src/actions/ScheduledActionsActions.js +5 -5
- package/src/actions/TemplateActions.js +9 -9
- package/src/actions/UsersActions.js +74 -70
- package/src/actions/index.js +6 -6
- package/src/actions/types.js +17 -17
- package/src/analytics.js +178 -158
- package/src/apis/analyticsActions.js +50 -50
- package/src/apis/authActions.js +55 -55
- package/src/apis/fileActions.js +147 -142
- package/src/apis/index.js +10 -10
- package/src/apis/profileActions.js +130 -130
- package/src/apis/scheduledActionsActions.js +9 -9
- package/src/apis/stringActions.js +26 -22
- package/src/apis/templateActions.js +38 -38
- package/src/apis/typeActions.js +183 -183
- package/src/apis/userActions.js +166 -166
- package/src/apis/utilityActions.js +32 -32
- package/src/colours.js +79 -77
- package/src/components/AddButton.js +29 -20
- package/src/components/AnalyticsFilter.js +136 -102
- package/src/components/Attachment.js +36 -22
- package/src/components/AudienceIncluder.js +209 -165
- package/src/components/AudienceSelector.js +680 -680
- package/src/components/Button.js +79 -56
- package/src/components/CheckBox.js +77 -65
- package/src/components/ColourOptions.js +205 -181
- package/src/components/ColourPicker.js +286 -244
- package/src/components/Comment.js +48 -39
- package/src/components/CommentSection.js +113 -103
- package/src/components/DatePicker.js +298 -255
- package/src/components/DropdownInput.js +236 -215
- package/src/components/DurationInput.js +46 -43
- package/src/components/ExportCsvPopup.js +236 -217
- package/src/components/FileInput.js +359 -346
- package/src/components/GenericInput.js +184 -153
- package/src/components/Header.js +88 -65
- package/src/components/HubSidebar.js +136 -124
- package/src/components/ImageInput.js +1182 -973
- package/src/components/InputGroup.js +20 -13
- package/src/components/MakerPopup.js +285 -278
- package/src/components/MoreMenu.js +21 -17
- package/src/components/OptionsSection.js +86 -74
- package/src/components/OverlayPage.js +61 -61
- package/src/components/OverlayPageBottomButtons.js +38 -38
- package/src/components/OverlayPageContents.js +38 -38
- package/src/components/OverlayPageSection.js +24 -24
- package/src/components/P60Icon.js +38 -33
- package/src/components/PageTitle.js +8 -8
- package/src/components/Popup.js +114 -95
- package/src/components/ProfilePic.js +40 -40
- package/src/components/RadioButton.js +142 -126
- package/src/components/Reactions.js +66 -66
- package/src/components/SVGIcon.js +31 -25
- package/src/components/SideNavItem.js +112 -83
- package/src/components/StatBox.js +54 -44
- package/src/components/StatusButton.js +31 -17
- package/src/components/SuccessPopup.js +61 -48
- package/src/components/Tabs.js +50 -47
- package/src/components/Tag.js +54 -54
- package/src/components/Text.js +18 -14
- package/src/components/TextFormatPopup.js +77 -49
- package/src/components/TimePicker.js +214 -200
- package/src/components/ToggleSwitch.js +60 -0
- package/src/components/UserListing.js +110 -97
- package/src/components/index.js +46 -46
- package/src/components/svg-icons.json +819 -819
- package/src/config.js +22 -22
- package/src/helper/HelpDeskWidget.js +4 -4
- package/src/helper/api/getUrl.js +16 -11
- package/src/helper/api/getUrlParams.js +8 -5
- package/src/helper/api/safeReadParams.js +3 -2
- package/src/helper/auth/getUserFromState.js +4 -4
- package/src/helper/colours/getAppColourFromState.js +10 -5
- package/src/helper/files/canvasImageUploader.js +152 -140
- package/src/helper/files/generateImageName.js +6 -6
- package/src/helper/files/get1400.js +33 -25
- package/src/helper/files/getExtension.js +5 -5
- package/src/helper/files/getFileName.js +9 -9
- package/src/helper/files/getThumb300.js +37 -29
- package/src/helper/files/isVideo.js +3 -3
- package/src/helper/helper.js +59 -56
- package/src/helper/index.js +29 -29
- package/src/helper/site/getMerchantsFromState.js +8 -4
- package/src/helper/site/getSiteLevelFromState.js +29 -29
- package/src/helper/site/getSiteName.js +11 -11
- package/src/helper/site/getSiteNameFromRoles.js +7 -7
- package/src/helper/site/getSiteSettingFromState.js +10 -5
- package/src/helper/storage/readJSONFromStorage.js +5 -5
- package/src/helper/storage/readStorageWithCookie.js +17 -17
- package/src/helper/storage/setLocalStorage.js +1 -1
- package/src/helper/strings/getFirstName.js +5 -5
- package/src/helper/strings/htmlDecode.js +2 -2
- package/src/helper/strings/htmlEncode.js +2 -2
- package/src/helper/strings/isEmail.js +7 -6
- package/src/helper/strings/isUrl.js +7 -7
- package/src/helper/strings/onlyAlphanumeric.js +4 -4
- package/src/helper/strings/randomString.js +6 -6
- package/src/helper/strings/toParagraphed.js +12 -12
- package/src/index.js +22 -11
- package/src/reducers/ScheduledActionsReducer.js +8 -8
- package/src/reducers/TemplatesReducer.js +22 -22
- package/src/reducers/index.js +4 -4
- package/src/session.js +70 -70
- package/src/urls.js +17 -16
- package/dist/index.cjs.js +0 -11623
- package/dist/index.esm.js +0 -11583
- package/dist/index.umd.js +0 -11595
package/src/apis/userActions.js
CHANGED
|
@@ -1,169 +1,169 @@
|
|
|
1
|
-
import _ from
|
|
2
|
-
import { authedFunction } from
|
|
3
|
-
import { getUrl } from
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { authedFunction } from "../session";
|
|
3
|
+
import { getUrl } from "../helper";
|
|
4
4
|
|
|
5
5
|
export const userActions = {
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
6
|
+
createNewUser: (user, userExtra) => {
|
|
7
|
+
return authedFunction({
|
|
8
|
+
method: "POST",
|
|
9
|
+
url: getUrl("users", "add"),
|
|
10
|
+
data: {
|
|
11
|
+
user,
|
|
12
|
+
userExtra,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
bulkNewUser: (users, site, sendWelcome) => {
|
|
17
|
+
return authedFunction({
|
|
18
|
+
method: "POST",
|
|
19
|
+
url: getUrl("users", "addbulk"),
|
|
20
|
+
data: {
|
|
21
|
+
site,
|
|
22
|
+
users,
|
|
23
|
+
sendWelcome,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
getbulks: (site) => {
|
|
28
|
+
return authedFunction({
|
|
29
|
+
method: "POST",
|
|
30
|
+
url: getUrl("users", "getbulks"),
|
|
31
|
+
data: {
|
|
32
|
+
site,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
fetchUsers: (site) => {
|
|
37
|
+
return authedFunction({
|
|
38
|
+
method: "POST",
|
|
39
|
+
url: getUrl("users", "get"),
|
|
40
|
+
data: {
|
|
41
|
+
site,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
fetchInitialPasswords: (site) => {
|
|
46
|
+
return authedFunction({
|
|
47
|
+
method: "GET",
|
|
48
|
+
url: getUrl("users", "initialpasswords", { site }),
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
fetchUser: (site, userId) => {
|
|
52
|
+
return authedFunction({
|
|
53
|
+
method: "POST",
|
|
54
|
+
url: getUrl("users", "getsingle"),
|
|
55
|
+
data: {
|
|
56
|
+
site,
|
|
57
|
+
userId,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
updateUser: (site, userId, user) => {
|
|
62
|
+
return authedFunction({
|
|
63
|
+
method: "POST",
|
|
64
|
+
url: getUrl("users", "manageUser"),
|
|
65
|
+
data: {
|
|
66
|
+
site,
|
|
67
|
+
userId,
|
|
68
|
+
user,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
getSiteResidentsCount: (site) => {
|
|
73
|
+
return authedFunction({
|
|
74
|
+
method: "POST",
|
|
75
|
+
url: getUrl("users", "getexp"),
|
|
76
|
+
data: { site, isCount: true },
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
sendWelcomeEmail: (site, userId) => {
|
|
80
|
+
return authedFunction({
|
|
81
|
+
method: "POST",
|
|
82
|
+
url: getUrl("users", "welcome/email"),
|
|
83
|
+
data: { site, userId },
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
sendWelcomeText: (site, userId) => {
|
|
87
|
+
return authedFunction({
|
|
88
|
+
method: "POST",
|
|
89
|
+
url: getUrl("users", "welcome/text"),
|
|
90
|
+
data: { site, userId },
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
getInviteCode: (userId, type, site) => {
|
|
94
|
+
const query = {};
|
|
95
|
+
if (!_.isEmpty(userId)) {
|
|
96
|
+
query.userId = userId;
|
|
97
|
+
}
|
|
98
|
+
if (!_.isEmpty(type)) {
|
|
99
|
+
query.type = type;
|
|
100
|
+
}
|
|
101
|
+
if (!_.isEmpty(site)) {
|
|
102
|
+
query.site = site;
|
|
103
|
+
}
|
|
104
|
+
return authedFunction({
|
|
105
|
+
method: "GET",
|
|
106
|
+
url: getUrl("users", "invite/get", query),
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
generateInviteCode: (userId, type, site) => {
|
|
110
|
+
const data = {};
|
|
111
|
+
if (!_.isEmpty(userId)) {
|
|
112
|
+
data.userId = userId;
|
|
113
|
+
}
|
|
114
|
+
if (!_.isEmpty(type)) {
|
|
115
|
+
data.type = type;
|
|
116
|
+
}
|
|
117
|
+
if (!_.isEmpty(site)) {
|
|
118
|
+
data.site = site;
|
|
119
|
+
}
|
|
120
|
+
return authedFunction({
|
|
121
|
+
method: "POST",
|
|
122
|
+
url: getUrl("users", "invite/generate"),
|
|
123
|
+
data,
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
createInviteCode: (userId, site, userType, expiry) => {
|
|
127
|
+
return authedFunction({
|
|
128
|
+
method: "POST",
|
|
129
|
+
url: getUrl("users", "invite/update/add"),
|
|
130
|
+
data: { userId, site, userType, expiry },
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
editInviteCode: (code, userType, expiry) => {
|
|
134
|
+
return authedFunction({
|
|
135
|
+
method: "POST",
|
|
136
|
+
url: getUrl("users", "invite/update/edit"),
|
|
137
|
+
data: { code, userType, expiry },
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
deleteInviteCode: (code) => {
|
|
141
|
+
return authedFunction({
|
|
142
|
+
method: "POST",
|
|
143
|
+
url: getUrl("users", "invite/update/delete"),
|
|
144
|
+
data: { code },
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
getInviteCodes: (site, excludeFamily = false) => {
|
|
148
|
+
const action = excludeFamily ? "excludeFamily" : "all";
|
|
149
|
+
return authedFunction({
|
|
150
|
+
method: "GET",
|
|
151
|
+
url: getUrl("users", `invite/get/${action}`, { site }),
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
getInviteCodeByCode: (code) => {
|
|
155
|
+
return authedFunction({
|
|
156
|
+
method: "GET",
|
|
157
|
+
url: getUrl("users", "invite/get/code", { code }),
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
updateProfile: (input) => {
|
|
161
|
+
return authedFunction({
|
|
162
|
+
method: "POST",
|
|
163
|
+
url: getUrl("users", "updateProfile"),
|
|
164
|
+
data: {
|
|
165
|
+
details: input,
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
169
|
};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import Config from
|
|
2
|
-
import { authedFunction, unauthedFunction } from
|
|
3
|
-
import { getUrl } from
|
|
1
|
+
import Config from "../config";
|
|
2
|
+
import { authedFunction, unauthedFunction } from "../session";
|
|
3
|
+
import { getUrl } from "../helper";
|
|
4
4
|
|
|
5
5
|
export const utilityActions = {
|
|
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
|
-
|
|
6
|
+
getUpvotyToken: () => {
|
|
7
|
+
return authedFunction({
|
|
8
|
+
method: "GET",
|
|
9
|
+
url: getUrl("utility", "upvoty/usertoken"),
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
getBoardHash: () => {
|
|
13
|
+
return authedFunction({
|
|
14
|
+
method: "GET",
|
|
15
|
+
url: getUrl("utility", "upvoty/boardhash"),
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
getRoadmapHash: () => {
|
|
19
|
+
return authedFunction({
|
|
20
|
+
method: "GET",
|
|
21
|
+
url: getUrl("utility", "upvoty/roadmap"),
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
generateMake: (templateId, data) => {
|
|
25
|
+
return unauthedFunction({
|
|
26
|
+
method: "POST",
|
|
27
|
+
url: `https://api.make.cm/make/t/${templateId}/sync`,
|
|
28
|
+
data,
|
|
29
|
+
headers: {
|
|
30
|
+
"Content-Type": "application/json",
|
|
31
|
+
"X-MAKE-API-KEY": Config.env.makeApiKey,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
35
|
};
|
package/src/colours.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// const COLOUR_2 = '#3179cb';
|
|
3
3
|
// const COLOUR_3 = '#1bb7ee';
|
|
4
4
|
|
|
5
|
-
const COLOUR_BRANDING_MAIN =
|
|
5
|
+
const COLOUR_BRANDING_MAIN = "#4a57b7";
|
|
6
6
|
// const COLOUR_BRANDING_DARK = '#364196';
|
|
7
7
|
// const COLOUR_BRANDING_LIGHT = '#597db4';
|
|
8
|
-
const COLOUR_BRANDING_OFF =
|
|
9
|
-
const COLOUR_BRANDING_ACTION =
|
|
10
|
-
const COLOUR_BRANDING_INACTIVE =
|
|
8
|
+
const COLOUR_BRANDING_OFF = "#597db4";
|
|
9
|
+
const COLOUR_BRANDING_ACTION = "#5c90df";
|
|
10
|
+
const COLOUR_BRANDING_INACTIVE = "#dbddf1";
|
|
11
11
|
|
|
12
12
|
// const TEXT_DARKEST = '#262a2d';
|
|
13
13
|
// const TEXT_DARK = '#262a2d';
|
|
@@ -16,11 +16,11 @@ const COLOUR_BRANDING_INACTIVE = '#dbddf1';
|
|
|
16
16
|
// const TEXT_DARK_ALPHA10 = 'rgba(60, 60, 80, .1)';
|
|
17
17
|
// const TEXT_MID = '#5a5a6e';
|
|
18
18
|
// const TEXT_MID_ALPHA50 = 'rgba(90, 90, 110, .5)';
|
|
19
|
-
const TEXT_LIGHT =
|
|
19
|
+
const TEXT_LIGHT = "#717b81";
|
|
20
20
|
// const TEXT_SUPER_LIGHT = '#d2d9e5';
|
|
21
|
-
const COLOUR_DUSK =
|
|
22
|
-
const COLOUR_DUSK_LIGHT =
|
|
23
|
-
const COLOUR_DUSK_LIGHTER =
|
|
21
|
+
const COLOUR_DUSK = "#536280";
|
|
22
|
+
const COLOUR_DUSK_LIGHT = "#67758f";
|
|
23
|
+
const COLOUR_DUSK_LIGHTER = "#a1afcc";
|
|
24
24
|
|
|
25
25
|
const LINEGREY = COLOUR_BRANDING_INACTIVE;
|
|
26
26
|
// const BORDER_LINE_GREY = COLOUR_BRANDING_INACTIVE;
|
|
@@ -31,8 +31,8 @@ const LINEGREY = COLOUR_BRANDING_INACTIVE;
|
|
|
31
31
|
// const COLOUR_BLUE_ALPHA10 = 'rgba(0, 131, 238, 0.1)';
|
|
32
32
|
// const COLOUR_DARKBLUE = '#191e78';
|
|
33
33
|
// const COLOUR_PURPLE = '#6e79c5';
|
|
34
|
-
const COLOUR_RED =
|
|
35
|
-
const COLOUR_GREEN =
|
|
34
|
+
const COLOUR_RED = "#c02743";
|
|
35
|
+
const COLOUR_GREEN = "#00cc9c";
|
|
36
36
|
// const COLOUR_TANGERINE = '#ff8c75';
|
|
37
37
|
// const COLOUR_CITRON = '#bdbd27';
|
|
38
38
|
// const COLOUR_GRAPEFRUIT = '#ff6363';
|
|
@@ -42,38 +42,40 @@ const COLOUR_GREEN = '#00cc9c';
|
|
|
42
42
|
// const COLOUR_NAV_GREY = '#f6f6f6';
|
|
43
43
|
// const COLOUR_TRANSPARENT = 'rgba(0,0,0,0)';
|
|
44
44
|
// const COLOUR_SIDEBAR = '#303030';
|
|
45
|
-
const COLOUR_LIGHTGREY =
|
|
45
|
+
const COLOUR_LIGHTGREY = "#8695b2";
|
|
46
46
|
|
|
47
47
|
const INACTIVE_TEXT = COLOUR_LIGHTGREY;
|
|
48
48
|
|
|
49
|
-
const COLOUR_BRANDING_APP =
|
|
49
|
+
const COLOUR_BRANDING_APP = "#4a57b7";
|
|
50
50
|
|
|
51
51
|
const hexToRGB = (hex) => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
53
|
+
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
54
|
+
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
|
|
55
|
+
return r + r + g + g + b + b;
|
|
56
|
+
});
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
59
|
+
return result
|
|
60
|
+
? {
|
|
61
|
+
r: parseInt(result[1], 16),
|
|
62
|
+
g: parseInt(result[2], 16),
|
|
63
|
+
b: parseInt(result[3], 16),
|
|
64
|
+
}
|
|
65
|
+
: null;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
const hexToRGBAstring = (hex, opacity) => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
|
|
70
|
+
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
71
|
+
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
|
|
72
|
+
return r + r + g + g + b + b;
|
|
73
|
+
});
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
76
|
+
return result
|
|
77
|
+
? `rgba(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}, ${opacity})`
|
|
78
|
+
: null;
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
// const pctBtwnColours = (c1, c2, percentage) => {
|
|
@@ -86,49 +88,49 @@ const hexToRGBAstring = (hex, opacity) => {
|
|
|
86
88
|
// };
|
|
87
89
|
|
|
88
90
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
91
|
+
// COLOUR_1,
|
|
92
|
+
// COLOUR_2,
|
|
93
|
+
// COLOUR_3,
|
|
94
|
+
// TEXT_DARKEST,
|
|
95
|
+
// TEXT_DARK,
|
|
96
|
+
// TEXT_DARK_ALPHA50,
|
|
97
|
+
// TEXT_DARK_ALPHA20,
|
|
98
|
+
// TEXT_DARK_ALPHA10,
|
|
99
|
+
// TEXT_MID,
|
|
100
|
+
// TEXT_MID_ALPHA50,
|
|
101
|
+
TEXT_LIGHT,
|
|
102
|
+
// TEXT_SUPER_LIGHT,
|
|
103
|
+
COLOUR_DUSK,
|
|
104
|
+
COLOUR_DUSK_LIGHT,
|
|
105
|
+
COLOUR_DUSK_LIGHTER,
|
|
106
|
+
LINEGREY,
|
|
107
|
+
// BORDER_LINE_GREY,
|
|
108
|
+
// COLOUR_TEAL,
|
|
109
|
+
// COLOUR_TEAL_ALPHA50,
|
|
110
|
+
// COLOUR_BLUE,
|
|
111
|
+
// COLOUR_BLUE_ALPHA10,
|
|
112
|
+
// COLOUR_DARKBLUE,
|
|
113
|
+
// COLOUR_PURPLE,
|
|
114
|
+
COLOUR_RED,
|
|
115
|
+
// COLOUR_TANGERINE,
|
|
116
|
+
// COLOUR_CITRON,
|
|
117
|
+
// COLOUR_GRAPEFRUIT,
|
|
118
|
+
// DARK_OVERLAY,
|
|
119
|
+
hexToRGB,
|
|
120
|
+
hexToRGBAstring,
|
|
121
|
+
// pctBtwnColours,
|
|
122
|
+
// FACEBOOK_BLUE,
|
|
123
|
+
// COLOUR_NAV_GREY,
|
|
124
|
+
// COLOUR_TRANSPARENT,
|
|
125
|
+
// COLOUR_SIDEBAR,
|
|
126
|
+
COLOUR_BRANDING_MAIN,
|
|
127
|
+
COLOUR_BRANDING_OFF,
|
|
128
|
+
// COLOUR_BRANDING_LIGHT,
|
|
129
|
+
// COLOUR_BRANDING_DARK,
|
|
130
|
+
COLOUR_BRANDING_ACTION,
|
|
131
|
+
COLOUR_GREEN,
|
|
132
|
+
INACTIVE_TEXT,
|
|
133
|
+
COLOUR_LIGHTGREY,
|
|
134
|
+
COLOUR_BRANDING_APP,
|
|
135
|
+
COLOUR_BRANDING_INACTIVE,
|
|
134
136
|
};
|
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
import React, { Component } from
|
|
2
|
-
import FontAwesome from
|
|
1
|
+
import React, { Component } from "react";
|
|
2
|
+
import FontAwesome from "react-fontawesome";
|
|
3
3
|
|
|
4
4
|
class AddButton extends Component {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
getClasses() {
|
|
6
|
+
let classes = "addButton";
|
|
7
|
+
if (this.props.inactive) {
|
|
8
|
+
classes += " addButton--inactive";
|
|
9
|
+
}
|
|
10
|
+
return classes;
|
|
11
|
+
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
renderIcon() {
|
|
14
|
+
return (
|
|
15
|
+
<FontAwesome
|
|
16
|
+
className="addButton__icon"
|
|
17
|
+
name={this.props.icon || "plus"}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
render() {
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
style={this.props.style}
|
|
26
|
+
onClick={this.props.onClick}
|
|
27
|
+
className={this.getClasses()}
|
|
28
|
+
>
|
|
29
|
+
<div className="addButton__text">{this.props.text}</div>
|
|
30
|
+
<div className="addButton__right">{this.renderIcon()}</div>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
export { AddButton };
|