@conduction/components 2.0.5 → 2.0.6

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/README.md CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
  - **Version 2**
6
6
 
7
+ - 2.0.6:
8
+ - Added optional icon with default icon to the primary and secondary button in NotificationPopUp
9
+ - Added a handleClick function to the DownloadCard;
10
+ - Added clickFunction, layoutClassName and renamed tag to label in the Tag component;
11
+ - Edited DetailsCard to accommodate changes made to Tag component;
12
+ - Edited RichContentCard to accommodate changes made to Tag component;
7
13
  - 2.0.5: wrong camelcase in npm publish/build fix;
8
14
  - 2.0.4: added layoutClassName to InfoCard;
9
15
  - 2.0.3: Bugfix: --conduction-container typo removed;
@@ -6,5 +6,5 @@ import { navigate } from "gatsby";
6
6
  import { ArrowRightIcon } from "@gemeente-denhaag/icons";
7
7
  import { Tag } from "../../tag/Tag";
8
8
  export const DetailsCard = ({ title, subHeader, introduction, link, tags, layoutClassName, }) => {
9
- return (_jsx("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), onClick: () => navigate(link.href), children: _jsxs("div", { className: styles.content, children: [_jsxs("div", { children: [_jsx("div", { className: styles.title, children: title }), _jsx("span", { className: styles.subHeader, children: subHeader })] }), tags && (_jsx("div", { className: styles.tags, children: tags.map((tag, idx) => (_jsx(Tag, { ...{ tag } }, idx))) })), _jsx("div", { className: styles.introduction, children: introduction }), _jsx("div", { className: styles.link, children: _jsx(Link, { icon: _jsx(ArrowRightIcon, {}), iconAlign: "start", children: link.label }) })] }) }));
9
+ return (_jsx("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), onClick: () => navigate(link.href), children: _jsxs("div", { className: styles.content, children: [_jsxs("div", { children: [_jsx("div", { className: styles.title, children: title }), _jsx("span", { className: styles.subHeader, children: subHeader })] }), tags && (_jsx("div", { className: styles.tags, children: tags.map((tag, idx) => (_jsx(Tag, { label: tag }, idx))) })), _jsx("div", { className: styles.introduction, children: introduction }), _jsx("div", { className: styles.link, children: _jsx(Link, { icon: _jsx(ArrowRightIcon, {}), iconAlign: "start", children: link.label }) })] }) }));
10
10
  };
@@ -5,6 +5,7 @@ interface DownloadCardProps {
5
5
  sizeKb: string;
6
6
  downloadLabel: string;
7
7
  layoutClassName?: string;
8
+ handleClick: () => any;
8
9
  }
9
10
  export declare const DownloadCard: React.FC<DownloadCardProps>;
10
11
  export {};
@@ -3,6 +3,6 @@ import * as styles from "./DownloadCard.module.css";
3
3
  import { DownloadIcon } from "@gemeente-denhaag/icons";
4
4
  import { Link } from "@gemeente-denhaag/components-react";
5
5
  import clsx from "clsx";
6
- export const DownloadCard = ({ icon, label, sizeKb, layoutClassName, downloadLabel }) => {
7
- return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: [_jsxs("div", { className: styles.content, children: [_jsx("div", { className: styles.icon, children: icon }), _jsxs("div", { children: [label, " (", sizeKb, "kb)"] })] }), _jsx(Link, { icon: _jsx(DownloadIcon, {}), iconAlign: "start", children: downloadLabel })] }));
6
+ export const DownloadCard = ({ icon, label, sizeKb, layoutClassName, downloadLabel, handleClick, }) => {
7
+ return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: [_jsxs("div", { className: styles.content, children: [_jsx("div", { className: styles.icon, children: icon }), _jsxs("div", { children: [label, " (", sizeKb, "kb)"] })] }), _jsx("div", { onClick: handleClick, children: _jsx(Link, { icon: _jsx(DownloadIcon, {}), iconAlign: "start", children: downloadLabel }) })] }));
8
8
  };
@@ -5,7 +5,7 @@ import * as styles from "./RichContentCard.module.css";
5
5
  import { ExternalLinkIcon, ArrowRightIcon } from "@gemeente-denhaag/icons";
6
6
  import { Tag } from "../../tag/Tag";
