@conduction/components 2.2.39 → 2.2.40

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,9 @@
4
4
 
5
5
  - **Version 2.2 (breaking changes from 2.1.x)**
6
6
 
7
+ - 2.2.40:
8
+ - Updated DownloadCard to only accept fontawesome icons.
9
+ - Removed tooltip from PrimaryTopNav component and updated dropdown.
7
10
  - 2.2.39:
8
11
  - Updated PrimaryTopNav component to include tooltip and better dropdown.
9
12
  - Updated Logo component to have navbar option.
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { IconDefinition } from "@fortawesome/free-solid-svg-icons";
2
3
  interface DownloadCardProps {
3
4
  label: string;
4
5
  size: string;
@@ -7,7 +8,7 @@ interface DownloadCardProps {
7
8
  id: string;
8
9
  tooltip: string;
9
10
  };
10
- icon?: JSX.Element;
11
+ icon?: IconDefinition;
11
12
  layoutClassName?: string;
12
13
  handleClick: () => any;
13
14
  }
@@ -43,5 +43,5 @@ export const DownloadCard = ({ icon, label, size, type, labelTooltip, layoutClas
43
43
  return faDatabase;
44
44
  }
45
45
  };
46
- return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: [_jsx("div", { className: styles.icon, children: icon ?? _jsx(FontAwesomeIcon, { icon: getIconFromType(type) }) }), _jsxs("div", { className: styles.content, children: [_jsx(Heading3, { "data-tooltip-id": labelTooltip && labelTooltip.id, "data-tooltip-content": labelTooltip && labelTooltip.tooltip, className: styles.title, children: label }), _jsxs("div", { children: ["(", _.toUpper(type), size && `, ${size}kB`, ")"] })] }), _jsxs(Link, { className: styles.link, href: "", onClick: (e) => onClick(e), children: [_jsx(FontAwesomeIcon, { className: styles.icon, icon: faDownload }), " Download"] })] }));
46
+ return (_jsxs("div", { className: clsx(styles.container, [layoutClassName && layoutClassName]), children: [_jsx("div", { className: styles.icon, children: _jsx(FontAwesomeIcon, { icon: icon ?? getIconFromType(type) }) }), _jsxs("div", { className: styles.content, children: [_jsx(Heading3, { "data-tooltip-id": labelTooltip && labelTooltip.id, "data-tooltip-content": labelTooltip && labelTooltip.tooltip, className: styles.title, children: label }), _jsxs("div", { children: ["(", _.toUpper(type), size && `, ${size}kB`, ")"] })] }), _jsxs(Link, { className: styles.link, href: "", onClick: (e) => onClick(e), children: [_jsx(FontAwesomeIcon, { className: styles.icon, icon: faDownload }), " Download"] })] }));
47
47
  };
@@ -2,7 +2,6 @@
2
2
  interface ITopNavItemBase {
3
3
  label: string;
4
4
  icon?: JSX.Element;
5
- showToolTip?: boolean;
6
5
  current?: boolean | ICurrentItemJSONFormat;
7
6
  }
8
7
  interface ICurrentItemJSONFormat {
@@ -33,9 +32,8 @@ interface ITopNavItemWithoutSubItems extends ITopNavItemBase {
33
32
  export type ITopNavItem = ITopNavItemWithSubItems | ITopNavItemWithoutSubItems;
34
33
  export interface TopNavProps {
35
34
  items: ITopNavItem[];
36
- tooltipId: string;
37
35
  mobileLogo?: JSX.Element;
38
36
  layoutClassName?: string;
39
37
  }
40
- export declare const PrimaryTopNav: ({ items, mobileLogo, layoutClassName, tooltipId }: TopNavProps) => JSX.Element;
38
+ export declare const PrimaryTopNav: ({ items, mobileLogo, layoutClassName }: TopNavProps) => JSX.Element;
41
39
  export {};
@@ -5,7 +5,7 @@ import clsx from "clsx";
5
5
  import { Link } from "@utrecht/component-library-react/dist/css-module";
6
6
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
7
7
  import { faBars, faChevronRight } from "@fortawesome/free-solid-svg-icons";
8
- export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName, tooltipId }) => {
8
+ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }) => {
9
9
  const [isOpen, setIsOpen] = React.useState(false);
10
10
  const [isMobile, setIsMobile] = React.useState(window.innerWidth < 992);
11
11
  React.useEffect(() => {
@@ -19,5 +19,5 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName, tooltipId })
19
19
  setIsOpen(false);
20
20
  handleClick();
21
21
  };
