@purpurds/content-block 6.12.5 → 7.1.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.
@@ -1,6 +1,5 @@
1
1
  import React, { DetailedHTMLProps, HTMLAttributes, ReactNode } from "react";
2
2
  import { Badge } from "@purpurds/badge";
3
- import { CtaAnchorProps, CtaLink } from "@purpurds/cta-link";
4
3
  import { Heading, HeadingTagType } from "@purpurds/heading";
5
4
  import { IconCheckmark } from "@purpurds/icon/checkmark";
6
5
  import { Paragraph } from "@purpurds/paragraph";
@@ -12,23 +11,17 @@ import { ContentBlockGroup } from "./content-block-group";
12
11
  const cx = c.bind(styles);
13
12
  const rootClassName = "purpur-content-block";
14
13
 
15
- type Cta = Omit<CtaAnchorProps, "href" | "children" | "variant" | "negative" | "iconOnly"> & {
16
- href: string;
17
- text: string;
18
- };
19
-
20
14
  export type ContentBlockProps = {
21
15
  ["data-testid"]?: string;
22
16
  negative?: boolean;
23
17
  image?: ReactNode;
24
18
  video?: ReactNode;
25
19
  tagline?: string;
26
- ctas?: Cta[];
27
- usp?: string[];
20
+ actions?: ReactNode;
21
+ listItems?: string[];
28
22
  title?: string;
29
23
  headingTag?: HeadingTagType;
30
24
  headingVariant?: "title-100" | "title-200" | "title-300";
31
- onCtaClick?: (cta: Cta) => void;
32
25
  } & DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
33
26
 
34
27
  export const ContentBlock = ({
@@ -38,11 +31,10 @@ export const ContentBlock = ({
38
31
  video,
39
32
  tagline,
40
33
  title,
41
- ctas,
42
- usp,
34
+ actions,
35
+ listItems,
43
36
  headingTag = "h2",
44
37
  headingVariant = "title-300",
45
- onCtaClick,
46
38
  children,
47
39
  ...props
48
40
  }: ContentBlockProps) => {
@@ -71,47 +63,26 @@ export const ContentBlock = ({
71
63
  </Badge>
72
64
  ) : null}
73
65
 
74
- {title && title.trim() && (
66
+ {title?.trim() && (
75
67
  <Heading variant={headingVariant} tag={headingTag} negative={negative}>
76
68
  {title}
77
69
  </Heading>
78
70
  )}
79
71
  <div className={cx(`${rootClassName}__content`)}>{children}</div>
80
- {usp?.length ? (
81
- <ul className={cx(`${rootClassName}__usp-list`)}>
82
- {usp.map(
83
- (point) =>
84
- point && (
85
- <li className={cx(`${rootClassName}__usp-list-item`)} key={point}>
86
- <IconCheckmark
87
- size="xs"
88
- className={cx(`${rootClassName}__usp-list-item-icon`)}
89
- />
90
- <Paragraph negative={negative}>{point}</Paragraph>
72
+ {!!listItems?.length && (
73
+ <ul className={cx(`${rootClassName}__list`)}>
74
+ {listItems.map(
75
+ (item) =>
76
+ item && (
77
+ <li className={cx(`${rootClassName}__list-item`)} key={item}>
78
+ <IconCheckmark size="xs" className={cx(`${rootClassName}__list-item-icon`)} />
79
+ <Paragraph negative={negative}>{item}</Paragraph>
91
80
  </li>
92
81
  )
93
82
  )}
94
83
  </ul>
95
- ) : null}
96
- {ctas && ctas.length > 0 && (
97
- <div className={cx(`${rootClassName}__links`)}>
98
- {ctas.map(
99
- ({ text, href, ...ctaProps }, index) =>
100
- href && (
101
- <CtaLink
102
- key={text + href}
103
- href={href}
104
- variant={index === 0 ? "primary" : "secondary"}
105
- negative={negative}
106
- onClick={() => onCtaClick?.({ text, href, ...ctaProps })}
107
- {...ctaProps}
108
- >
109
- {text}
110
- </CtaLink>
111
- )
112
- )}
113
- </div>
114
84
  )}
85
+ {actions && <div className={cx(`${rootClassName}__actions`)}>{actions}</div>}
115
86
  </div>
116
87
  </div>
117
88
  </div>