7
7
  export const RichContentCard = ({ link, labelsWithIcon, tags, contentLinks, linkIsExternal, }) => {
8
- return (_jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.link, onClick: () => navigate(link.href), children: _jsx(Link, { icon: linkIsExternal ? _jsx(ExternalLinkIcon, {}) : _jsx(ArrowRightIcon, {}), iconAlign: "start", children: link.label }) }), _jsx("div", { className: styles.labelsWithIcon, children: labelsWithIcon.map(({ label, icon }, idx) => (_jsx(LabelWithIcon, { ...{ label, icon } }, idx))) }), _jsx("div", { className: styles.tags, children: tags.map((tag, idx) => (_jsx(Tag, { ...{ tag } }, idx))) }), contentLinks && (_jsxs("div", { className: styles.contentLinks, children: [_jsx(Divider, {}), contentLinks.map(({ title, subTitle, href }, idx) => (_jsx(ContentLink, { ...{ title, subTitle, href } }, idx)))] }))] }));
8
+ return (_jsxs("div", { className: styles.container, children: [_jsx("div", { className: styles.link, onClick: () => navigate(link.href), children: _jsx(Link, { icon: linkIsExternal ? _jsx(ExternalLinkIcon, {}) : _jsx(ArrowRightIcon, {}), iconAlign: "start", children: link.label }) }), _jsx("div", { className: styles.labelsWithIcon, children: labelsWithIcon.map(({ label, icon }, idx) => (_jsx(LabelWithIcon, { ...{ label, icon } }, idx))) }), _jsx("div", { className: styles.tags, children: tags.map((tag, idx) => (_jsx(Tag, { label: tag }, idx))) }), contentLinks && (_jsxs("div", { className: styles.contentLinks, children: [_jsx(Divider, {}), contentLinks.map(({ title, subTitle, href }, idx) => (_jsx(ContentLink, { ...{ title, subTitle, href } }, idx)))] }))] }));
9
9
  };
10
10
  const LabelWithIcon = ({ label, icon }) => {
11
11
  return (_jsxs("div", { className: styles.labelWithIcon, children: [_jsx("span", { className: styles.labelWithIcon_icon, children: icon }), _jsx("span", { className: styles.labelWithIcon_label, children: label })] }));
@@ -6,10 +6,12 @@ export interface NotificationPopUpProps {
6
6
  hide: () => void;
7
7
  primaryButton: {
8
8
  label: string;
9
+ icon?: JSX.Element;
9
10
  handleClick: () => any;
10
11
  };
11
12
  secondaryButton?: {
12
13
  label: string;
14
+ icon?: JSX.Element;
13
15
  handleClick: () => any;
14
16
  };
15
17
  layoutClassName?: string;
@@ -16,7 +16,7 @@ export const NotificationPopUp = ({ title, description, isVisible, hide, primary
16
16
  setAnimationVisible(true);
17
17
  }, animationDuration);
18
18
  };
19
- const modal = (_jsx(StylesProvider, { children: _jsxs("div", { style: { animationDuration: `${animationDuration}ms` }, className: clsx(styles.modal, animationVisible && styles.visible, layoutClassName), children: [_jsx(Heading3, { children: title }), _jsx(Paragraph, { children: description }), _jsxs("div", { className: styles.buttons, children: [secondaryButton && (_jsx("div", { onClick: () => handleClick(secondaryButton.handleClick), children: _jsx(Link, { icon: _jsx(CloseIcon, {}), iconAlign: "start", children: secondaryButton.label }) })), _jsx(Button, { icon: _jsx(ArrowRightIcon, {}), onClick: () => handleClick(primaryButton.handleClick), children: primaryButton.label })] })] }) }));
19
+ const modal = (_jsx(StylesProvider, { children: _jsxs("div", { style: { animationDuration: `${animationDuration}ms` }, className: clsx(styles.modal, animationVisible && styles.visible, layoutClassName), children: [_jsx(Heading3, { children: title }), _jsx(Paragraph, { children: description }), _jsxs("div", { className: styles.buttons, children: [secondaryButton && (_jsx("div", { onClick: () => handleClick(secondaryButton.handleClick), children: _jsx(Link, { icon: secondaryButton.icon ?? _jsx(CloseIcon, {}), iconAlign: "start", children: secondaryButton.label }) })), _jsx(Button, { icon: primaryButton.icon ?? _jsx(ArrowRightIcon, {}), onClick: () => handleClick(primaryButton.handleClick), children: primaryButton.label })] })] }) }));
20
20
  return isVisible ? ReactDOM.createPortal(modal, document.body) : null;
21
21
  };
