@thecb/components 10.6.0-beta.3 → 10.6.0-beta.5

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.
@@ -61,7 +61,15 @@ export const SpinnerContainer = styled.div`
61
61
  containers. Default is false to preserve legacy behavior for past uses.
62
62
  */
63
63
 
64
- const Spinner = ({ size = "24", centerSpinner = false, themeValues }) => (
64
+ const Spinner = ({
65
+ size = "24",
66
+ centerSpinner = false,
67
+ themeValues,
68
+ cx = "50",
69
+ cy = "50",
70
+ radius = "25",
71
+ strokeWidth = "6"
72
+ }) => (
65
73
  <SpinnerContainer centerSpinner={centerSpinner} size={size}>
66
74
  <SpinnerSvgAnimation
67
75
  size={size}
@@ -70,11 +78,11 @@ const Spinner = ({ size = "24", centerSpinner = false, themeValues }) => (
70
78
  >
71
79
  <circle
72
80
  className="path"
73
- cx="50"
74
- cy="50"
75
- r="25"
81
+ cx={cx}
82
+ cy={cy}
83
+ r={radius}
76
84
  fill="none"
77
- strokeWidth="6"
85
+ strokeWidth={strokeWidth}
78
86
  />
79
87
  </SpinnerSvgAnimation>
80
88
  </SpinnerContainer>
@@ -4,6 +4,10 @@ import Expand from "../../../util/expand";
4
4
  export interface SpinnerProps {
5
5
  size?: string;
6
6
  centerSpinner?: boolean;
7
+ cx?: string;
8
+ cy?: string;
9
+ radius?: string;
10
+ strokeWidth?: string;
7
11
  }
8
12
 
9
13
  export const Spinner: React.FC<Expand<SpinnerProps> &
@@ -2,10 +2,12 @@ import React, { Fragment, useContext } from "react";
2
2
  import { Box, Cluster } from "../layouts";
3
3
  import { themeComponent } from "../../../util/themeUtils";
4
4
  import ButtonWithAction from "../button-with-action";
5
+ import { Center } from "../layouts";
5
6
  import Text from "../text/Text";
6
7
  import { ThemeContext } from "styled-components";
7
8
  import { fallbackValues } from "./WalletName.theme";
8
9
  import Module from "../../molecules/module/Module";
10
+ import Spinner from "../spinner/Spinner";
9
11
 
10
12
  const WalletName = ({
11
13
  mainText,
@@ -14,7 +16,8 @@ const WalletName = ({
14
16
  actionText,
15
17
  themeValues,
16
18
  disableAction = false,
17
- buttonExtraStyles = ""
19
+ buttonExtraStyles = "",
20
+ isLoading = false
18
21
  }) => {
19
22
  const { isMobile } = useContext(ThemeContext);
20
23
 
@@ -23,21 +26,27 @@ const WalletName = ({
23
26
  <Module spacingBottom={isMobile ? "0" : "1.5rem"}>
24
27
  <Cluster
25
28
  align="center"
26
- justify={
27
- !!text || !!actionText
28
- ? "space-between"
29
- : !text && !actionText && isMobile
30
- ? "flex-end"
31
- : "flex-end"
32
- }
29
+ justify={!!text || !!actionText ? "space-between" : "flex-start"}
33
30
  extraStyles={`
34
- box-shadow: ${themeValues.boxShadow};
31
+ box-shadow: ${themeValues.boxShadow};
35
32
  padding: 1.5rem;
36
33
  ${isMobile ? `span {text-align: right;}` : ``}
37
34
  `}
38
35
  >
39
- <Box padding="0 0 0">
40
- <Text>{mainText}</Text>
36
+ <Box padding="0" extraStyles="">
37
+ {isLoading ? (
38
+ <Center as="span" style={{ padding: "24px 24px 0" }} intrinsic>
39
+ <Spinner
40
+ strokeWidth="2"
41
+ size="24"
42
+ radius="10"
43
+ cx="12"
44
+ cy="12"
45
+ />
46
+ </Center>
47
+ ) : (
48
+ <Text>{mainText}</Text>
49
+ )}
41
50
  </Box>
42
51
  {!isMobile && (
43
52
  <Box padding="0">
@@ -65,7 +74,7 @@ const WalletName = ({
65
74
  <Cluster
66
75
  align="center"
67
76
  justify={text || actionText ? "flex-end" : "flex-start"}
68
- extraStyles="margin-top: 0.75rem;"
77
+ extraStyles="margin-top: 0.5rem;"
69
78
  >
70
79
  {text && <Text extraStyles="font-size: 12px">{text}</Text>}
71
80
  {(text || actionText) && <>&nbsp;</>}
@@ -11,6 +11,7 @@ export const walletName = () => {
11
11
  actionText={text("actionText", "Check out as a guest", "props")}
12
12
  text={text("text", "Not you?", "props")}
13
13
  disableAction={boolean("disableAction", false, "props")}
14
+ isLoading={boolean("isLoading", false, "props")}
14
15
  />
15
16
  );
16
17
  };
@@ -1,11 +1,15 @@
1
- import { CHARADE_GREY, ROYAL_BLUE, WHITE } from "../../../constants/colors";
1
+ import {
2
+ CHARADE_GREY,
3
+ ROYAL_BLUE_VIVID,
4
+ WHITE
5
+ } from "../../../constants/colors";
2
6
 
3
7
  const backgroundColor = {
4
8
  primary: WHITE
5
9
  };
6
10
 
7
11
  const color = {
8
- primary: ROYAL_BLUE
12
+ primary: ROYAL_BLUE_VIVID
9
13
  };
10
14
 
11
15
  const boxShadow = {
@@ -2,12 +2,13 @@ import React from "react";
2
2
  import Expand from "../../../util/expand";
3
3
 
4
4
  export interface WalletNameProps {
5
- action?: () => void;
5
+ mainText: string;
6
+ action: () => void;
6
7
  text: string;
7
8
  actionText: string;
8
- mainText: string;
9
9
  disableAction?: boolean;
10
10
  buttonExtraStyles?: string;
11
+ isLoading?: boolean;
11
12
  }
12
13
 
13
14
  export const WalletName: React.FC<Expand<WalletNameProps> &
@@ -40,7 +40,8 @@ const EditableList = ({
40
40
  listPadding = "0rem 0rem 1.5rem 0rem",
41
41
  qaPrefix,
42
42
  ariaLabel,
43
- editItemAriaRole = ""
43
+ editItemAriaRole = "",
44
+ disablePlaceholder = false
44
45
  }) => {
45
46
  const addText = `Add a${
46
47
  itemName[0].match(/[aieouAIEOU]/) ? "n" : ""
@@ -168,6 +169,7 @@ const EditableList = ({
168
169
  action={addItem}
169
170
  dataQa={"Add " + qaPrefix}
170
171
  aria-label={addText}
172
+ isDisabled={disablePlaceholder}
171
173
  />
172
174
  </Box>
173
175
  )}
@@ -1,6 +1,4 @@
1
- import React, { useState } from "react";
2
- import { boolean } from "@storybook/addon-knobs";
3
-
1
+ import React from "react";
4
2
  import EditableList from "./EditableList";
5
3
  import page from "../../../../.storybook/page";
6
4