@thecb/components 11.2.12 → 11.2.13-beta.0

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": "11.2.12",
3
+ "version": "11.2.13-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,6 +1,12 @@
1
1
  import React from "react";
2
+ import { MATISSE_BLUE } from "../../../constants/colors";
2
3
 
3
- const ExternalLinkIcon = ({ linkColor, text, ariaLabel = "External Link" }) => (
4
+ const ExternalLinkIcon = ({
5
+ linkColor = MATISSE_BLUE,
6
+ text,
7
+ ariaLabel = "External Link",
8
+ ...rest
9
+ }) => (
4
10
  <svg
5
11
  width="14"
6
12
  height="14"
@@ -8,6 +14,7 @@ const ExternalLinkIcon = ({ linkColor, text, ariaLabel = "External Link" }) => (
8
14
  fill="none"
9
15
  xmlns="http://www.w3.org/2000/svg"
10
16
  aria-label={ariaLabel}
17
+ {...rest}
11
18
  >
12
19
  <path
13
20
  fillRule="evenodd"
@@ -4,7 +4,6 @@ import { fallbackValues } from "./Link.theme";
4
4
  import { createThemeValues } from "../../../util/themeUtils";
5
5
  import { StyledInternalLink } from "./InternalLink.styled";
6
6
  import { safeChildren } from "../../../util/general";
7
- import { LINK_TEXT_DECORATION } from "../../../constants/style_constants";
8
7
 
9
8
  const InternalLink = forwardRef(
10
9
  (
@@ -21,7 +20,11 @@ const InternalLink = forwardRef(
21
20
  tabIndex = "0",
22
21
  dataQa,
23
22
  extraStyles = ``,
24
- isUnderlined = true
23
+ underlined = true,
24
+ hoverUnderline = true,
25
+ extraHoverStyles = ``,
26
+ extraActiveStyles = ``,
27
+ extraFocusStyles = ``
25
28
  },
26
29
  ref
27
30
  ) => {
@@ -46,9 +49,12 @@ const InternalLink = forwardRef(
46
49
  hoverColor={themeValues.hoverColor}
47
50
  activeColor={themeValues.activeColor}
48
51
  tabIndex={tabIndex}
49
- extrastyles={`text-decoration: ${
50
- isUnderlined ? LINK_TEXT_DECORATION : "none"
51
- }; ${extraStyles}`}
52
+ underlined={underlined}
53
+ hoverUnderline={hoverUnderline}
54
+ extrastyles={extraStyles}
55
+ extraHoverStyles={extraHoverStyles}
56
+ extraActiveStyles={extraActiveStyles}
57
+ extraFocusStyles={extraFocusStyles}
52
58
  data-qa={dataQa}
53
59
  ref={ref}
54
60
  >
@@ -15,7 +15,19 @@ const { LINK_TEXT_DECORATION } = styleConstants;
15
15
  export const StyledInternalLink = styled(
16
16
  forwardRef(
17
17
  (
18
- { hoverColor, activeColor, active, color, extrastyles, ...props },
18
+ {
19
+ hoverColor,
20
+ activeColor,
21
+ active,
22
+ color,
23
+ extrastyles,
24
+ underlined,
25
+ hoverUnderline,
26
+ extraHoverStyles,
27
+ extraActiveStyles,
28
+ extraFocusStyles,
29
+ ...props
30
+ },
19
31
  ref
20
32
  ) => <Link {...props} ref={ref} />
21
33
  )
@@ -28,21 +40,27 @@ export const StyledInternalLink = styled(
28
40
  font-size: ${({ fontSize }) => fontSize};
29
41
  font-family: ${({ fontFamily }) => fontFamily};
30
42
  margin: ${({ margin }) => margin};
31
- text-decoration: ${LINK_TEXT_DECORATION};
43
+ text-decoration: ${({ underlined }) =>
44
+ underlined ? LINK_TEXT_DECORATION : "none"};
32
45
 
33
46
  &:hover {
34
47
  color: ${({ hoverColor }) => hoverColor};
35
- text-decoration: ${LINK_TEXT_DECORATION};
48
+ text-decoration: ${({ hoverUnderline }) =>
49
+ hoverUnderline ? LINK_TEXT_DECORATION : "none"};
50
+ ${({ extraHoverStyles }) => extraHoverStyles}
36
51
  }
37
52
 
38
53
  &:focus {
39
54
  outline: 3px solid ${ROYAL_BLUE};
40
55
  outline-offset: 2px;
41
- text-decoration: ${LINK_TEXT_DECORATION};
56
+ text-decoration: ${({ hoverUnderline }) =>
57
+ hoverUnderline ? LINK_TEXT_DECORATION : "none"};
58
+ ${({ extraFocusStyles }) => extraFocusStyles}
42
59
  }
43
60
 
44
61
  &:active {
45
62
  color: ${({ activeColor }) => activeColor};
63
+ ${({ extraActiveStyles }) => extraActiveStyles}
46
64
  }
47
65
 
48
66
  ${({ extrastyles }) => extrastyles}
@@ -158,6 +158,18 @@ export const StandardInternalLink = {
158
158
  }
159
159
  };
160
160
 
161
+ export const InternalLinkNoUnderline = {
162
+ render: args => (
163
+ <InternalLink {...args} underlined={false}>
164
+ Cityville Activities Calendar
165
+ </InternalLink>
166
+ ),
167
+ args: {
168
+ active: true,
169
+ to: "/activities-calendar"
170
+ }
171
+ };
172
+
161
173
  export const StandardExternalLink = {
162
174
  render: args => <ExternalLink {...args}>Austin City Hall</ExternalLink>
163
175
  };
@@ -5,6 +5,7 @@ import { fallbackValues } from "./LinkCard.theme";
5
5
  import { ThemeContext } from "styled-components";
6
6
  import * as Styled from "./LinkCard.styled";
7
7
  import { noop } from "../../../util/general";
8
+ import ExternalLinkIcon from "../../atoms/icons/ExternalLinkIcon";
8
9
 
9
10
  const LinkCard = ({
10
11
  title = "Test Workflow",
@@ -21,7 +22,8 @@ const LinkCard = ({
21
22
  themeValues,
22
23
  titleVariant = "h3",
23
24
  titlePadding = "0",
24
- disabled = false
25
+ disabled = false,
26
+ isExternalLink = false
25
27
  }) => {
26
28
  const { isMobile } = useContext(ThemeContext);
27
29
  const regex = /\W/g;
@@ -53,7 +55,7 @@ const LinkCard = ({
53
55
  style={{ width: "100%" }}
54
56
  fullHeight
55
57
  >
56
- <Box padding={titlePadding} width="100%">
58
+ <Stack direction="row" childGap="0.5rem">
57
59
  <Styled.Title
58
60
  variant={titleVariant}
59
61
  theme={themeValues}
@@ -62,7 +64,14 @@ const LinkCard = ({
62
64
  >
63
65
  {title}
64
66
  </Styled.Title>
65
- </Box>
67
+ {isExternalLink && (
68
+ <ExternalLinkIcon
69
+ linkColor={themeValues.color}
70
+ text={locatorSlug}
71
+ style={{ height: "1.125rem", width: "1.125rem" }}
72
+ />
73
+ )}
74
+ </Stack>
66
75
  <Box padding={subtitlePadding} width="100%">
67
76
  <Styled.Subtitle
68
77
  variant="pS"
@@ -33,7 +33,8 @@ const meta = {
33
33
  extraActiveStyles: "",
34
34
  extraHoverStyles: "",
35
35
  titleVariant: "h3",
36
- disabled: false
36
+ disabled: false,
37
+ isExternalLink: false
37
38
  },
38
39
  argTypes: {
39
40
  title: {
@@ -121,6 +122,14 @@ const meta = {
121
122
  type: { summary: "boolean" },
122
123
  defaultValue: { summary: false }
123
124
  }
125
+ },
126
+ iseExternalLink: {
127
+ description:
128
+ "Whether the LinkCard uses an external link, default is internal",
129
+ table: {
130
+ type: { summary: "boolean" },
131
+ defaultValue: { summary: false }
132
+ }
124
133
  }
125
134
  }
126
135
  };
@@ -184,6 +193,64 @@ export const BasicLinkCard = {
184
193
  }
185
194
  };
186
195
 
196
+ export const ExternalLinkCard = {
197
+ args: {
198
+ title: "Construction Permits",
199
+ subtitle: "Cityville Department of Building Inspection"
200
+ },
201
+ render: args => {
202
+ return (
203
+ <LinkCard
204
+ {...args}
205
+ key="link-card-basic"
206
+ extraStyles={`transition: all .2s ease-in-out;`}
207
+ extraHoverStyles={`.show-on-hover {opacity: 1}`}
208
+ showLeft={false}
209
+ leftContent={
210
+ <Badge
211
+ label="Autopay Available"
212
+ variant={"success"}
213
+ Icon={() =>
214
+ AutopayIcon({
215
+ fill: SEA_GREEN
216
+ })
217
+ }
218
+ />
219
+ }
220
+ showRight={true}
221
+ rightContent={
222
+ <Box
223
+ data-qa={`find-or-pay`}
224
+ extraStyles={`
225
+ display: flex;
226
+ gap: 6px;
227
+ justify-content: space-between;
228
+ align-items: center;
229
+ `}
230
+ padding="0"
231
+ hoverStyles=".show-on-hover {opacity: 1;}"
232
+ >
233
+ <Text
234
+ variant="pS"
235
+ className="show-on-hover"
236
+ color={ROYAL_BLUE_VIVID}
237
+ id={`workflow`}
238
+ extraStyles={`
239
+ transition: opacity .2s ease-in-out;
240
+ opacity: 0
241
+ `}
242
+ >
243
+ {"Pay"}
244
+ </Text>
245
+ <ArrowRightIcon labelledBy={`workflow`} color={ROYAL_BLUE_VIVID} />
246
+ </Box>
247
+ }
248
+ isExternalLink={true}
249
+ />
250
+ );
251
+ }
252
+ };
253
+
187
254
  export const CompleteLinkCard = {
188
255
  args: {
189
256
  title: "Water Bills - Autopay",
@@ -35,9 +35,9 @@ const TabSidebar = ({ links, isMobile, themeValues, minHeight = "100%" }) => (
35
35
  <InternalLink
36
36
  to={route}
37
37
  key={`${route}-${index}`}
38
- extraStyles={`text-decoration: none;
38
+ isUnderlined={false}
39
+ extraStyles={`
39
40
  &:hover {
40
- text-decoration: none;
41
41
  ${
42
42
  active
43
43
  ? `> * {