@thecb/components 11.2.0 → 11.2.1
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 +116 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +116 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/icons/ExternalLinkIcon.js +1 -1
- package/src/components/molecules/contact-card/ContactCard.js +125 -0
- package/src/components/molecules/contact-card/ContactCard.stories.js +76 -0
- package/src/components/molecules/contact-card/ContactCard.styled.js +47 -0
- package/src/components/molecules/contact-card/index.d.ts +16 -0
- package/src/components/molecules/contact-card/index.js +3 -0
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/tab-sidebar/TabSidebar.js +2 -2
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ const ExternalLinkIcon = ({ linkColor, text }) => (
|
|
|
31
31
|
/>
|
|
32
32
|
</mask>
|
|
33
33
|
<g mask={`url(#mask0_902_435-${text})`}>
|
|
34
|
-
<rect x="-0.0864258" width="14" height="14" fill=
|
|
34
|
+
<rect x="-0.0864258" width="14" height="14" fill="none" />
|
|
35
35
|
</g>
|
|
36
36
|
</svg>
|
|
37
37
|
);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { Box, Stack } from "../../atoms/layouts";
|
|
3
|
+
import { ExternalLink } from "../../atoms";
|
|
4
|
+
import { ThemeContext } from "styled-components";
|
|
5
|
+
import * as Styled from "./ContactCard.styled";
|
|
6
|
+
import { createIdFromString } from "../../../util/general";
|
|
7
|
+
import { FONT_SIZE } from "../../../constants/style_constants";
|
|
8
|
+
import ExternalLinkIcon from "../../atoms/icons/ExternalLinkIcon";
|
|
9
|
+
import SolidDivider from "../../atoms/solid-divider";
|
|
10
|
+
import { ROYAL_BLUE_VIVID } from "../../../constants/colors";
|
|
11
|
+
import { createThemeValues } from "../../../util/themeUtils";
|
|
12
|
+
|
|
13
|
+
const ContactCard = ({
|
|
14
|
+
title,
|
|
15
|
+
secondTitle = "Helpful Links",
|
|
16
|
+
content = "",
|
|
17
|
+
links = [],
|
|
18
|
+
extraStyles = "",
|
|
19
|
+
titleVariant = "h3",
|
|
20
|
+
ariaLabel = "Contact Information",
|
|
21
|
+
linkVariant = "primary"
|
|
22
|
+
}) => {
|
|
23
|
+
const themeContext = useContext(ThemeContext);
|
|
24
|
+
const { isMobile } = themeContext;
|
|
25
|
+
const linkFallbackValues = { externalLinkColor: ROYAL_BLUE_VIVID };
|
|
26
|
+
const linkThemeValues = createThemeValues(
|
|
27
|
+
themeContext,
|
|
28
|
+
linkFallbackValues,
|
|
29
|
+
"Link",
|
|
30
|
+
linkVariant
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Styled.Container
|
|
35
|
+
borderRadius="8px"
|
|
36
|
+
boxShadow="0px 2px 4px rgba(0, 0, 0, 0.25)"
|
|
37
|
+
dataQa={createIdFromString(title, "contact-card")}
|
|
38
|
+
maxWidth={isMobile ? "100%" : "208px"}
|
|
39
|
+
minWidth={isMobile ? "240px" : "208px"}
|
|
40
|
+
minHeight="141px"
|
|
41
|
+
padding="1.5rem"
|
|
42
|
+
extraStyles={extraStyles}
|
|
43
|
+
role="complementary"
|
|
44
|
+
aria-label={ariaLabel}
|
|
45
|
+
>
|
|
46
|
+
<Stack
|
|
47
|
+
childGap="8px"
|
|
48
|
+
bottomItem={3}
|
|
49
|
+
justify="space-between"
|
|
50
|
+
style={{ width: "100%" }}
|
|
51
|
+
fullHeight
|
|
52
|
+
>
|
|
53
|
+
<Box padding={0} width="100%">
|
|
54
|
+
<Styled.Title
|
|
55
|
+
variant={titleVariant}
|
|
56
|
+
margin={0}
|
|
57
|
+
fontSize={FONT_SIZE.MD}
|
|
58
|
+
>
|
|
59
|
+
{title}
|
|
60
|
+
</Styled.Title>
|
|
61
|
+
</Box>
|
|
62
|
+
<Box padding={"0"} width="100%">
|
|
63
|
+
<Styled.Content>{content}</Styled.Content>
|
|
64
|
+
</Box>
|
|
65
|
+
</Stack>
|
|
66
|
+
{links.length > 0 && (
|
|
67
|
+
<>
|
|
68
|
+
<SolidDivider aria-hidden={true} />
|
|
69
|
+
<Stack
|
|
70
|
+
childGap={"8px"}
|
|
71
|
+
bottomItem={3}
|
|
72
|
+
justify="space-between"
|
|
73
|
+
style={{ width: "100%" }}
|
|
74
|
+
fullHeight
|
|
75
|
+
>
|
|
76
|
+
<Styled.Title
|
|
77
|
+
variant={titleVariant}
|
|
78
|
+
margin={0}
|
|
79
|
+
fontSize={FONT_SIZE.MD}
|
|
80
|
+
>
|
|
81
|
+
{secondTitle}
|
|
82
|
+
</Styled.Title>
|
|
83
|
+
<Stack
|
|
84
|
+
childGap={"4px"}
|
|
85
|
+
justify="space-between"
|
|
86
|
+
style={{ width: "100%" }}
|
|
87
|
+
fullHeight
|
|
88
|
+
>
|
|
89
|
+
{links.map(link => {
|
|
90
|
+
const linkID = createIdFromString(
|
|
91
|
+
link.text,
|
|
92
|
+
"contact-card-link"
|
|
93
|
+
);
|
|
94
|
+
return (
|
|
95
|
+
<ExternalLink
|
|
96
|
+
key={linkID}
|
|
97
|
+
dataQa={linkID}
|
|
98
|
+
href={link.link}
|
|
99
|
+
newTab={true}
|
|
100
|
+
extraStyles={`
|
|
101
|
+
flex-direction: row;
|
|
102
|
+
align-items: center;
|
|
103
|
+
align-content: flex-start;
|
|
104
|
+
justify-content: space-between;
|
|
105
|
+
`}
|
|
106
|
+
size={FONT_SIZE.SM}
|
|
107
|
+
lineHeight="1.313rem"
|
|
108
|
+
>
|
|
109
|
+
{link.text}
|
|
110
|
+
<ExternalLinkIcon
|
|
111
|
+
linkColor={linkThemeValues.externalLinkColor}
|
|
112
|
+
text={link.text}
|
|
113
|
+
/>
|
|
114
|
+
</ExternalLink>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
117
|
+
</Stack>
|
|
118
|
+
</Stack>
|
|
119
|
+
</>
|
|
120
|
+
)}
|
|
121
|
+
</Styled.Container>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export default ContactCard;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ContactCard from "./ContactCard";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Molecules/ContactCard",
|
|
6
|
+
component: ContactCard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered"
|
|
9
|
+
},
|
|
10
|
+
tags: ["!autodocs"],
|
|
11
|
+
args: {
|
|
12
|
+
title: "City Hall Payment Center",
|
|
13
|
+
extraStyles: "",
|
|
14
|
+
titleVariant: "h3"
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
title: {
|
|
18
|
+
description: "Text to display in the ContactCard's heading area",
|
|
19
|
+
table: {
|
|
20
|
+
type: { summary: "string" },
|
|
21
|
+
defaultValue: { summary: "City Hall Payment Center" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
content: {
|
|
25
|
+
description: "Text to display in the ContactCard's content area",
|
|
26
|
+
table: {
|
|
27
|
+
type: { summary: "string" },
|
|
28
|
+
defaultValue: { summary: "" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
links: {
|
|
32
|
+
description: "Array of links to display in the ContactCard",
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: "array" },
|
|
35
|
+
defaultValue: { summary: "[]" }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
extraStyles: {
|
|
39
|
+
description: "Extra styles to apply to the ContactCard",
|
|
40
|
+
table: {
|
|
41
|
+
type: { summary: "string" },
|
|
42
|
+
defaultValue: { summary: undefined }
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
titleVariant: {
|
|
46
|
+
description: "HTML element to use for heading element, default is h3",
|
|
47
|
+
table: {
|
|
48
|
+
type: { summary: "string" },
|
|
49
|
+
defaultValue: { summary: "h3" }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
|
|
57
|
+
export const BasicContactCard = {
|
|
58
|
+
args: {
|
|
59
|
+
title: "City Hall Payment Center",
|
|
60
|
+
content:
|
|
61
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod",
|
|
62
|
+
links: [
|
|
63
|
+
{
|
|
64
|
+
text: "Cityville Home",
|
|
65
|
+
link: "https://cityville-demos.uat.cityba.se/"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
text: "Contact Us",
|
|
69
|
+
link: "https://eunasolutions.com/contact-us/"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
render: args => {
|
|
74
|
+
return <ContactCard {...args} key="contact-card-basic" extraStyles={``} />;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import Heading from "../../atoms/heading";
|
|
3
|
+
import Stack from "../../atoms/layouts/Stack";
|
|
4
|
+
import { Box } from "../../atoms/layouts";
|
|
5
|
+
import {
|
|
6
|
+
FONT_SIZE,
|
|
7
|
+
FONT_WEIGHT_SEMIBOLD
|
|
8
|
+
} from "../../../constants/style_constants";
|
|
9
|
+
|
|
10
|
+
export const Container = styled(Box)`
|
|
11
|
+
height: fit-content;
|
|
12
|
+
display: flex;
|
|
13
|
+
padding: 1rem;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
gap: 1.5rem;
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export const Title = styled(Heading)`
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
-webkit-box-orient: vertical;
|
|
23
|
+
-webkit-line-clamp: 2;
|
|
24
|
+
align-self: stretch;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
background-color: transparent;
|
|
28
|
+
font-weight: ${FONT_WEIGHT_SEMIBOLD};
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const Content = styled(Box)`
|
|
32
|
+
padding: 0;
|
|
33
|
+
font-size: ${FONT_SIZE.SM};
|
|
34
|
+
line-height: 1.313rem;
|
|
35
|
+
overflow-wrap: normal;
|
|
36
|
+
letter-spacing: 0.14px;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
export const Footer = styled(Stack)`
|
|
40
|
+
width: 100%;
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
export const Divider = styled(Box)`
|
|
44
|
+
padding: 0;
|
|
45
|
+
height: 1px;
|
|
46
|
+
width: 100%;
|
|
47
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react";
|
|
2
|
+
import Expand from "../../../util/expand";
|
|
3
|
+
|
|
4
|
+
export interface ContactCardProps {
|
|
5
|
+
title?: string; // title 1
|
|
6
|
+
secondTitle?: string; // title 2
|
|
7
|
+
content?: any; // content
|
|
8
|
+
links?: any; // list of links
|
|
9
|
+
extraStyles?: string; // extra styles
|
|
10
|
+
titleVariant?: string; // title variant
|
|
11
|
+
ariaLabel?: string; // aria label
|
|
12
|
+
linkVariant?: string; // link variant
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const ContactCard: React.FC<Expand<ContactCardProps> &
|
|
16
|
+
HTMLAttributes<HTMLElement>>;
|
|
@@ -43,3 +43,4 @@ export { default as WelcomeModule } from "./welcome-module";
|
|
|
43
43
|
export { default as WorkflowTile } from "./workflow-tile";
|
|
44
44
|
export { default as PopupMenu } from "./popup-menu";
|
|
45
45
|
export { default as MultipleSelectFilter } from "./multiple-select-filter";
|
|
46
|
+
export { default as ContactCard } from "./contact-card";
|
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
import { themeComponent } from "../../../util/themeUtils";
|
|
17
17
|
import { fallbackValues } from "./TabSidebar.theme";
|
|
18
18
|
|
|
19
|
-
const TabSidebar = ({ links, isMobile, themeValues }) => (
|
|
19
|
+
const TabSidebar = ({ links, isMobile, themeValues, minHeight = "100%" }) => (
|
|
20
20
|
<Box
|
|
21
21
|
padding="0"
|
|
22
22
|
background={COOL_GREY_05}
|
|
23
|
-
minHeight=
|
|
23
|
+
minHeight={minHeight}
|
|
24
24
|
role="region"
|
|
25
25
|
aria-label="Profile tabs"
|
|
26
26
|
boxShadow={isMobile && `inset 0px -1px 0px 0px rgb(202, 206, 216)`}
|