@thecb/components 7.7.0-beta.0 → 7.7.0-beta.1
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/dist/index.cjs.js +248 -190
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +248 -190
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/{components/.DS_Store → .DS_Store} +0 -0
- package/src/components/{molecules → atoms}/.DS_Store +0 -0
- package/src/components/atoms/{icons/PaymentIcon.js → formatted-bank-account/FormattedBankAccount.js} +22 -8
- package/src/components/atoms/formatted-bank-account/FormattedBankAccount.theme.js +9 -0
- package/src/components/atoms/formatted-bank-account/index.js +3 -0
- package/src/components/atoms/formatted-credit-card/FormattedCreditCard.js +32 -60
- package/src/components/atoms/icons/{ExternalLinkIcon.js → ExternalLinkicon.js} +0 -0
- package/src/components/atoms/icons/index.js +0 -2
- package/src/components/atoms/index.js +1 -0
- package/src/components/molecules/obligation/Obligation.js +25 -5
- package/src/components/molecules/obligation/modules/AmountModule.js +7 -1
- package/src/components/molecules/obligation/modules/AutopayModalModule.js +33 -15
- package/src/components/molecules/obligation/modules/InactiveControlsModule.js +7 -1
- package/src/components/molecules/obligation/modules/PaymentDetailsActions.js +10 -1
- package/src/components/molecules/radio-group/RadioGroup.js +4 -1
- package/src/components/molecules/radio-section/RadioSection.js +9 -50
- package/src/constants/general.js +3 -0
- package/src/util/general.js +62 -1
package/src/util/general.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { Fragment } from "react";
|
|
2
2
|
import numeral from "numeral";
|
|
3
|
-
import { CHARADE_GREY } from "../constants/colors";
|
|
3
|
+
import { CHARADE_GREY, ASH_GREY, FIRE_YELLOW } from "../constants/colors";
|
|
4
|
+
import Text from "../components/atoms/text";
|
|
4
5
|
|
|
5
6
|
export const noop = () => {};
|
|
6
7
|
|
|
@@ -144,3 +145,63 @@ export const throttle = (delay, fn) => {
|
|
|
144
145
|
return fn(...args);
|
|
145
146
|
};
|
|
146
147
|
};
|
|
148
|
+
|
|
149
|
+
export const titleCaseWord = word => {
|
|
150
|
+
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export const titleCaseString = string => {
|
|
154
|
+
return string
|
|
155
|
+
.split(" ")
|
|
156
|
+
.map((word, index, string) =>
|
|
157
|
+
index === 0 || index === string.length - 1 || word.length > 3
|
|
158
|
+
? titleCaseWord(word.toLowerCase())
|
|
159
|
+
: word
|
|
160
|
+
)
|
|
161
|
+
.join(" ");
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const renderCardStatus = (
|
|
165
|
+
expirationStatus,
|
|
166
|
+
expireDate,
|
|
167
|
+
textAlign = "right",
|
|
168
|
+
as = "span"
|
|
169
|
+
) => {
|
|
170
|
+
switch (expirationStatus) {
|
|
171
|
+
case ACTIVE:
|
|
172
|
+
return (
|
|
173
|
+
<Text
|
|
174
|
+
as={as}
|
|
175
|
+
variant="pXS"
|
|
176
|
+
color={ASH_GREY}
|
|
177
|
+
extraStyles={`text-align: ${textAlign};`}
|
|
178
|
+
>
|
|
179
|
+
Exp Date {expireDate}
|
|
180
|
+
</Text>
|
|
181
|
+
);
|
|
182
|
+
case EXPIRING_SOON:
|
|
183
|
+
return (
|
|
184
|
+
<Text
|
|
185
|
+
as={as}
|
|
186
|
+
variant="pXS"
|
|
187
|
+
color={FIRE_YELLOW}
|
|
188
|
+
extraStyles={`text-align: ${textAlign};`}
|
|
189
|
+
>
|
|
190
|
+
Expiring Soon {expireDate}
|
|
191
|
+
</Text>
|
|
192
|
+
);
|
|
193
|
+
case EXPIRED:
|
|
194
|
+
return (
|
|
195
|
+
<Text
|
|
196
|
+
as={as}
|
|
197
|
+
variant="pXS"
|
|
198
|
+
color={ASH_GREY}
|
|
199
|
+
extraStyles={`text-align: ${textAlign};`}
|
|
200
|
+
>
|
|
201
|
+
Expired
|
|
202
|
+
</Text>
|
|
203
|
+
);
|
|
204
|
+
default:
|
|
205
|
+
null;
|
|
206
|
+
}
|
|
207
|
+
};
|