@thecb/components 8.2.0-beta.0 → 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/dist/index.cjs.js +12 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +12 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/badge/Badge.js +9 -8
- package/src/components/atoms/badge/Badge.stories.js +8 -4
- package/src/components/atoms/badge/index.d.ts +9 -0
- /package/src/components/atoms/icons/{AutopayIcon.js → AutoPayIcon.js} +0 -0
package/package.json
CHANGED
|
@@ -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: ${({
|
|
14
|
+
background-color: ${({ themeValues }) => themeValues.background};
|
|
14
15
|
`;
|
|
15
16
|
|
|
16
17
|
const StyledBadge = styled(Text)`
|
|
@@ -20,20 +21,20 @@ const StyledBadge = styled(Text)`
|
|
|
20
21
|
font-weight: 400;
|
|
21
22
|
line-height: 150%; /* 15px */
|
|
22
23
|
letter-spacing: 0.2px;
|
|
23
|
-
color: ${({
|
|
24
|
+
color: ${({ themeValues }) => themeValues.color};
|
|
24
25
|
|
|
25
|
-
@media screen and (min-width:
|
|
26
|
+
@media screen and (min-width: 1049px) {
|
|
26
27
|
font-size: 12px;
|
|
27
28
|
line-height: 150%; /* 18px */
|
|
28
29
|
letter-spacing: 0.24px;
|
|
29
30
|
}
|
|
30
31
|
`;
|
|
31
32
|
|
|
32
|
-
const Badge = ({ label, Icon,
|
|
33
|
-
<StyledBadgeContainer
|
|
34
|
-
{Icon && <Icon fill={
|
|
35
|
-
<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,22 +2,26 @@ 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
|
|
5
|
+
import AutoPayIcon from "../icons/AutoPayIcon";
|
|
6
6
|
|
|
7
|
+
const variantsLabel = "variants";
|
|
7
8
|
const variants = {
|
|
8
9
|
info: "info",
|
|
9
10
|
warn: "warn",
|
|
10
11
|
primary: "primary",
|
|
11
12
|
success: "success"
|
|
12
13
|
};
|
|
14
|
+
|
|
13
15
|
const defaultValue = "success";
|
|
14
16
|
const groupId = "props";
|
|
17
|
+
const labelLabel = "label";
|
|
18
|
+
const iconLabel = "Icon";
|
|
15
19
|
|
|
16
20
|
export const badge = () => (
|
|
17
21
|
<Badge
|
|
18
|
-
variant={select(
|
|
19
|
-
label={text(
|
|
20
|
-
Icon={text(
|
|
22
|
+
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
23
|
+
label={text(labelLabel, "Autopay Available", groupId)}
|
|
24
|
+
Icon={text(iconLabel, AutoPayIcon, groupId)}
|
|
21
25
|
/>
|
|
22
26
|
);
|
|
23
27
|
|
|
File without changes
|