@thecb/components 7.12.0 → 7.12.2-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/dist/index.cjs.js +59 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +59 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/PendingIcon.js +3 -6
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/payment-details/PaymentDetails.js +57 -8
package/package.json
CHANGED
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { STORM_GREY } from "../../../constants/colors";
|
|
2
3
|
|
|
3
|
-
const PendingIcon = () => (
|
|
4
|
+
const PendingIcon = ({ fill = STORM_GREY }) => (
|
|
4
5
|
<svg
|
|
5
6
|
width="32px"
|
|
6
7
|
height="32px"
|
|
@@ -16,11 +17,7 @@ const PendingIcon = () => (
|
|
|
16
17
|
fill="none"
|
|
17
18
|
fillRule="evenodd"
|
|
18
19
|
>
|
|
19
|
-
<g
|
|
20
|
-
id="Icons"
|
|
21
|
-
transform="translate(-64.000000, -448.000000)"
|
|
22
|
-
fill="#6D717E"
|
|
23
|
-
>
|
|
20
|
+
<g id="Icons" transform="translate(-64.000000, -448.000000)" fill={fill}>
|
|
24
21
|
<path
|
|
25
22
|
d="M80,480 C88.836556,480 96,472.836556 96,464 C96,455.163444 88.836556,448 80,448 C71.163444,448 64,455.163444 64,464 C64,472.836556 71.163444,480 80,480 Z M87,466 C88.1045695,466 89,465.104569 89,464 C89,462.895431 88.1045695,462 87,462 C85.8954305,462 85,462.895431 85,464 C85,465.104569 85.8954305,466 87,466 Z M80,462 C81.1045695,462 82,462.895431 82,464 C82,465.104569 81.1045695,466 80,466 C78.8954305,466 78,465.104569 78,464 C78,462.895431 78.8954305,462 80,462 Z M73,462 C74.1045695,462 75,462.895431 75,464 C75,465.104569 74.1045695,466 73,466 C71.8954305,466 71,465.104569 71,464 C71,462.895431 71.8954305,462 73,462 Z"
|
|
26
23
|
id="status-icon---pending"
|
|
Binary file
|
|
@@ -14,9 +14,11 @@ import {
|
|
|
14
14
|
FONT_WEIGHT_BOLD,
|
|
15
15
|
FONT_WEIGHT_REGULAR
|
|
16
16
|
} from "../../../constants/style_constants";
|
|
17
|
-
import { ATHENS_GREY } from "../../../constants/colors";
|
|
17
|
+
import { ATHENS_GREY, GHOST_GREY } from "../../../constants/colors";
|
|
18
18
|
import ButtonWithAction from "../../atoms/button-with-action";
|
|
19
19
|
import Text from "../../atoms/text";
|
|
20
|
+
import Alert from "../../atoms/alert";
|
|
21
|
+
import Spinner from "../../atoms/spinner";
|
|
20
22
|
import { noop } from "../../../util/general";
|
|
21
23
|
|
|
22
24
|
const PaymentDetailsContent = ({
|
|
@@ -110,7 +112,41 @@ const PaymentDetailsContent = ({
|
|
|
110
112
|
</Stack>
|
|
111
113
|
);
|
|
112
114
|
|
|
113
|
-
const
|
|
115
|
+
const LoadingDetails = () => (
|
|
116
|
+
<Box padding="0" background={GHOST_GREY} borderRadius="4px">
|
|
117
|
+
<Spinner />
|
|
118
|
+
</Box>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const ErrorDetails = () => (
|
|
122
|
+
<Box padding="0">
|
|
123
|
+
<Alert
|
|
124
|
+
variant="error"
|
|
125
|
+
heading="Error Loading Payment"
|
|
126
|
+
text="Please go back and try again."
|
|
127
|
+
showQuitLink={false}
|
|
128
|
+
/>
|
|
129
|
+
</Box>
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const getLoadingOrErrorContent = (isLoading = false, isError = false) => {
|
|
133
|
+
if (isLoading) {
|
|
134
|
+
return <LoadingDetails />;
|
|
135
|
+
} else if (isError) {
|
|
136
|
+
return <ErrorDetails />;
|
|
137
|
+
}
|
|
138
|
+
return <Fragment />;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const Collapsible = ({
|
|
142
|
+
content,
|
|
143
|
+
title,
|
|
144
|
+
supportsTouch,
|
|
145
|
+
isOpen,
|
|
146
|
+
setIsOpen,
|
|
147
|
+
isLoading = false,
|
|
148
|
+
isError = false
|
|
149
|
+
}) => (
|
|
114
150
|
<CollapsibleSection
|
|
115
151
|
isMobile={true}
|
|
116
152
|
supportsTouch={supportsTouch}
|
|
@@ -129,15 +165,24 @@ const Collapsible = ({ content, title, supportsTouch, isOpen, setIsOpen }) => (
|
|
|
129
165
|
positionTransition
|
|
130
166
|
initial={"closed"}
|
|
131
167
|
>
|
|
132
|
-
{
|
|
168
|
+
{isLoading || isError
|
|
169
|
+
? getLoadingOrErrorContent(isLoading, isError)
|
|
170
|
+
: content}
|
|
133
171
|
</Motion>
|
|
134
172
|
</CollapsibleSection>
|
|
135
173
|
);
|
|
136
174
|
|
|
137
|
-
const NonCollapsible = ({
|
|
175
|
+
const NonCollapsible = ({
|
|
176
|
+
title,
|
|
177
|
+
content,
|
|
178
|
+
isLoading = false,
|
|
179
|
+
isError = false
|
|
180
|
+
}) => (
|
|
138
181
|
<Stack>
|
|
139
182
|
{title}
|
|
140
|
-
{
|
|
183
|
+
{isLoading || isError
|
|
184
|
+
? getLoadingOrErrorContent(isLoading, isError)
|
|
185
|
+
: content}
|
|
141
186
|
</Stack>
|
|
142
187
|
);
|
|
143
188
|
|
|
@@ -159,8 +204,10 @@ const PaymentDetails = ({
|
|
|
159
204
|
voidableTransactionDetails = [],
|
|
160
205
|
partialVoidAction = noop,
|
|
161
206
|
voidableAmountPaid = 0,
|
|
162
|
-
remainingBalance = false
|
|
207
|
+
remainingBalance = false,
|
|
163
208
|
// end partial void section
|
|
209
|
+
isLoading = false,
|
|
210
|
+
isError = false
|
|
164
211
|
}) => {
|
|
165
212
|
const [isOpen, setIsOpen] = useState(initiallyOpen);
|
|
166
213
|
const fees = _fees
|
|
@@ -266,11 +313,13 @@ const PaymentDetails = ({
|
|
|
266
313
|
isOpen,
|
|
267
314
|
setIsOpen,
|
|
268
315
|
isMobile,
|
|
269
|
-
supportsTouch
|
|
316
|
+
supportsTouch,
|
|
317
|
+
isLoading,
|
|
318
|
+
isError
|
|
270
319
|
}}
|
|
271
320
|
/>
|
|
272
321
|
) : (
|
|
273
|
-
<NonCollapsible {...{ title, content }} />
|
|
322
|
+
<NonCollapsible {...{ title, content, isLoading, isError }} />
|
|
274
323
|
);
|
|
275
324
|
};
|
|
276
325
|
|