22
22
  export const NotificationPopUpController = () => {
@@ -1,6 +1,9 @@
1
1
  import * as React from "react";
2
2
  interface TagProps {
3
- tag: string;
3
+ label: string;
4
+ icon?: JSX.Element;
5
+ onClick?: () => any;
6
+ layoutClassName?: string;
4
7
  }
5
8
  export declare const Tag: React.FC<TagProps>;
6
9
  export {};
@@ -1,3 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as styles from "./Tag.module.css";
3
- export const Tag = ({ tag }) => _jsx("span", { className: styles.tag, children: tag });
3
+ import clsx from "clsx";
4
+ export const Tag = ({ label, icon, onClick, layoutClassName }) => (_jsxs("div", { className: clsx(styles.tag, [layoutClassName && layoutClassName], onClick && styles.clickable), ...{ onClick }, children: [icon && _jsx("span", { children: icon }), _jsx("span", { children: label })] }));
@@ -1,9 +1,10 @@
1
1
  :root {
2
2
  --conduction-tag-font-size: var(--skeleton-font-size-sm);
3
3
  --conduction-tag-color: var(--skeleton-black);
4
- --conduction-tag-backgrond-color: var(--skeleton-color-grey-1);
4
+ --conduction-tag-background-color: var(--skeleton-color-grey-1);
5
5
  --conduction-tag-border-radius: var(--skeleton-border-radius-md);
6
6
  --conduction-tag-padding: var(--skeleton-size-xs);
7
+ --conduction-tag-child-margin-inline: var(--skeleton-size-2xs);
7
8
  }
8
9
 
9
10
  .tag {
@@ -11,10 +12,18 @@
11
12
  width: fit-content;
12
13
  font-size: var(--conduction-tag-font-size);
13
14
  color: var(--conduction-tag-color);
14
- background-color: var(--conduction-tag-backgrond-color);
15
+ background-color: var(--conduction-tag-background-color);
15
16
  border-radius: var(--conduction-tag-border-radius);
16
17
  padding-inline-start: var(--conduction-tag-padding);
17
18
  padding-inline-end: var(--conduction-tag-padding);
18
19
  padding-block-start: var(--conduction-tag-padding);
19
20
  padding-block-end: var(--conduction-tag-padding);
20
21
  }
22
+
23
+ .tag > *:not(:last-child) {
24
+ margin-inline-end: var(--conduction-tag-child-margin-inline);
25
+ }
26
+
27
+ .clickable :hover {
28
+ cursor: pointer;
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -38,7 +38,7 @@ export const DetailsCard: React.FC<DetailsCardProps> = ({
38
38
  {tags && (
39
39
  <div className={styles.tags}>
40
40
  {tags.map((tag, idx) => (
41
- <Tag key={idx} {...{ tag }} />
41
+ <Tag key={idx} label={tag} />
42
42
  ))}
43
43
  </div>
44
44
  )}
@@ -10,9 +10,17 @@ interface DownloadCardProps {
10
10
  sizeKb: string;
11
11
  downloadLabel: string;
12
12
  layoutClassName?: string;
13
+ handleClick: () => any;
13
14
  }
14
15
 
15
- export const DownloadCard: React.FC<DownloadCardProps> = ({ icon, label, sizeKb, layoutClassName, downloadLabel }) => {
16
+ export const DownloadCard: React.FC<DownloadCardProps> = ({
17
+ icon,
18
+ label,
19
+ sizeKb,
20
+ layoutClassName,
21
+ downloadLabel,
22
+ handleClick,
23
+ }) => {
16
24
  return (
17
25
  <div className={clsx(styles.container, [layoutClassName && layoutClassName])}>
18
26
  <div className={styles.content}>
@@ -22,10 +30,11 @@ export const DownloadCard: React.FC<DownloadCardProps> = ({ icon, label, sizeKb,
22
30
  {label} ({sizeKb}kb)
23
31
  </div>
24
32
  </div>
25
-
26
- <Link icon={<DownloadIcon />} iconAlign="start">
27
- {downloadLabel}
28
- </Link>
33
+ <div onClick={handleClick}>
34
+ <Link icon={<DownloadIcon />} iconAlign="start">
35
+ {downloadLabel}
36
+ </Link>
37
+ </div>
29
38
  </div>
30
39
  );
31
40
  };
@@ -46,7 +46,7 @@ export const RichContentCard: React.FC<RichContentCardProps> = ({
46
46
 
47
47
  <div className={styles.tags}>
48
48
  {tags.map((tag, idx) => (
49
- <Tag key={idx} {...{ tag }} />
49
+ <Tag key={idx} label={tag} />
50
50
  ))}
51
51
  </div>
52
52
 
@@ -12,10 +12,12 @@ export interface NotificationPopUpProps {
12
12
  hide: () => void;
13
13
  primaryButton: {
14
14
  label: string;
15
+ icon?: JSX.Element;
15
16
  handleClick: () => any;
16
17
  };
17
18
  secondaryButton?: {
18
19
  label: string;
20
+ icon?: JSX.Element;
19
21
  handleClick: () => any;
20
22
  };
21
23
  layoutClassName?: string;
@@ -54,12 +56,15 @@ export const NotificationPopUp: React.FC<NotificationPopUpProps> = ({
54
56
  <div className={styles.buttons}>
55
57
  {secondaryButton && (
56
58
  <div onClick={() => handleClick(secondaryButton.handleClick)}>
57
- <Link icon={<CloseIcon />} iconAlign="start">
59
+ <Link icon={secondaryButton.icon ?? <CloseIcon />} iconAlign="start">
58
60
  {secondaryButton.label}
59
61
  </Link>
60
62
  </div>
61
63
  )}
62
- <Button icon={<ArrowRightIcon />} onClick={() => handleClick(primaryButton.handleClick)}>
64
+ <Button
65
+ icon={primaryButton.icon ?? <ArrowRightIcon />}
66
+ onClick={() => handleClick(primaryButton.handleClick)}
67
+ >
63
68
  {primaryButton.label}
64
69
  </Button>
65
70
  </div>
@@ -1,9 +1,10 @@
1
1
  :root {
2
2
  --conduction-tag-font-size: var(--skeleton-font-size-sm);
3
3
  --conduction-tag-color: var(--skeleton-black);
4
- --conduction-tag-backgrond-color: var(--skeleton-color-grey-1);
4
+ --conduction-tag-background-color: var(--skeleton-color-grey-1);
5
5
  --conduction-tag-border-radius: var(--skeleton-border-radius-md);
6
6
  --conduction-tag-padding: var(--skeleton-size-xs);
7
+ --conduction-tag-child-margin-inline: var(--skeleton-size-2xs);
7
8
  }
8
9
 
9
10
  .tag {
@@ -11,10 +12,18 @@
11
12
  width: fit-content;
12
13
  font-size: var(--conduction-tag-font-size);
13
14
  color: var(--conduction-tag-color);
14
- background-color: var(--conduction-tag-backgrond-color);
15
+ background-color: var(--conduction-tag-background-color);
15
16
  border-radius: var(--conduction-tag-border-radius);
16
17
  padding-inline-start: var(--conduction-tag-padding);
17
18
  padding-inline-end: var(--conduction-tag-padding);
18
19
  padding-block-start: var(--conduction-tag-padding);
19
20
  padding-block-end: var(--conduction-tag-padding);
20
21
  }
22
+
23
+ .tag > *:not(:last-child) {
24
+ margin-inline-end: var(--conduction-tag-child-margin-inline);
25
+ }
26
+
27
+ .clickable :hover {
28
+ cursor: pointer;
29
+ }
@@ -1,8 +1,17 @@
1
1
  import * as React from "react";
2
2
  import * as styles from "./Tag.module.css";
3
+ import clsx from "clsx";
3
4
 
4
5
  interface TagProps {
5
- tag: string;
6
+ label: string;
7
+ icon?: JSX.Element;
8
+ onClick?: () => any;
9
+ layoutClassName?: string;
6
10
  }
7
11
 
8
- export const Tag: React.FC<TagProps> = ({ tag }) => <span className={styles.tag}>{tag}</span>;
12
+ export const Tag: React.FC<TagProps> = ({ label, icon, onClick, layoutClassName }) => (
13
+ <div className={clsx(styles.tag, [layoutClassName && layoutClassName], onClick && styles.clickable)} {...{ onClick }}>
14
+ {icon && <span>{icon}</span>}
15
+ <span>{label}</span>
16
+ </div>
17
+ );