@thecb/components 7.12.2-beta.4 → 7.12.2-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "7.12.2-beta.4",
3
+ "version": "7.12.2-beta.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import styled from "styled-components";
2
+ import styled, { css } from "styled-components";
3
3
  import { fallbackValues } from "./Spinner.theme";
4
4
  import { themeComponent } from "../../../util/themeUtils";
5
5
 
@@ -32,6 +32,12 @@ const SpinnerSvgAnimation = styled.svg`
32
32
  stroke-dashoffset: -124;
33
33
  }
34
34
  }
35
+ ${({ centerSpinner }) =>
36
+ centerSpinner
37
+ ? css`
38
+ margin: 0;
39
+ `
40
+ : ""}
35
41
  `;
36
42
 
37
43
  export const SpinnerContainer = styled.div`
@@ -41,11 +47,27 @@ export const SpinnerContainer = styled.div`
41
47
  align-items: center;
42
48
  justify-content: center;
43
49
  line-height: 1;
50
+ ${({ centerSpinner, size }) =>
51
+ centerSpinner
52
+ ? css`
53
+ width: ${size}px;
54
+ height: ${size}px;
55
+ `
56
+ : ""}
44
57
  `;
45
58
 
46
- const Spinner = ({ size = "24", themeValues }) => (
47
- <SpinnerContainer>
48
- <SpinnerSvgAnimation size={size} color={themeValues.color}>
59
+ /*
60
+ `centerSpinner` prop alters existing styling of spinner to allow it to properly center itself within
61
+ containers. Default is false to preserve legacy behavior for past uses.
62
+ */
63
+
64
+ const Spinner = ({ size = "24", centerSpinner = false, themeValues }) => (
65
+ <SpinnerContainer centerSpinner={centerSpinner} size={size}>
66
+ <SpinnerSvgAnimation
67
+ size={size}
68
+ color={themeValues.color}
69
+ centerSpinner={centerSpinner}
70
+ >
49
71
  <circle
50
72
  className="path"
51
73
  cx="50"
@@ -123,8 +123,11 @@ const LoadingDetails = () => (
123
123
  <Box padding="0" background={GHOST_GREY} borderRadius="4px" minHeight="196px">
124
124
  <Cover minHeight="196px" singleChild fillCenter>
125
125
  <Center intrinsic>
126
- <Box padding="0" minHeight="100px" minWidth="100px">
127
- <Spinner size="100" />
126
+ <Box
127
+ padding="0"
128
+ extraStyles={`flex-grow: 1; display: flex; justify-content: center; align-items: center;`}
129
+ >
130
+ <Spinner size="100" centerSpinner />
128
131
  </Box>
129
132
  </Center>
130
133
  </Cover>