22
- return (_jsxs("div", { className: clsx(styles.container, layoutClassName && layoutClassName), children: [_jsxs("div", { className: styles.menuToggleContainer, children: [mobileLogo, _jsx("button", { className: styles.menuToggle, onClick: () => setIsOpen((o) => !o), children: _jsx(FontAwesomeIcon, { icon: faBars }) })] }), _jsx("nav", { className: clsx(styles.primary, isOpen && styles.isOpen), children: _jsx("ul", { className: styles.ul, children: items.map(({ label, icon, current, handleClick, subItems }, idx) => (_jsxs("li", { onClick: handleClick, className: clsx(styles.li, current && styles.current), children: [_jsxs(Link, { className: clsx(styles.link, styles.label, subItems && styles.mobileLink, current && styles.currentLink), children: [icon && icon, label, " ", subItems && isMobile && _jsx(FontAwesomeIcon, { className: styles.toggleIcon, icon: faChevronRight })] }), subItems && (_jsx("ul", { className: clsx(styles.dropdown, [subItems.length > 8 && styles.dropdownOverflow]), children: subItems.map(({ label, icon, current, handleClick, showToolTip }, idx) => (_jsx("li", { className: clsx(styles.li, current && styles.current), onClick: () => handleSubItemClick(handleClick), children: _jsxs(Link, { "data-tooltip-id": showToolTip === true ? tooltipId : "", "data-tooltip-content": showToolTip === true ? label : "", className: clsx(styles.link, styles.label, current && styles.currentLink), children: [icon, label] }) }, idx))) }))] }, idx))) }) })] }));
22
+ return (_jsxs("div", { className: clsx(styles.container, layoutClassName && layoutClassName), children: [_jsxs("div", { className: styles.menuToggleContainer, children: [mobileLogo, _jsx("button", { className: styles.menuToggle, onClick: () => setIsOpen((o) => !o), children: _jsx(FontAwesomeIcon, { icon: faBars }) })] }), _jsx("nav", { className: clsx(styles.primary, isOpen && styles.isOpen), children: _jsx("ul", { className: styles.ul, children: items.map(({ label, icon, current, handleClick, subItems }, idx) => (_jsxs("li", { onClick: handleClick, className: clsx(styles.li, current && styles.current), children: [_jsxs(Link, { className: clsx(styles.link, styles.label, subItems && styles.mobileLink, current && styles.currentLink), children: [icon && icon, label, " ", subItems && isMobile && _jsx(FontAwesomeIcon, { className: styles.toggleIcon, icon: faChevronRight })] }), subItems && (_jsx("ul", { className: clsx(styles.dropdown, [subItems.length > 8 && styles.dropdownOverflow]), children: subItems.map(({ label, icon, current, handleClick }, idx) => (_jsx("li", { className: clsx(styles.li, current && styles.current), onClick: () => handleSubItemClick(handleClick), children: _jsxs(Link, { className: clsx(styles.link, styles.label, current && styles.currentLink), children: [icon, label] }) }, idx))) }))] }, idx))) }) })] }));
23
23
  };
@@ -157,6 +157,8 @@
157
157
  display: none;
158
158
  list-style-type: none;
159
159
  background-color: var(--conduction-primary-top-nav-dropdown-background-color, var(--conduction-primary-top-nav-background-color));
