@thecb/components 8.2.0-beta.1 → 8.2.0-beta.2

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": "8.2.0-beta.1",
3
+ "version": "8.2.0-beta.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import styled from "styled-components";
3
3
  import Box from "../layouts/Box";
4
4
  import Text from "../../atoms/text/";
5
+ import { themeComponent } from "../../../util/themeUtils";
5
6
  import { fallbackValues } from "./Badge.theme";
6
7
 
7
8
  const StyledBadgeContainer = styled(Box)`
@@ -10,7 +11,7 @@ const StyledBadgeContainer = styled(Box)`
10
11
  align-items: center;
11
12
  gap: 4px;
12
13
  border-radius: 4px;
13
- background-color: ${({ variant }) => fallbackValues.background[variant]};
14
+ background-color: ${({ themeValues }) => themeValues.background};
14
15
  `;
15
16
 
16
17
  const StyledBadge = styled(Text)`
@@ -20,7 +21,7 @@ const StyledBadge = styled(Text)`
20
21
  font-weight: 400;
21
22
  line-height: 150%; /* 15px */
22
23
  letter-spacing: 0.2px;
23
- color: ${({ variant }) => fallbackValues.color[variant]};
24
+ color: ${({ themeValues }) => themeValues.color};
24
25
 
25
26
  @media screen and (min-width: 1049px) {
26
27
  font-size: 12px;
@@ -29,11 +30,11 @@ const StyledBadge = styled(Text)`
29
30
  }
30
31
  `;
31
32
 
32
- const Badge = ({ label, Icon, variant }) => (
33
- <StyledBadgeContainer variant={variant}>
34
- {Icon && <Icon fill={fallbackValues.color[variant]} />}
35
- <StyledBadge variant={variant}>{label}</StyledBadge>
33
+ const Badge = ({ label, Icon, themeValues }) => (
34
+ <StyledBadgeContainer themeValues={themeValues}>
35
+ {Icon && <Icon fill={themeValues.color} />}
36
+ <StyledBadge themeValues={themeValues}>{label}</StyledBadge>
36
37
  </StyledBadgeContainer>
37
38
  );
38
39
 
39
- export default Badge;
40
+ export default themeComponent(Badge, "Badge", fallbackValues, "success");
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { text, select } from "@storybook/addon-knobs";
3
3
  import Badge from "./Badge";
4
4
  import page from "../../../../.storybook/page";
5
- import AutopayIcon from "../icons/AutopayIcon";
5
+ import AutoPayIcon from "../icons/AutoPayIcon";
6
6
 
7
7
  const variantsLabel = "variants";
8
8
  const variants = {
@@ -11,6 +11,7 @@ const variants = {
11
11
  primary: "primary",
12
12
  success: "success"
13
13
  };
14
+
14
15
  const defaultValue = "success";
15
16
  const groupId = "props";
16
17
  const labelLabel = "label";
@@ -20,7 +21,7 @@ export const badge = () => (
20
21
  <Badge
21
22
  variant={select(variantsLabel, variants, defaultValue, groupId)}
22
23
  label={text(labelLabel, "Autopay Available", groupId)}
23
- Icon={text(iconLabel, AutopayIcon, groupId)}
24
+ Icon={text(iconLabel, AutoPayIcon, groupId)}
24
25
  />
25
26
  );
26
27
 
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+
3
+ export interface BadgeProps {
4
+ label: string;
5
+ Icon?: JSX.Element;
6
+ }
7
+
8
+ export const Badge: React.FC<Expand<BadgeProps> &
9
+ React.HTMLAttributes<HTMLElement>>;