@conduction/components 2.2.39 → 2.2.41
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 +4 -0
- package/lib/components/card/downloadCard/DownloadCard.d.ts +2 -1
- package/lib/components/card/downloadCard/DownloadCard.js +1 -1
- package/lib/components/displaySwitch/DisplaySwitch.js +1 -1
- package/lib/components/displaySwitch/DisplaySwitch.module.css +4 -0
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.d.ts +1 -3
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.js +2 -2
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.module.css +2 -0
- package/package.json +1 -1
- package/src/components/card/downloadCard/DownloadCard.tsx +3 -2
- package/src/components/displaySwitch/DisplaySwitch.module.css +4 -0
- package/src/components/displaySwitch/DisplaySwitch.tsx +1 -0
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css +2 -0
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx +3 -9
package/README.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
- **Version 2.2 (breaking changes from 2.1.x)**
|
|
6
6
|
|
|
7
|
+
- 2.2.41: Updated displayswitch component to have pointer.
|
|
8
|
+
- 2.2.40:
|
|
9
|
+
- Updated DownloadCard to only accept fontawesome icons.
|
|
10
|
+
- Removed tooltip from PrimaryTopNav component and updated dropdown.
|
|
7
11
|
- 2.2.39:
|
|
8
12
|
- Updated PrimaryTopNav component to include tooltip and better dropdown.
|
|
9
13
|
- 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?:
|
|
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:
|
|
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
|
};
|
|
@@ -7,7 +7,7 @@ const DisplaySwitch = ({ layoutClassName, buttons }) => {
|
|
|
7
7
|
return (_jsx(ButtonGroup, { className: clsx(styles.displaySwitchButtons, [layoutClassName] && layoutClassName), children: buttons.map((button, idx) => {
|
|
8
8
|
// TODO: Once the Rotterdam design system supports the "pressed" state,
|
|
9
9
|
// remove the `appereance` switch, and use the same appearance for each button.
|
|
10
|
-
return (_jsxs(Button, { pressed: button.pressed, appearance: button.pressed ? "secondary-action-button" : "subtle-button", onClick: button.handleClick, children: [button.icon && _jsx(FontAwesomeIcon, { icon: [button.icon.prefix, button.icon.name] }), _jsx("span", { children: button.label })] }, idx));
|
|
10
|
+
return (_jsxs(Button, { pressed: button.pressed, appearance: button.pressed ? "secondary-action-button" : "subtle-button", onClick: button.handleClick, className: styles.button, children: [button.icon && _jsx(FontAwesomeIcon, { icon: [button.icon.prefix, button.icon.name] }), _jsx("span", { children: button.label })] }, idx));
|
|
11
11
|
}) }));
|
|
12
12
|
};
|
|
13
13
|
export default DisplaySwitch;
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
@@ -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?:
|
|
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}>{
|
|
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}
|
|
@@ -35,6 +35,7 @@ const DisplaySwitch: React.FC<DisplaySwitchProps> = ({ layoutClassName, buttons
|
|
|
35
35
|
pressed={button.pressed}
|
|
36
36
|
appearance={button.pressed ? "secondary-action-button" : "subtle-button"}
|
|
37
37
|
onClick={button.handleClick}
|
|
38
|
+
className={styles.button}
|
|
38
39
|
>
|
|
39
40
|
{button.icon && <FontAwesomeIcon icon={[button.icon.prefix, button.icon.name]} />}
|
|
40
41
|
<span>{button.label}</span>
|
|
@@ -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
|
|
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
|
|
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>
|