@thecb/components 12.0.0-beta.2 → 12.0.0-beta.3

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": "12.0.0-beta.2",
3
+ "version": "12.0.0-beta.3",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -4,8 +4,9 @@ import { themeComponent } from "../../../util/themeUtils";
4
4
  import { fallbackValues } from "./LinkCard.theme";
5
5
  import { ThemeContext } from "styled-components";
6
6
  import * as Styled from "./LinkCard.styled";
7
+ import { noop } from "../../../util/general";
7
8
  import ExternalLinkIcon from "../../atoms/icons/ExternalLinkIcon";
8
- import { SPACING } from "../../../constants/style_constants";
9
+ import { Link } from "react-router-dom";
9
10
 
10
11
  const LinkCard = ({
11
12
  title = "Test Workflow",
@@ -15,33 +16,32 @@ const LinkCard = ({
15
16
  leftContent,
16
17
  showRight,
17
18
  rightContent,
19
+ href,
18
20
  extraStyles = "",
19
21
  extraHoverStyles = "",
20
22
  extraActiveStyles = "",
21
23
  themeValues,
22
24
  titleVariant = "h3",
23
25
  disabled = false,
24
- isExternalLink = false,
25
- href = ""
26
+ isExternalLink = false
26
27
  }) => {
27
28
  const { isMobile } = useContext(ThemeContext);
28
29
  const regex = /\W/g;
29
30
  const locatorSlug = title?.toLowerCase?.()?.replaceAll?.(regex, "-");
30
31
 
31
32
  return (
32
- <Styled.Container
33
- as="a"
33
+ <Styled.LinkWrapper
34
+ as={Link}
35
+ to={disabled ? undefined : href}
34
36
  role="link"
35
- href={disabled ? undefined : href}
36
- tabIndex={disabled ? -1 : 0}
37
- borderRadius="8px"
37
+ isMobile={isMobile}
38
38
  dataQa={`link-card-${locatorSlug}`}
39
- themeValues={themeValues}
39
+ theme={themeValues}
40
40
  extraStyles={extraStyles}
41
41
  hoverStyles={extraHoverStyles}
42
42
  activeStyles={extraActiveStyles}
43
43
  aria-disabled={disabled}
44
- disabled={disabled}
44
+ isDisabled={disabled}
45
45
  aria-label={`${title}, ${subtitle}`}
46
46
  >
47
47
  <Stack
@@ -58,9 +58,9 @@ const LinkCard = ({
58
58
  >
59
59
  <Styled.Title
60
60
  variant={titleVariant}
61
- themeValues={themeValues}
61
+ theme={themeValues}
62
62
  margin={0}
63
- disabled={disabled}
63
+ isDisabled={disabled}
64
64
  >
65
65
  {title}
66
66
  </Styled.Title>
@@ -75,8 +75,8 @@ const LinkCard = ({
75
75
  <Box padding={subtitlePadding} width="100%">
76
76
  <Styled.Subtitle
77
77
  variant="pS"
78
- themeValues={themeValues}
79
- disabled={disabled}
78
+ theme={themeValues}
79
+ isDisabled={disabled}
80
80
  >
81
81
  {subtitle}
82
82
  </Styled.Subtitle>
@@ -98,7 +98,7 @@ const LinkCard = ({
98
98
  </Styled.Footer>
99
99
  </Box>
100
100
  </Stack>
101
- </Styled.Container>
101
+ </Styled.LinkWrapper>
102
102
  );
103
103
  };
104
104
 
@@ -1,12 +1,11 @@
1
1
  import React from "react";
2
- import { Grid } from "../../atoms/layouts";
3
2
  import {
4
3
  COOL_GREY_05,
5
4
  MANATEE_GREY,
6
5
  ROYAL_BLUE_VIVID,
7
6
  SEA_GREEN
8
7
  } from "../../../constants/colors";
9
- import { Box } from "../../atoms/layouts";
8
+ import { Box, Grid } from "../../atoms/layouts";
10
9
  import LinkCard from "./LinkCard";
11
10
  import Badge from "../../atoms/badge/Badge";
12
11
  import AutopayIcon from "../../atoms/icons/AutopayIcon";
@@ -28,7 +27,7 @@ const meta = {
28
27
  leftContent: undefined,
29
28
  showRight: undefined,
30
29
  rightContent: undefined,
31
- href: "#",
30
+ href: "/example",
32
31
  extraStyles: "",
33
32
  extraActiveStyles: "",
34
33
  extraHoverStyles: "",
@@ -80,10 +79,10 @@ const meta = {
80
79
  }
81
80
  },
82
81
  href: {
83
- description: "URL or path the LinkCard navigates to",
82
+ description: "Route path the LinkCard navigates to",
84
83
  table: {
85
84
  type: { summary: "string" },
86
- defaultValue: { summary: "" }
85
+ defaultValue: { summary: undefined }
87
86
  }
88
87
  },
89
88
  extraStyles: {
@@ -125,7 +124,7 @@ const meta = {
125
124
  },
126
125
  isExternalLink: {
127
126
  description:
128
- "Whether the link associated with the LinkCard is external or not. External links have an external link icon displayed in the top right corner.",
127
+ "Whether the LinkCard uses an external link, default is internal",
129
128
  table: {
130
129
  type: { summary: "boolean" },
131
130
  defaultValue: { summary: false }
@@ -198,7 +197,7 @@ export const ExternalLinkCard = {
198
197
  args: {
199
198
  title: "Construction Permits",
200
199
  subtitle: "Cityville Department of Building Inspection",
201
- href: "https://example.com/construction-permits"
200
+ href: "/construction-permits"
202
201
  },
203
202
  render: args => {
204
203
  return (
@@ -253,165 +252,10 @@ export const ExternalLinkCard = {
253
252
  }
254
253
  };
255
254
 
256
- export const GridOfLinkCards = {
257
- args: {
258
- title: "Water Bills - Autopay",
259
- subtitle: "Cityville Water Management",
260
- href: "/water-bills"
261
- },
262
- render: args => {
263
- return (
264
- <Grid columnGap="40px">
265
- <LinkCard
266
- {...args}
267
- extraStyles={`transition: all .2s ease-in-out;`}
268
- extraHoverStyles={`.show-on-hover {opacity: 1}`}
269
- showLeft={true}
270
- leftContent={
271
- <Badge
272
- label="Autopay Available"
273
- variant={"success"}
274
- Icon={() =>
275
- AutopayIcon({
276
- fill: SEA_GREEN
277
- })
278
- }
279
- />
280
- }
281
- showRight={true}
282
- rightContent={
283
- <Box
284
- extraStyles={`
285
- display: flex;
286
- gap: 6px;
287
- justify-content: space-between;
288
- align-items: center;
289
- `}
290
- padding="0"
291
- hoverStyles=".show-on-hover {opacity: 1;}"
292
- >
293
- <Text
294
- variant="pS"
295
- className="show-on-hover"
296
- color={ROYAL_BLUE_VIVID}
297
- id={`workflow-two`}
298
- extraStyles={`
299
- transition: opacity .2s ease-in-out;
300
- opacity: 0
301
- `}
302
- >
303
- {"Find"}
304
- </Text>
305
- <PlusCircleIcon
306
- labelledBy={`workflow-two`}
307
- color={ROYAL_BLUE_VIVID}
308
- />
309
- </Box>
310
- }
311
- />
312
- <LinkCard
313
- {...args}
314
- extraStyles={`transition: all .2s ease-in-out;`}
315
- extraHoverStyles={`.show-on-hover {opacity: 1}`}
316
- showLeft={true}
317
- leftContent={
318
- <Badge
319
- label="Autopay Available"
320
- variant={"success"}
321
- Icon={() =>
322
- AutopayIcon({
323
- fill: SEA_GREEN
324
- })
325
- }
326
- />
327
- }
328
- showRight={true}
329
- rightContent={
330
- <Box
331
- extraStyles={`
332
- display: flex;
333
- gap: 6px;
334
- justify-content: space-between;
335
- align-items: center;
336
- `}
337
- padding="0"
338
- hoverStyles=".show-on-hover {opacity: 1;}"
339
- >
340
- <Text
341
- variant="pS"
342
- className="show-on-hover"
343
- color={ROYAL_BLUE_VIVID}
344
- id={`workflow-two`}
345
- extraStyles={`
346
- transition: opacity .2s ease-in-out;
347
- opacity: 0
348
- `}
349
- >
350
- {"Find"}
351
- </Text>
352
- <PlusCircleIcon
353
- labelledBy={`workflow-two`}
354
- color={ROYAL_BLUE_VIVID}
355
- />
356
- </Box>
357
- }
358
- />
359
- <LinkCard
360
- {...args}
361
- extraStyles={`transition: all .2s ease-in-out;`}
362
- extraHoverStyles={`.show-on-hover {opacity: 1}`}
363
- showLeft={true}
364
- leftContent={
365
- <Badge
366
- label="Autopay Available"
367
- variant={"success"}
368
- Icon={() =>
369
- AutopayIcon({
370
- fill: SEA_GREEN
371
- })
372
- }
373
- />
374
- }
375
- showRight={true}
376
- rightContent={
377
- <Box
378
- extraStyles={`
379
- display: flex;
380
- gap: 6px;
381
- justify-content: space-between;
382
- align-items: center;
383
- `}
384
- padding="0"
385
- hoverStyles=".show-on-hover {opacity: 1;}"
386
- >
387
- <Text
388
- variant="pS"
389
- className="show-on-hover"
390
- color={ROYAL_BLUE_VIVID}
391
- id={`workflow-two`}
392
- extraStyles={`
393
- transition: opacity .2s ease-in-out;
394
- opacity: 0
395
- `}
396
- >
397
- {"Find"}
398
- </Text>
399
- <PlusCircleIcon
400
- labelledBy={`workflow-two`}
401
- color={ROYAL_BLUE_VIVID}
402
- />
403
- </Box>
404
- }
405
- />
406
- </Grid>
407
- );
408
- }
409
- };
410
-
411
255
  export const CompleteLinkCard = {
412
256
  args: {
413
257
  title: "Water Bills - Autopay",
414
- subtitle: "Cityville Water Management",
258
+ subittle: "Cityville Water Management",
415
259
  href: "/water-bills"
416
260
  },
417
261
  render: args => {
@@ -526,3 +370,138 @@ export const DisabledLinkCard = {
526
370
  );
527
371
  }
528
372
  };
373
+
374
+ export const LinkCardGrid = {
375
+ render: () => {
376
+ const sharedStyles = `transition: all .2s ease-in-out;`;
377
+ const sharedHoverStyles = `.show-on-hover {opacity: 1}`;
378
+
379
+ const rightSlot = (id, label, Icon, color) => (
380
+ <Box
381
+ data-qa={`find-or-pay-${id}`}
382
+ extraStyles={`
383
+ display: flex;
384
+ gap: 6px;
385
+ justify-content: space-between;
386
+ align-items: center;
387
+ `}
388
+ padding="0"
389
+ hoverStyles=".show-on-hover {opacity: 1;}"
390
+ >
391
+ <Text
392
+ variant="pS"
393
+ className="show-on-hover"
394
+ color={color}
395
+ id={`workflow-${id}`}
396
+ extraStyles={`
397
+ transition: opacity .2s ease-in-out;
398
+ opacity: 0
399
+ `}
400
+ >
401
+ {label}
402
+ </Text>
403
+ <Icon labelledBy={`workflow-${id}`} color={color} />
404
+ </Box>
405
+ );
406
+
407
+ return (
408
+ <Grid minColWidth={18} columnGap="1rem">
409
+ <LinkCard
410
+ title="Construction Permits"
411
+ subtitle="Cityville Department of Building Inspection"
412
+ href="/construction-permits"
413
+ extraStyles={sharedStyles}
414
+ extraHoverStyles={sharedHoverStyles}
415
+ showRight={true}
416
+ rightContent={rightSlot(
417
+ "permits",
418
+ "Pay",
419
+ ArrowRightIcon,
420
+ ROYAL_BLUE_VIVID
421
+ )}
422
+ />
423
+ <LinkCard
424
+ title="Water Bills"
425
+ subtitle="Cityville Water Management"
426
+ href="/water-bills"
427
+ extraStyles={sharedStyles}
428
+ extraHoverStyles={sharedHoverStyles}
429
+ showLeft={true}
430
+ leftContent={
431
+ <Badge
432
+ label="Autopay Available"
433
+ variant="success"
434
+ Icon={() => AutopayIcon({ fill: SEA_GREEN })}
435
+ />
436
+ }
437
+ showRight={true}
438
+ rightContent={rightSlot(
439
+ "water",
440
+ "Find",
441
+ PlusCircleIcon,
442
+ ROYAL_BLUE_VIVID
443
+ )}
444
+ />
445
+ <LinkCard
446
+ title="Property Tax"
447
+ subtitle="Cityville Revenue Department"
448
+ href="/property-tax"
449
+ extraStyles={sharedStyles}
450
+ extraHoverStyles={sharedHoverStyles}
451
+ showRight={true}
452
+ rightContent={rightSlot(
453
+ "tax",
454
+ "Pay",
455
+ ArrowRightIcon,
456
+ ROYAL_BLUE_VIVID
457
+ )}
458
+ isExternalLink={true}
459
+ />
460
+ <LinkCard
461
+ title="Business Licenses"
462
+ subtitle="Cityville Commerce Division"
463
+ href="/business-licenses"
464
+ extraStyles={sharedStyles}
465
+ extraHoverStyles={sharedHoverStyles}
466
+ showLeft={true}
467
+ leftContent={
468
+ <Badge
469
+ label="Autopay Available"
470
+ variant="success"
471
+ Icon={() => AutopayIcon({ fill: SEA_GREEN })}
472
+ />
473
+ }
474
+ showRight={true}
475
+ rightContent={rightSlot(
476
+ "licenses",
477
+ "Pay",
478
+ ArrowRightIcon,
479
+ ROYAL_BLUE_VIVID
480
+ )}
481
+ />
482
+ <LinkCard
483
+ title="Parking Fines"
484
+ subtitle="Cityville Transportation Authority"
485
+ href="/parking-fines"
486
+ disabled={true}
487
+ extraHoverStyles={`box-shadow: none; cursor: default; .show-on-hover {opacity: 0}`}
488
+ showLeft={true}
489
+ leftContent={
490
+ <Badge
491
+ label="Autopay Available"
492
+ variant="disabled"
493
+ Icon={() => AutopayIcon({ fill: MANATEE_GREY })}
494
+ />
495
+ }
496
+ showRight={true}
497
+ rightContent={rightSlot(
498
+ "parking",
499
+ "Find",
500
+ PlusCircleIcon,
501
+ COOL_GREY_05
502
+ )}
503
+ />
504
+ </Grid>
505
+ );
506
+ }
507
+ };
@@ -2,43 +2,44 @@ import styled from "styled-components";
2
2
  import Heading from "../../atoms/heading";
3
3
  import Paragraph from "../../atoms/paragraph";
4
4
  import Stack from "../../atoms/layouts/Stack";
5
- import { Box } from "../../atoms/layouts";
6
5
  import {
7
- SPACING,
8
- FONT_SIZE,
9
- BORDER_THIN,
10
- FONT_WEIGHT_REGULAR,
11
- FONT_WEIGHT_SEMIBOLD
6
+ FONT_WEIGHT_SEMIBOLD,
7
+ FONT_WEIGHT_REGULAR
12
8
  } from "../../../constants/style_constants";
9
+ import { Link } from "react-router-dom";
13
10
 
14
- export const Container = styled(Box)`
11
+ export const LinkWrapper = styled(Link)`
15
12
  display: flex;
16
13
  flex-direction: column;
17
14
  align-items: flex-start;
15
+ width: 100%;
16
+ gap: 40px;
17
+ flex-shrink: 0;
18
+ padding: 24px;
19
+ max-width: ${({ isMobile }) => (isMobile ? "100%" : "288px")};
20
+ min-width: ${({ isMobile }) => (isMobile ? "240px" : "288px")};
21
+ min-height: 141px;
18
22
  align-self: stretch;
19
23
  border-radius: 8px;
20
- padding: 24px;
21
- ${({ disabled, themeValues }) => `
24
+ text-decoration: none;
25
+ ${({ isDisabled, theme }) => `
22
26
  background-color: ${
23
- disabled
24
- ? themeValues.disabledBackgroundColor
25
- : themeValues.backgroundColor
27
+ isDisabled ? theme.disabledBackgroundColor : theme.backgroundColor
26
28
  };
27
29
  border: 1px solid ${
28
- disabled ? themeValues.disabledBorderColor : themeValues.borderColor
30
+ isDisabled ? theme.disabledBorderColor : theme.borderColor
29
31
  };
30
32
  `}
31
- text-decoration: none;
32
- transition: all 0.2s ease-in-out;
33
+ transition: all .2s ease-in-out;
33
34
 
34
- ${({ disabled, themeValues }) =>
35
- disabled
35
+ ${({ isDisabled, theme }) =>
36
+ isDisabled
36
37
  ? `
37
38
  &:hover,
38
39
  &:active {
39
40
  cursor: default;
40
41
  box-shadow: none;
41
- border: 1px solid ${themeValues.disabledBorderColor};
42
+ border: 1px solid ${theme.disabledBorderColor};
42
43
  }
43
44
  `
44
45
  : `
@@ -54,12 +55,12 @@ export const Container = styled(Box)`
54
55
  }
55
56
 
56
57
  &:hover:not(:active) {
57
- border: 1px solid ${themeValues.borderColor};
58
+ border: 1px solid ${theme.borderColor};
58
59
  }
59
60
 
60
61
  &:active {
61
- background-color: ${themeValues.activeBackgroundColor};
62
- border: ${BORDER_THIN} solid ${themeValues.borderColor};
62
+ background-color: ${theme.activeBackgroundColor};
63
+ border: 1px solid ${theme.borderColor};
63
64
  }
64
65
  `}
65
66
  `;
@@ -71,12 +72,12 @@ export const Title = styled(Heading)`
71
72
  align-self: stretch;
72
73
  overflow: hidden;
73
74
  text-overflow: ellipsis;
74
- font-size: ${FONT_SIZE.MD};
75
+ font-size: 16px;
75
76
  line-height: 150%;
76
77
  background-color: transparent;
77
78
  font-weight: ${FONT_WEIGHT_SEMIBOLD};
78
- ${({ disabled, themeValues }) =>
79
- `color: ${disabled ? themeValues.disabledColor : themeValues.color};`};
79
+ ${({ isDisabled, theme }) =>
80
+ `color: ${isDisabled ? theme.disabledColor : theme.color};`};
80
81
  `;
81
82
 
82
83
  export const Subtitle = styled(Paragraph)`
@@ -86,12 +87,12 @@ export const Subtitle = styled(Paragraph)`
86
87
  -webkit-box-orient: vertical;
87
88
  -webkit-line-clamp: 2;
88
89
  align-self: stretch;
89
- font-size: ${FONT_SIZE.SM};
90
+ font-size: 14px;
90
91
  line-height: 150%;
91
92
  letter-spacing: 0.14px;
92
93
  font-weight: ${FONT_WEIGHT_REGULAR};
93
- ${({ disabled, themeValues }) =>
94
- `color: ${disabled ? themeValues.disabledColor : themeValues.textColor};`};
94
+ ${({ isDisabled, theme }) =>
95
+ `color: ${isDisabled ? theme.disabledColor : theme.textColor};`};
95
96
  `;
96
97
 
97
98
  export const Footer = styled(Stack)`
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  CORNFLOWER_BLUE,
3
3
  LINK_WATER,
4
+ MOON_RAKER,
4
5
  ROYAL_BLUE_VIVID,
5
6
  MANATEE_GREY,
6
7
  GHOST_GREY,
7
- TRANSPARENT,
8
- BRIGHT_GREY
8
+ TRANSPARENT
9
9
  } from "../../../constants/colors";
10
10
 
11
11
  const disabledBackgroundColor = TRANSPARENT;
@@ -13,9 +13,8 @@ const disabledBorderColor = GHOST_GREY;
13
13
  const disabledColor = MANATEE_GREY;
14
14
  const activeBackgroundColor = CORNFLOWER_BLUE;
15
15
  const backgroundColor = LINK_WATER;
16
- const borderColor = MANATEE_GREY;
16
+ const borderColor = MOON_RAKER;
17
17
  const color = ROYAL_BLUE_VIVID;
18
- const textColor = BRIGHT_GREY;
19
18
 
20
19
  export const fallbackValues = {
21
20
  disabledBackgroundColor,
@@ -24,6 +23,5 @@ export const fallbackValues = {
24
23
  activeBackgroundColor,
25
24
  backgroundColor,
26
25
  borderColor,
27
- color,
28
- textColor
26
+ color
29
27
  };
@@ -10,13 +10,11 @@ export interface LinkCardProps {
10
10
  leftContent?: JSX.Element;
11
11
  showRight?: boolean;
12
12
  rightContent?: JSX.Element;
13
- href: string;
13
+ onClick: () => void;
14
14
  extraHoverStyles?: string;
15
15
  extraStyles?: string;
16
16
  extraActiveStyles?: string;
17
17
  titleVariant?: string;
18
- disabled?: boolean;
19
- isExternalLink?: boolean;
20
18
  }
21
19
 
22
20
  export const LinkCard: React.FC<Expand<LinkCardProps> &