160
+ width: fit-content;
161
+ max-width: 200px;
160
162
  }
161
163
 
162
164
  .dropdownOverflow {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.2.39",
3
+ "version": "2.2.40",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -5,6 +5,7 @@ import clsx from "clsx";
5
5
  import { Heading3, Link } from "@utrecht/component-library-react/dist/css-module";
6
6
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
7
7
  import {
8
+ IconDefinition,
8
9
  faDatabase,
9
10
  faDownload,
10
11
  faFileAudio,
@@ -24,7 +25,7 @@ interface DownloadCardProps {
24
25
  id: string;
25
26
  tooltip: string;
26
27
  };
27
- icon?: JSX.Element;
28
+ icon?: IconDefinition;
28
29
  layoutClassName?: string;
29
30
  handleClick: () => any;
30
31
  }
@@ -79,7 +80,7 @@ export const DownloadCard = ({
79
80
 
80
81
  return (
81
82
  <div className={clsx(styles.container, [layoutClassName && layoutClassName])}>
82
- <div className={styles.icon}>{icon ?? <FontAwesomeIcon icon={getIconFromType(type)} />}</div>
83
+ <div className={styles.icon}>{<FontAwesomeIcon icon={icon ?? getIconFromType(type)} />}</div>
83
84
  <div className={styles.content}>
84
85
  <Heading3
85
86
  data-tooltip-id={labelTooltip && labelTooltip.id}
@@ -157,6 +157,8 @@
157
157
  display: none;
158
158
  list-style-type: none;
159
159
  background-color: var(--conduction-primary-top-nav-dropdown-background-color, var(--conduction-primary-top-nav-background-color));
160
+ width: fit-content;
161
+ max-width: 200px;
160
162
  }
161
163
 
162
164
  .dropdownOverflow {
@@ -9,7 +9,6 @@ import { IconPrefix, IconName } from "@fortawesome/fontawesome-svg-core";
9
9
  interface ITopNavItemBase {
10
10
  label: string;
11
11
  icon?: JSX.Element;
12
- showToolTip?: boolean;
13
12
  current?: boolean | ICurrentItemJSONFormat;
14
13
  }
15
14
 
@@ -58,12 +57,11 @@ export type ITopNavItem = ITopNavItemWithSubItems | ITopNavItemWithoutSubItems;
58
57
 
59
58
  export interface TopNavProps {
60
59
  items: ITopNavItem[];
61
- tooltipId: string;
62
60
  mobileLogo?: JSX.Element;
63
61
  layoutClassName?: string;
64
62
  }
65
63
 
66
- export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName, tooltipId }: TopNavProps): JSX.Element => {
64
+ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProps): JSX.Element => {
67
65
  const [isOpen, setIsOpen] = React.useState<boolean>(false);
68
66
  const [isMobile, setIsMobile] = React.useState<boolean>(window.innerWidth < 992);
69
67
 
@@ -112,17 +110,13 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName, tooltipId }:
112
110
 
113
111
  {subItems && (
114
112
  <ul className={clsx(styles.dropdown, [subItems.length > 8 && styles.dropdownOverflow])}>
115
- {subItems.map(({ label, icon, current, handleClick, showToolTip }, idx) => (
113
+ {subItems.map(({ label, icon, current, handleClick }, idx) => (
116
114
  <li
117
115
  key={idx}
118
116
  className={clsx(styles.li, current && styles.current)}
119
117
  onClick={() => handleSubItemClick(handleClick)}
120
118
  >
121
- <Link
122
- data-tooltip-id={showToolTip === true ? tooltipId : ""}
123
- data-tooltip-content={showToolTip === true ? label : ""}
124
- className={clsx(styles.link, styles.label, current && styles.currentLink)}
125
- >
119
+ <Link className={clsx(styles.link, styles.label, current && styles.currentLink)}>
126
120
  {icon}
127
121
  {label}
128
122
  </Link>