@nice-digital/nds-page-header 4.0.18 → 4.0.20-alpha-node-update.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.
- package/es/PageHeader.d.ts +17 -17
- package/es/PageHeader.js +48 -48
- package/package.json +5 -5
package/es/PageHeader.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "../scss/page-header.scss";
|
|
3
|
-
export interface PageHeaderProps {
|
|
4
|
-
[prop: string]: unknown;
|
|
5
|
-
useAltHeading?: boolean;
|
|
6
|
-
preheading?: React.ReactNode;
|
|
7
|
-
breadcrumbs?: React.ReactNode;
|
|
8
|
-
heading: React.ReactNode;
|
|
9
|
-
metadata?: React.ReactNode[];
|
|
10
|
-
lead?: React.ReactNode;
|
|
11
|
-
description?: React.ReactNode;
|
|
12
|
-
cta?: React.ReactNode;
|
|
13
|
-
secondSection?: React.ReactNode;
|
|
14
|
-
verticalPadding?: "loose";
|
|
15
|
-
variant?: "normal" | "fullWidthDark" | "fullWidthLight";
|
|
16
|
-
}
|
|
17
|
-
export declare const PageHeader: React.FC<PageHeaderProps>;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "../scss/page-header.scss";
|
|
3
|
+
export interface PageHeaderProps {
|
|
4
|
+
[prop: string]: unknown;
|
|
5
|
+
useAltHeading?: boolean;
|
|
6
|
+
preheading?: React.ReactNode;
|
|
7
|
+
breadcrumbs?: React.ReactNode;
|
|
8
|
+
heading: React.ReactNode;
|
|
9
|
+
metadata?: React.ReactNode[];
|
|
10
|
+
lead?: React.ReactNode;
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
cta?: React.ReactNode;
|
|
13
|
+
secondSection?: React.ReactNode;
|
|
14
|
+
verticalPadding?: "loose";
|
|
15
|
+
variant?: "normal" | "fullWidthDark" | "fullWidthLight";
|
|
16
|
+
}
|
|
17
|
+
export declare const PageHeader: React.FC<PageHeaderProps>;
|
package/es/PageHeader.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.PageHeader = void 0;
|
|
15
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
-
const nds_grid_1 = require("@nice-digital/nds-grid");
|
|
17
|
-
require("../scss/page-header.scss");
|
|
18
|
-
const PageHeader = (props) => {
|
|
19
|
-
const { useAltHeading = false, preheading, breadcrumbs, heading, metadata, lead, description, cta, secondSection, verticalPadding, variant = "normal" } = props, rest = __rest(props, ["useAltHeading", "preheading", "breadcrumbs", "heading", "metadata", "lead", "description", "cta", "secondSection", "verticalPadding", "variant"]);
|
|
20
|
-
// Figure out variant
|
|
21
|
-
const isFullWidth = variant === "fullWidthDark" || variant === "fullWidthLight";
|
|
22
|
-
let variantClassname = "";
|
|
23
|
-
switch (variant) {
|
|
24
|
-
case "fullWidthDark":
|
|
25
|
-
variantClassname = "page-header--full-width-dark";
|
|
26
|
-
break;
|
|
27
|
-
case "fullWidthLight":
|
|
28
|
-
variantClassname = "page-header--full-width-light";
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
// Figure out vertical padding
|
|
32
|
-
if (verticalPadding === "loose") {
|
|
33
|
-
variantClassname += " page-header--vertical-padding-loose";
|
|
34
|
-
}
|
|
35
|
-
// Figure out grid
|
|
36
|
-
const mainSectionColumns = secondSection ? 9 : 12;
|
|
37
|
-
// TODO: Refactor this into some sort of conditional component
|
|
38
|
-
// e.g. https://dev.to/dailydevtips1/conditional-wrapping-in-react-46o5
|
|
39
|
-
const PageHeaderContent = () => {
|
|
40
|
-
const mainContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [breadcrumbs && ((0, jsx_runtime_1.jsx)("div",
|
|
41
|
-
if (secondSection) {
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)(nds_grid_1.Grid, { children: [(0, jsx_runtime_1.jsx)(nds_grid_1.GridItem,
|
|
43
|
-
}
|
|
44
|
-
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: mainContent });
|
|
45
|
-
};
|
|
46
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `page-header ${variantClassname}`, "data-component": "page-header" }, rest, { children: isFullWidth ? ((0, jsx_runtime_1.jsx)("div",
|
|
47
|
-
};
|
|
48
|
-
exports.PageHeader = PageHeader;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.PageHeader = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const nds_grid_1 = require("@nice-digital/nds-grid");
|
|
17
|
+
require("../scss/page-header.scss");
|
|
18
|
+
const PageHeader = (props) => {
|
|
19
|
+
const { useAltHeading = false, preheading, breadcrumbs, heading, metadata, lead, description, cta, secondSection, verticalPadding, variant = "normal" } = props, rest = __rest(props, ["useAltHeading", "preheading", "breadcrumbs", "heading", "metadata", "lead", "description", "cta", "secondSection", "verticalPadding", "variant"]);
|
|
20
|
+
// Figure out variant
|
|
21
|
+
const isFullWidth = variant === "fullWidthDark" || variant === "fullWidthLight";
|
|
22
|
+
let variantClassname = "";
|
|
23
|
+
switch (variant) {
|
|
24
|
+
case "fullWidthDark":
|
|
25
|
+
variantClassname = "page-header--full-width-dark";
|
|
26
|
+
break;
|
|
27
|
+
case "fullWidthLight":
|
|
28
|
+
variantClassname = "page-header--full-width-light";
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
// Figure out vertical padding
|
|
32
|
+
if (verticalPadding === "loose") {
|
|
33
|
+
variantClassname += " page-header--vertical-padding-loose";
|
|
34
|
+
}
|
|
35
|
+
// Figure out grid
|
|
36
|
+
const mainSectionColumns = secondSection ? 9 : 12;
|
|
37
|
+
// TODO: Refactor this into some sort of conditional component
|
|
38
|
+
// e.g. https://dev.to/dailydevtips1/conditional-wrapping-in-react-46o5
|
|
39
|
+
const PageHeaderContent = () => {
|
|
40
|
+
const mainContent = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [breadcrumbs && ((0, jsx_runtime_1.jsx)("div", { className: "page-header__breadcrumbs", children: breadcrumbs })), (0, jsx_runtime_1.jsxs)("h1", { className: `page-header__heading ${useAltHeading ? "page-header__heading--alt" : ""}`, children: [preheading && ((0, jsx_runtime_1.jsx)("span", { className: "page-header__pre-heading", children: preheading })), heading] }), lead && (0, jsx_runtime_1.jsx)("p", { className: "page-header__lead", children: lead }), description && ((0, jsx_runtime_1.jsx)("div", { className: "page-header__description", children: description })), metadata && ((0, jsx_runtime_1.jsx)("ul", { className: "page-header__metadata", children: metadata.map((metadatum, i) => ((0, jsx_runtime_1.jsx)("li", { children: metadatum }, i))) })), cta && (0, jsx_runtime_1.jsx)("p", { className: "page-header__cta", children: cta })] }));
|
|
41
|
+
if (secondSection) {
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(nds_grid_1.Grid, { children: [(0, jsx_runtime_1.jsx)(nds_grid_1.GridItem, { md: { cols: mainSectionColumns }, children: mainContent }), (0, jsx_runtime_1.jsx)(nds_grid_1.GridItem, { md: { cols: 3 }, className: "page-header__second-section", children: secondSection })] }));
|
|
43
|
+
}
|
|
44
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: mainContent });
|
|
45
|
+
};
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `page-header ${variantClassname}`, "data-component": "page-header" }, rest, { children: isFullWidth ? ((0, jsx_runtime_1.jsx)("div", { className: "page-header__full-width-container", children: (0, jsx_runtime_1.jsx)(PageHeaderContent, {}) })) : ((0, jsx_runtime_1.jsx)(PageHeaderContent, {})) })));
|
|
47
|
+
};
|
|
48
|
+
exports.PageHeader = PageHeader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-digital/nds-page-header",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.20-alpha-node-update.0",
|
|
4
4
|
"description": "Page header component for the NICE Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"header"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"url": "https://github.com/nice-digital/nice-design-system/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nice-digital/nds-core": "^4.0.
|
|
38
|
+
"@nice-digital/nds-core": "^4.0.17-alpha-node-update.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^16 || ^17 || ^18",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"@testing-library/react": "^13.4.0",
|
|
47
47
|
"@testing-library/user-event": "^14.4.3",
|
|
48
48
|
"@types/jest": "^29.2.2",
|
|
49
|
-
"@types/node": "
|
|
50
|
-
"typescript": "^
|
|
49
|
+
"@types/node": "22.19.0",
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "1b7a4a13183120071b022adecd2fcf4eebefbb6c"
|
|
53
53
|
}
|