@not-govuk/back-link 0.5.4 → 0.5.5
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/dist/BackLink.js +14 -10
- package/package.json +6 -6
package/dist/BackLink.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackLink = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const react_router_dom_1 = require("react-router-dom");
|
|
6
|
+
const component_helpers_1 = require("@not-govuk/component-helpers");
|
|
7
|
+
const link_1 = require("@not-govuk/link");
|
|
8
|
+
require("../assets/BackLink.scss");
|
|
9
|
+
const BackLink = ({ children, classBlock, classModifiers, className, href, text = 'Back', ...attrs }) => {
|
|
7
10
|
const defaultClassBlock = 'govuk-back-link';
|
|
8
|
-
const classes = classBuilder(defaultClassBlock, classBlock, classModifiers, className);
|
|
9
|
-
const history = useHistory();
|
|
10
|
-
return href ? (
|
|
11
|
+
const classes = (0, component_helpers_1.classBuilder)(defaultClassBlock, classBlock, classModifiers, className);
|
|
12
|
+
const history = (0, react_router_dom_1.useHistory)();
|
|
13
|
+
return href ? ((0, react_1.createElement)(link_1.A, { ...attrs, classBlock: classBlock || defaultClassBlock, classModifiers: classModifiers, className: className, href: href }, text)) : ((0, react_1.createElement)("a", { ...attrs, className: classes(), href: "#", onClick: history.goBack }, text));
|
|
11
14
|
};
|
|
12
|
-
|
|
15
|
+
exports.BackLink = BackLink;
|
|
16
|
+
exports.default = exports.BackLink;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@not-govuk/back-link",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "A component to help users navigate back one page.",
|
|
5
5
|
"main": "dist/BackLink.js",
|
|
6
6
|
"sass": "assets/BackLink.scss",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"react-components"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@not-govuk/component-helpers": "^0.5.
|
|
18
|
-
"@not-govuk/link": "^0.5.
|
|
19
|
-
"@not-govuk/sass-base": "^0.5.
|
|
17
|
+
"@not-govuk/component-helpers": "^0.5.5",
|
|
18
|
+
"@not-govuk/link": "^0.5.5",
|
|
19
|
+
"@not-govuk/sass-base": "^0.5.5",
|
|
20
20
|
"govuk-frontend": "3.11.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@not-govuk/docs-components": "^0.5.
|
|
23
|
+
"@not-govuk/docs-components": "^0.5.5",
|
|
24
24
|
"@storybook/addon-docs": "^6.4.0",
|
|
25
25
|
"react": "^16.9.55"
|
|
26
26
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@mdx-js/react": "1.6.22",
|
|
37
|
-
"@not-govuk/component-test-helpers": "^0.5.
|
|
37
|
+
"@not-govuk/component-test-helpers": "^0.5.5",
|
|
38
38
|
"@types/react": "16.14.28",
|
|
39
39
|
"jest": "28.1.3",
|
|
40
40
|
"jest-environment-jsdom": "28.1.3",
|