dibk-design 0.4.14 → 0.4.15
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.
|
@@ -21,6 +21,8 @@ var _NavigationBarModule = _interopRequireDefault(require("./NavigationBar.modul
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
|
|
24
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
27
|
|
|
26
28
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -155,9 +157,13 @@ var NavigationBar = /*#__PURE__*/function (_React$Component) {
|
|
|
155
157
|
alt: "DIBK logo",
|
|
156
158
|
src: _dibkLogoMobile.default
|
|
157
159
|
});
|
|
158
|
-
|
|
160
|
+
var logoLinkProps = {
|
|
161
|
+
target: this.props.openLogoLinkInNewTab ? '_blank' : null,
|
|
162
|
+
rel: this.props.openLogoLinkInNewTab ? 'noopener noreferrer' : null
|
|
163
|
+
};
|
|
164
|
+
return logoLink && logoLink.length ? /*#__PURE__*/_react.default.createElement("a", _extends({}, logoLinkProps, {
|
|
159
165
|
href: logoLink
|
|
160
|
-
}, logoElement) : logoElement;
|
|
166
|
+
}), logoElement) : logoElement;
|
|
161
167
|
}
|
|
162
168
|
}, {
|
|
163
169
|
key: "render",
|
|
@@ -217,6 +223,9 @@ NavigationBar.propTypes = {
|
|
|
217
223
|
/** Link for logo */
|
|
218
224
|
logoLink: _propTypes.default.string,
|
|
219
225
|
|
|
226
|
+
/** Opens logo link in a new tab on click */
|
|
227
|
+
openLogoLinkInNewTab: _propTypes.default.bool,
|
|
228
|
+
|
|
220
229
|
/** Theme for navigation bar */
|
|
221
230
|
theme: _propTypes.default.object
|
|
222
231
|
};
|
|
@@ -4,11 +4,22 @@ NavigationBar example:
|
|
|
4
4
|
<NavigationBar primaryListItems={[{name: 'Primary item 1', listItems:['Sub item 1', 'Sub item 2']}, 'Primary item 2', {name: 'Primary item 3', href: '#'}]} secondaryListItems={['Secondary item 1', 'Secondary item 2']} />
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
NavigationBar without list items example
|
|
8
9
|
```js
|
|
9
10
|
<NavigationBar />
|
|
10
11
|
```
|
|
11
12
|
|
|
13
|
+
NavigationBar with logo link
|
|
14
|
+
```js
|
|
15
|
+
<NavigationBar logoLink="https://dibk.no/" />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
NavigationBar with logo link that opens in new tab
|
|
19
|
+
```js
|
|
20
|
+
<NavigationBar logoLink="https://dibk.no/" openLogoLinkInNewTab />
|
|
21
|
+
```
|
|
22
|
+
|
|
12
23
|
NavigationBar with child elements
|
|
13
24
|
```js
|
|
14
25
|
<NavigationBar primaryListItems={[{name: 'Primary item 1', listItems:['Sub item 1', 'Sub item 2']}, 'Primary item 2', {name: 'Primary item 3', href: '#'}]} secondaryListItems={['Secondary item 1', 'Secondary item 2']} >
|