@nice-digital/nds-hero 4.0.1-alpha.0 → 4.0.2
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/Hero.js +1 -1
- package/es/Hero.js.map +1 -0
- package/package.json +3 -3
- package/es/Hero.test.d.ts +0 -1
- package/es/Hero.test.js +0 -24
package/es/Hero.js
CHANGED
|
@@ -20,6 +20,6 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
20
20
|
require("../scss/hero.scss");
|
|
21
21
|
const Hero = (props) => {
|
|
22
22
|
const { actions, children, footer, header, intro, title, className } = props, rest = __rest(props, ["actions", "children", "footer", "header", "intro", "title", "className"]);
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(["hero", className]) }, rest, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hero__container" }, { children: [header && header, (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hero__body" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hero__copy" }, { children: [(0, jsx_runtime_1.jsx)("h1", Object.assign({ className: "hero__title" }, { children: title })), intro && (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "hero__intro" }, { children: intro })), actions && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hero__actions" }, { children: actions }))] })), children && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hero__extra" }, { children: children }))] })), footer && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hero__footer" }, { children: footer }))] })) })));
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, classnames_1.default)(["hero", className]), "data-component": "hero" }, rest, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hero__container" }, { children: [header && header, (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hero__body" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "hero__copy" }, { children: [(0, jsx_runtime_1.jsx)("h1", Object.assign({ className: "hero__title" }, { children: title })), intro && (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "hero__intro" }, { children: intro })), actions && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hero__actions" }, { children: actions }))] })), children && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hero__extra" }, { children: children }))] })), footer && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "hero__footer" }, { children: footer }))] })) })));
|
|
24
24
|
};
|
|
25
25
|
exports.Hero = Hero;
|
package/es/Hero.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hero.js","names":["React","PropTypes","classnames","Hero","props","actions","children","footer","header","intro","title","className","rest","propTypes","node","string","isRequired"],"sources":["../src/Hero.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\nimport classnames from \"classnames\";\nimport \"../scss/hero.scss\";\n\nexport const Hero = (props) => {\n\tconst {\n\t\tactions,\n\t\tchildren,\n\t\tfooter,\n\t\theader,\n\t\tintro,\n\t\ttitle,\n\t\tclassName,\n\t\t...rest\n\t} = props;\n\treturn (\n\t\t<div className={classnames([\"hero\", className])} {...rest}>\n\t\t\t<div className=\"hero__container\">\n\t\t\t\t{header && header}\n\t\t\t\t<div className=\"hero__body\">\n\t\t\t\t\t<div className=\"hero__copy\">\n\t\t\t\t\t\t<h1 className=\"hero__title\">{title}</h1>\n\t\t\t\t\t\t{intro && <p className=\"hero__intro\">{intro}</p>}\n\t\t\t\t\t\t{actions && <div className=\"hero__actions\">{actions}</div>}\n\t\t\t\t\t</div>\n\t\t\t\t\t{children && <div className=\"hero__extra\">{children}</div>}\n\t\t\t\t</div>\n\t\t\t\t{footer && <div className=\"hero__footer\">{footer}</div>}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nHero.propTypes = {\n\tactions: PropTypes.node,\n\tchildren: PropTypes.node,\n\tclassName: PropTypes.string,\n\tfooter: PropTypes.node,\n\theader: PropTypes.node,\n\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,CAACa,IAFJ;EAGhBH,SAAS,EAAEV,SAAS,CAACc,MAHL;EAIhBR,MAAM,EAAEN,SAAS,CAACa,IAJF;EAKhBN,MAAM,EAAEP,SAAS,CAACa,IALF;EAMhBL,KAAK,EAAER,SAAS,CAACa,IAND;EAOhBJ,KAAK,EAAET,SAAS,CAACa,IAAV,CAAeE;AAPN,CAAjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-digital/nds-hero",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Hero component for the NICE Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hero"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"url": "https://github.com/nice-digital/nice-design-system/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@nice-digital/nds-core": "^4.0.
|
|
36
|
+
"@nice-digital/nds-core": "^4.0.2",
|
|
37
37
|
"classnames": "^2.3.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"@types/node": "^18.11.9",
|
|
49
49
|
"typescript": "^4.8.4"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "d8feb7beba5fffa49da42d6a550cb8f67a50727d"
|
|
52
52
|
}
|
package/es/Hero.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/es/Hero.test.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
-
const react_1 = require("@testing-library/react");
|
|
5
|
-
const Hero_1 = require("./Hero");
|
|
6
|
-
const actions = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("a", Object.assign({ href: "page-one" }, { children: "Go to page one" })), (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "page-two" }, { children: "Go to page two" }))] }));
|
|
7
|
-
const header = (0, jsx_runtime_1.jsx)("p", { children: "Header content" });
|
|
8
|
-
const footer = (0, jsx_runtime_1.jsx)("p", { children: "Footer content" });
|
|
9
|
-
const extras = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("h2", { children: "Quick links" }), (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "page-one" }, { children: "Go to page one" })) }), (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("ul", { children: (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "page-two" }, { children: "Go to page two" })) }) }) }), (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("a", Object.assign({ href: "page-three" }, { children: "Go to page three" })) })] })] }));
|
|
10
|
-
describe("Hero", () => {
|
|
11
|
-
it("should match the snapshot with props", () => {
|
|
12
|
-
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Hero_1.Hero, Object.assign({ title: "Welcoming title", intro: "Introduction text", actions: actions, header: header, footer: footer }, { children: extras })));
|
|
13
|
-
expect(wrapper).toMatchSnapshot();
|
|
14
|
-
});
|
|
15
|
-
it("should pass any number of child components via actions and extra props ", () => {
|
|
16
|
-
var _a;
|
|
17
|
-
const wrapper = (0, react_1.render)((0, jsx_runtime_1.jsx)(Hero_1.Hero, Object.assign({ title: "Welcoming title", intro: "Introduction text", actions: actions, "data-track": false, className: "mt--0" }, { children: extras })));
|
|
18
|
-
const anchors = wrapper.getAllByRole("link", { name: "Go to page two" });
|
|
19
|
-
expect(anchors.length).toBe(2);
|
|
20
|
-
expect(anchors[anchors.length - 1].textContent).toBe("Go to page two");
|
|
21
|
-
expect((_a = wrapper.container.querySelector("div.hero")) === null || _a === void 0 ? void 0 : _a.getAttribute("data-track")).toBe("false");
|
|
22
|
-
expect(wrapper.container.querySelector("div.hero")).toHaveClass("mt--0");
|
|
23
|
-
});
|
|
24
|
-
});
|