@financial-times/dotcom-ui-header 9.4.0 → 9.4.1
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/node/components/ask-ft/askFtButton.d.ts +2 -1
- package/dist/node/components/ask-ft/askFtButton.js +1 -1
- package/dist/node/components/drawer/topLevelPartials.js +1 -1
- package/dist/node/components/navigation/partials.js +4 -8
- package/dist/node/components/sticky/partials.js +1 -1
- package/dist/node/components/top/partials.d.ts +1 -2
- package/dist/node/components/top/partials.js +13 -28
- package/dist/node/index.d.ts +0 -1
- package/dist/tsconfig.tsbuildinfo +12 -12
- package/package.json +2 -2
- package/src/__stories__/story-data/index.ts +4 -0
- package/src/__stories__/story-data/navbarRight.ts +2 -2
- package/src/__stories__/story-data/navbarTopRight.ts +19 -0
- package/src/__stories__/story-data/navbarTopRightAnon.ts +19 -0
- package/src/__stories__/story-data/profile.ts +4 -0
- package/src/__stories__/story.tsx +0 -42
- package/src/__test__/components/__snapshots__/Drawer.spec.tsx.snap +1 -0
- package/src/__test__/components/__snapshots__/MainHeader.spec.tsx.snap +23 -45
- package/src/__test__/components/__snapshots__/StickyHeader.spec.tsx.snap +1 -0
- package/src/__test__/output/component.spec.tsx +13 -10
- package/src/components/ask-ft/askFtButton.tsx +3 -1
- package/src/components/drawer/topLevelPartials.tsx +5 -1
- package/src/components/navigation/partials.tsx +0 -14
- package/src/components/sticky/partials.tsx +5 -1
- package/src/components/top/partials.tsx +19 -85
- package/src/interfaces.d.ts +0 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface AskFtButtonProps {
|
|
3
|
+
id: string;
|
|
3
4
|
className: string;
|
|
4
5
|
dataTrackable: string;
|
|
5
6
|
}
|
|
6
|
-
export declare const AskFtButton: ({ className, dataTrackable }: AskFtButtonProps) => React.JSX.Element;
|
|
7
|
+
export declare const AskFtButton: ({ id, className, dataTrackable }: AskFtButtonProps) => React.JSX.Element;
|
|
@@ -5,6 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AskFtButton = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const AskFtButton = ({ className, dataTrackable }) => (react_1.default.createElement("a", { className: `ft-header__ask-ft-button ${className}`, "data-trackable": dataTrackable, href: "https://ask.ft.com", title: "ASK FT" },
|
|
8
|
+
const AskFtButton = ({ id, className, dataTrackable }) => (react_1.default.createElement("a", { id: id, className: `ft-header__ask-ft-button ${className}`, "data-trackable": dataTrackable, href: "https://ask.ft.com", title: "ASK FT" },
|
|
9
9
|
react_1.default.createElement("span", { className: "ft-header__ask-ft-button-label" }, "Ask FT")));
|
|
10
10
|
exports.AskFtButton = AskFtButton;
|
|
@@ -40,7 +40,7 @@ const Search = (props) => (react_1.default.createElement("div", { className: "o-
|
|
|
40
40
|
react_1.default.createElement("input", { className: "o-header__drawer-search-term", id: "o-header-drawer-search-term", name: "q", type: "text", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: false, placeholder: "Search the FT", "data-trackable": "search-term", "data-n-topic-search-input": true }),
|
|
41
41
|
react_1.default.createElement("button", { className: "o-header__drawer-search-submit", type: "submit", "data-trackable": "search-submit" },
|
|
42
42
|
react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Search")),
|
|
43
|
-
props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__drawer-ask-ft-button", dataTrackable: "ask-ft-button-drawer" })))));
|
|
43
|
+
props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__drawer-ask-ft-button", id: "ask-ft-button-drawer", dataTrackable: "ask-ft-button-drawer" })))));
|
|
44
44
|
const SectionPrimary = (props) => {
|
|
45
45
|
var _a;
|
|
46
46
|
const sectionId = props.label.toLowerCase().replace(' ', '-');
|
|
@@ -31,18 +31,14 @@ const NavListLeft = (props) => (react_1.default.createElement("ul", { className:
|
|
|
31
31
|
})));
|
|
32
32
|
exports.NavListLeft = NavListLeft;
|
|
33
33
|
const NavListRight = (props) => {
|
|
34
|
-
return props.userIsLoggedIn ? (react_1.default.createElement(NavListRightLoggedIn, { items: props.data['navbar-right'].items
|
|
34
|
+
return props.userIsLoggedIn ? (react_1.default.createElement(NavListRightLoggedIn, { items: props.data['navbar-right'].items })) : null;
|
|
35
35
|
};
|
|
36
36
|
exports.NavListRight = NavListRight;
|
|
37
|
-
const NavListRightLoggedIn = ({ items,
|
|
38
|
-
/**
|
|
39
|
-
* Accounts entry test
|
|
40
|
-
* In this rendering theres a hacky solution to replace "Settings & Account" with "MyFT Feed"
|
|
41
|
-
* Once the test is concluded the real data should be updated accordingly and the hack removed
|
|
42
|
-
*/
|
|
37
|
+
const NavListRightLoggedIn = ({ items, }) => {
|
|
43
38
|
return (react_1.default.createElement("ul", { "data-component": "nav-list--right", className: "o-header__nav-list o-header__nav-list--right", "data-trackable": "user-nav" }, items.map((item, index) => {
|
|
44
39
|
var _a;
|
|
45
|
-
return (react_1.default.createElement("li", { className: "o-header__nav-item", key: `link-${index}` },
|
|
40
|
+
return (react_1.default.createElement("li", { className: "o-header__nav-item", key: `link-${index}` },
|
|
41
|
+
react_1.default.createElement("a", { className: "o-header__nav-link", href: (_a = item.url) !== null && _a !== void 0 ? _a : undefined, "data-trackable": item.label }, item.label)));
|
|
46
42
|
})));
|
|
47
43
|
};
|
|
48
44
|
const MegaNav = ({ label, meganav, index }) => {
|
|
@@ -42,7 +42,7 @@ const TopColumnLeftSticky = (props) => {
|
|
|
42
42
|
return (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--left" },
|
|
43
43
|
react_1.default.createElement(DrawerIconSticky, null),
|
|
44
44
|
react_1.default.createElement(SearchIconSticky, null),
|
|
45
|
-
props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__top-ask-ft-button", dataTrackable: "ask-ft-button-sticky" }))));
|
|
45
|
+
props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__top-ask-ft-button", id: "ask-ft-button-sticky", dataTrackable: "ask-ft-button-sticky" }))));
|
|
46
46
|
};
|
|
47
47
|
exports.TopColumnLeftSticky = TopColumnLeftSticky;
|
|
48
48
|
const TopColumnCenterSticky = (props) => {
|
|
@@ -16,10 +16,9 @@ declare const SubscribeButton: ({ item, variant, className }: {
|
|
|
16
16
|
variant?: string | undefined;
|
|
17
17
|
className?: string | undefined;
|
|
18
18
|
}) => React.JSX.Element;
|
|
19
|
-
declare const TopColumnRightAnon: ({ items, variant
|
|
19
|
+
declare const TopColumnRightAnon: ({ items, variant }: {
|
|
20
20
|
items: TNavMenuItem[];
|
|
21
21
|
variant?: string | undefined;
|
|
22
|
-
experimentalAccountEntryTest?: boolean | undefined;
|
|
23
22
|
}) => React.JSX.Element;
|
|
24
23
|
declare const TopColumnRight: (props: THeaderProps) => React.JSX.Element;
|
|
25
24
|
export { HeaderWrapper, TopWrapper, TopColumnLeft, TopColumnCenter, TopColumnCenterNoLink, TopColumnRight, TopColumnRightAnon, SubscribeButton, SignInLink };
|
|
@@ -13,26 +13,11 @@ const DrawerIcon = () => (react_1.default.createElement("a", { href: "#o-header-
|
|
|
13
13
|
react_1.default.createElement("span", { className: "o-header__top-link-label" }, "Open side navigation menu")));
|
|
14
14
|
const SearchIcon = () => (react_1.default.createElement("a", { href: `#o-header-search-primary`, className: "o-header__top-icon-link o-header__top-icon-link--search", "aria-controls": `o-header-search-primary`, title: "Open search bar", "data-trackable": "search-toggle" },
|
|
15
15
|
react_1.default.createElement("span", { className: "o-header__top-link-label" }, "Open search bar")));
|
|
16
|
-
const
|
|
17
|
-
if (experimentalAccountEntryTest) {
|
|
18
|
-
return react_1.default.createElement(MyAccountLink, { signedIn: signedIn });
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return react_1.default.createElement(MyFtLogoLink, { className: className });
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const MyFtLogoLink = ({ className }) => (react_1.default.createElement("a", { className: `o-header__top-icon-link o-header__top-icon-link--myft ${className}`, id: "o-header-top-link-myft", href: "/myft", "data-trackable": "my-ft", "data-tour-stage": "myFt", "aria-label": "My F T" },
|
|
25
|
-
react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "myFT")));
|
|
26
|
-
const MyAccountLink = ({ signedIn }) => {
|
|
16
|
+
const MyAccountLink = ({ item, signedIn }) => {
|
|
27
17
|
const classNames = 'o-header__top-link ft-header__top-link--myaccount';
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return (react_1.default.createElement("a", { className: classNames, id: "o-header-top-link-signin", href: "/login?location=/", "data-trackable": "Sign In" },
|
|
34
|
-
react_1.default.createElement("span", null, "Sign In")));
|
|
35
|
-
}
|
|
18
|
+
const id = signedIn ? 'o-header-top-link-myaccount' : 'o-header-top-link-signin';
|
|
19
|
+
return (react_1.default.createElement("a", { className: classNames, id: id, href: item.url || undefined, "data-trackable": item.label },
|
|
20
|
+
react_1.default.createElement("span", null, item.label)));
|
|
36
21
|
};
|
|
37
22
|
const TopWrapper = (props) => (react_1.default.createElement("div", { className: "o-header__row o-header__top", "data-trackable": "header-top" },
|
|
38
23
|
react_1.default.createElement("div", { className: "o-header__container" },
|
|
@@ -41,7 +26,7 @@ exports.TopWrapper = TopWrapper;
|
|
|
41
26
|
const TopColumnLeft = (props) => (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--left" },
|
|
42
27
|
react_1.default.createElement(DrawerIcon, null),
|
|
43
28
|
react_1.default.createElement(SearchIcon, null),
|
|
44
|
-
props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__top-ask-ft-button", dataTrackable: "ask-ft-button-header" }))));
|
|
29
|
+
props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { className: "ft-header__top-ask-ft-button", id: "ask-ft-button-header", dataTrackable: "ask-ft-button-header" }))));
|
|
45
30
|
exports.TopColumnLeft = TopColumnLeft;
|
|
46
31
|
const TopColumnCenter = () => (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--center" },
|
|
47
32
|
react_1.default.createElement("a", { className: "o-header__top-logo", style: { backgroundImage: 'none' }, "data-trackable": "logo", href: "/", title: "Go to Financial Times homepage" },
|
|
@@ -52,11 +37,12 @@ const TopColumnCenterNoLink = () => (react_1.default.createElement("div", { clas
|
|
|
52
37
|
react_1.default.createElement(BrandFtMasthead_1.default, { title: "Financial Times" }))));
|
|
53
38
|
exports.TopColumnCenterNoLink = TopColumnCenterNoLink;
|
|
54
39
|
const TopColumnRightLoggedIn = (props) => {
|
|
55
|
-
var _a, _b;
|
|
56
|
-
const
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
const signInAction = (_b = (_a = props.data['navbar-top-right']) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b[0];
|
|
42
|
+
const subscribeAction = (_d = (_c = props.data['navbar-top-right']) === null || _c === void 0 ? void 0 : _c.items) === null || _d === void 0 ? void 0 : _d[1];
|
|
57
43
|
return (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--right" },
|
|
58
44
|
!props.userIsSubscribed && subscribeAction && (react_1.default.createElement(SubscribeButton, { item: subscribeAction, variant: props.variant, className: "o-header__top-button--hide-m" })),
|
|
59
|
-
react_1.default.createElement(
|
|
45
|
+
signInAction && react_1.default.createElement(MyAccountLink, { item: signInAction, signedIn: true })));
|
|
60
46
|
};
|
|
61
47
|
const SignInLink = ({ item, variant, className }) => {
|
|
62
48
|
var _a;
|
|
@@ -73,13 +59,12 @@ const SubscribeButton = ({ item, variant, className }) => {
|
|
|
73
59
|
role: "button", href: (_a = item.url) !== null && _a !== void 0 ? _a : undefined, "data-trackable": item.label }, setTabIndex), item.label));
|
|
74
60
|
};
|
|
75
61
|
exports.SubscribeButton = SubscribeButton;
|
|
76
|
-
const TopColumnRightAnon = ({ items, variant
|
|
62
|
+
const TopColumnRightAnon = ({ items, variant }) => {
|
|
77
63
|
// If user is anonymous the second list item is styled as a button
|
|
78
64
|
const [signInAction, subscribeAction] = items;
|
|
79
65
|
return (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--right" },
|
|
80
66
|
subscribeAction && (react_1.default.createElement(SubscribeButton, { item: subscribeAction, variant: variant, className: "o-header__top-button--hide-m" })),
|
|
81
|
-
signInAction &&
|
|
82
|
-
react_1.default.createElement(TopRightAccountEntry, { className: "o-header__top-icon-link--show-m", signedIn: false, experimentalAccountEntryTest: experimentalAccountEntryTest })));
|
|
67
|
+
signInAction && react_1.default.createElement(MyAccountLink, { item: signInAction, signedIn: false })));
|
|
83
68
|
};
|
|
84
69
|
exports.TopColumnRightAnon = TopColumnRightAnon;
|
|
85
70
|
const TopColumnRight = (props) => {
|
|
@@ -87,8 +72,8 @@ const TopColumnRight = (props) => {
|
|
|
87
72
|
return react_1.default.createElement(TopColumnRightLoggedIn, Object.assign({}, props));
|
|
88
73
|
}
|
|
89
74
|
else {
|
|
90
|
-
const userNavAnonItems = props.data['navbar-right-anon'].items;
|
|
91
|
-
return
|
|
75
|
+
const userNavAnonItems = props.data['navbar-top-right-anon'].items;
|
|
76
|
+
return react_1.default.createElement(TopColumnRightAnon, { items: userNavAnonItems, variant: props.variant });
|
|
92
77
|
}
|
|
93
78
|
};
|
|
94
79
|
exports.TopColumnRight = TopColumnRight;
|
package/dist/node/index.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ declare namespace MainHeader {
|
|
|
13
13
|
showStickyHeader?: boolean | undefined;
|
|
14
14
|
showMegaNav?: boolean | undefined;
|
|
15
15
|
showAskButton?: boolean | undefined;
|
|
16
|
-
experimentalAccountEntryTest?: boolean | undefined;
|
|
17
16
|
};
|
|
18
17
|
}
|
|
19
18
|
declare function StickyHeader(props: THeaderProps): React.JSX.Element | null;
|
|
@@ -167,13 +167,13 @@
|
|
|
167
167
|
"affectsGlobalScope": true
|
|
168
168
|
},
|
|
169
169
|
"../../dotcom-types-navigation/index.d.ts": {
|
|
170
|
-
"version": "
|
|
171
|
-
"signature": "
|
|
170
|
+
"version": "656d366d5e48d86bff7a803885cfd9d31d37f6c777af0ffe3e1ee8d258bc4520",
|
|
171
|
+
"signature": "656d366d5e48d86bff7a803885cfd9d31d37f6c777af0ffe3e1ee8d258bc4520",
|
|
172
172
|
"affectsGlobalScope": false
|
|
173
173
|
},
|
|
174
174
|
"../src/interfaces.d.ts": {
|
|
175
|
-
"version": "
|
|
176
|
-
"signature": "
|
|
175
|
+
"version": "2fe58268385c91140d66300355fc27cb349306472adcac6a09fb484dc974a191",
|
|
176
|
+
"signature": "2fe58268385c91140d66300355fc27cb349306472adcac6a09fb484dc974a191",
|
|
177
177
|
"affectsGlobalScope": false
|
|
178
178
|
},
|
|
179
179
|
"../src/components/svg-components/BrandFtMasthead.tsx": {
|
|
@@ -182,13 +182,13 @@
|
|
|
182
182
|
"affectsGlobalScope": false
|
|
183
183
|
},
|
|
184
184
|
"../src/components/ask-ft/askFtButton.tsx": {
|
|
185
|
-
"version": "
|
|
186
|
-
"signature": "
|
|
185
|
+
"version": "7b4e3416bf0157aeec6f682001193d80d87268eeb015a7d9e34c6691c38de2fe",
|
|
186
|
+
"signature": "478e79eef989a22fe3dc976337d53a5e3ea146b07304c45620b8b91560dd106b",
|
|
187
187
|
"affectsGlobalScope": false
|
|
188
188
|
},
|
|
189
189
|
"../src/components/top/partials.tsx": {
|
|
190
|
-
"version": "
|
|
191
|
-
"signature": "
|
|
190
|
+
"version": "5b3cba0308fdf6a8e0dfe933c890d3ff1353e89429c1e2be96cd63fcd558721f",
|
|
191
|
+
"signature": "52e9ca0196757edb87416ec63a0da3f2f6963cb4ca1fab821e487cf42fd0b4cf",
|
|
192
192
|
"affectsGlobalScope": false
|
|
193
193
|
},
|
|
194
194
|
"../src/utils.ts": {
|
|
@@ -197,12 +197,12 @@
|
|
|
197
197
|
"affectsGlobalScope": false
|
|
198
198
|
},
|
|
199
199
|
"../src/components/navigation/partials.tsx": {
|
|
200
|
-
"version": "
|
|
200
|
+
"version": "4490493cf4204f1c176bb27c8768968b6c03129e7665a9258e88ead48b0c2efe",
|
|
201
201
|
"signature": "fff57eecd77a2ff5847ac6a4139236fb1671b562d8f5b4f5aa16a2a101212dd0",
|
|
202
202
|
"affectsGlobalScope": false
|
|
203
203
|
},
|
|
204
204
|
"../src/components/sticky/partials.tsx": {
|
|
205
|
-
"version": "
|
|
205
|
+
"version": "9a0b683328c80d151d0b70b516597dbb365dd3f44ccb08fbd78a9c1509475ba9",
|
|
206
206
|
"signature": "8fbeb8e68c5be0e2f41a60731bb91f6c54327ecca0d18857c3feeaa06e1cd389",
|
|
207
207
|
"affectsGlobalScope": false
|
|
208
208
|
},
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
"affectsGlobalScope": false
|
|
218
218
|
},
|
|
219
219
|
"../src/components/drawer/topLevelPartials.tsx": {
|
|
220
|
-
"version": "
|
|
220
|
+
"version": "3561750723a43ff4eb0ed5a1da3bb56a14d3006ecfa27fab0dbb1852f8c3cd56",
|
|
221
221
|
"signature": "9d1b0a09950f10403acbd59a85db578c3d6d0eec6d4fd6b26deacd7fc69b5bb4",
|
|
222
222
|
"affectsGlobalScope": false
|
|
223
223
|
},
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
},
|
|
229
229
|
"../src/index.tsx": {
|
|
230
230
|
"version": "1590223c256c5d68b425be24b35676fdefdb9460dac8c04b7e6fbe4c9ce82477",
|
|
231
|
-
"signature": "
|
|
231
|
+
"signature": "09d351582aa153eefd5469b12224f3eb0306b746105e502d1eb609bb871a1b7e",
|
|
232
232
|
"affectsGlobalScope": false
|
|
233
233
|
},
|
|
234
234
|
"../../../node_modules/@types/aria-query/index.d.ts": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/dotcom-ui-header",
|
|
3
|
-
"version": "9.4.
|
|
3
|
+
"version": "9.4.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "browser.js",
|
|
6
6
|
"main": "component.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@financial-times/dotcom-types-navigation": "^9.4.
|
|
25
|
+
"@financial-times/dotcom-types-navigation": "^9.4.1",
|
|
26
26
|
"n-topic-search": "^4.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -4,6 +4,8 @@ import actionsUK from './actionsUK'
|
|
|
4
4
|
import editionsUK from './editionsUK'
|
|
5
5
|
import navbarRight from './navbarRight'
|
|
6
6
|
import navbarRightAnon from './navbarRightAnon'
|
|
7
|
+
import navbarTopRight from './navbarTopRight'
|
|
8
|
+
import navbarTopRightAnon from './navbarTopRightAnon'
|
|
7
9
|
import navbarSimple from './navbarSimple'
|
|
8
10
|
import navbarUK from './navbarUK'
|
|
9
11
|
import subNavigation from './subNavigationUK'
|
|
@@ -31,6 +33,8 @@ const data: THeaderProps = {
|
|
|
31
33
|
navbar: navbarUK,
|
|
32
34
|
'navbar-right': navbarRight,
|
|
33
35
|
'navbar-right-anon': navbarRightAnon,
|
|
36
|
+
'navbar-top-right': navbarTopRight,
|
|
37
|
+
'navbar-top-right-anon': navbarTopRightAnon,
|
|
34
38
|
'navbar-simple': navbarSimple,
|
|
35
39
|
subsections,
|
|
36
40
|
'subsections-right': [],
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TNavMenu } from '@financial-times/dotcom-types-navigation'
|
|
2
|
+
|
|
3
|
+
const data: TNavMenu = {
|
|
4
|
+
label: 'Navigation',
|
|
5
|
+
items: [
|
|
6
|
+
{
|
|
7
|
+
label: 'My Account',
|
|
8
|
+
url: '/myaccount',
|
|
9
|
+
submenu: null
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: 'Subscribe',
|
|
13
|
+
url: '/products?segmentId=#',
|
|
14
|
+
submenu: null
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default data
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TNavMenu } from '@financial-times/dotcom-types-navigation'
|
|
2
|
+
|
|
3
|
+
const data: TNavMenu = {
|
|
4
|
+
label: 'Navigation',
|
|
5
|
+
items: [
|
|
6
|
+
{
|
|
7
|
+
label: 'Sign In',
|
|
8
|
+
url: '/login?location=#',
|
|
9
|
+
submenu: null
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: 'Subscribe',
|
|
13
|
+
url: '/products?segmentId=#',
|
|
14
|
+
submenu: null
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default data
|
|
@@ -3,6 +3,8 @@ import drawerUK from './drawerUK'
|
|
|
3
3
|
import editionsUK from './editionsUK'
|
|
4
4
|
import navbarRight from './navbarRight'
|
|
5
5
|
import navbarRightAnon from './navbarRightAnon'
|
|
6
|
+
import navbarTopRight from './navbarTopRight'
|
|
7
|
+
import navbarTopRightAnon from './navbarTopRightAnon'
|
|
6
8
|
import navbarSimple from './navbarSimple'
|
|
7
9
|
import navbarUK from './navbarUK'
|
|
8
10
|
import subNavigation from './subNavigationProfile'
|
|
@@ -29,6 +31,8 @@ const data: THeaderProps = {
|
|
|
29
31
|
navbar: navbarUK,
|
|
30
32
|
'navbar-right': navbarRight,
|
|
31
33
|
'navbar-right-anon': navbarRightAnon,
|
|
34
|
+
'navbar-top-right': navbarTopRight,
|
|
35
|
+
'navbar-top-right-anon': navbarTopRightAnon,
|
|
32
36
|
'navbar-simple': navbarSimple,
|
|
33
37
|
subsections,
|
|
34
38
|
'subsections-right': [
|
|
@@ -56,48 +56,6 @@ DefaultHeaderWithDrawer.args = {
|
|
|
56
56
|
showAskButton: false
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export const DefaultHeaderWithDrawerEntryTestAnon = (args) => (
|
|
60
|
-
<OnReady callback={onReadyCallback}>
|
|
61
|
-
<HeaderSimple {...storyData} {...args} />
|
|
62
|
-
<Drawer {...storyData} {...args} />
|
|
63
|
-
</OnReady>
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
DefaultHeaderWithDrawerEntryTestAnon.story = {
|
|
67
|
-
name: 'Default header with drawer - Account entry test [Anon]'
|
|
68
|
-
}
|
|
69
|
-
DefaultHeaderWithDrawerEntryTestAnon.args = {
|
|
70
|
-
showSubNavigation: true,
|
|
71
|
-
showMegaNav: true,
|
|
72
|
-
showUserNavigation: true,
|
|
73
|
-
userIsLoggedIn: false,
|
|
74
|
-
userIsSubscribed: false,
|
|
75
|
-
showLogoLink: false,
|
|
76
|
-
experimentalAccountEntryTest: true,
|
|
77
|
-
showAskButton: false
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const DefaultHeaderWithDrawerEntryTest = (args) => (
|
|
81
|
-
<OnReady callback={onReadyCallback}>
|
|
82
|
-
<HeaderSimple {...storyData} {...args} />
|
|
83
|
-
<Drawer {...storyData} {...args} />
|
|
84
|
-
</OnReady>
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
DefaultHeaderWithDrawerEntryTest.story = {
|
|
88
|
-
name: 'Default header with drawer - Account entry test'
|
|
89
|
-
}
|
|
90
|
-
DefaultHeaderWithDrawerEntryTest.args = {
|
|
91
|
-
showSubNavigation: true,
|
|
92
|
-
showMegaNav: true,
|
|
93
|
-
showUserNavigation: true,
|
|
94
|
-
userIsLoggedIn: true,
|
|
95
|
-
userIsSubscribed: false,
|
|
96
|
-
showLogoLink: false,
|
|
97
|
-
experimentalAccountEntryTest: true,
|
|
98
|
-
showAskButton: false
|
|
99
|
-
}
|
|
100
|
-
|
|
101
59
|
export const DefaultHeaderWithRightAlignedSubnav = (args) => (
|
|
102
60
|
<OnReady callback={onReadyCallback}>
|
|
103
61
|
<HeaderSimple {...profileStoryData} {...args} />
|
|
@@ -111,6 +111,7 @@ exports[`dotcom-ui-header/src/components/Drawer renders ASK FT button 1`] = `
|
|
|
111
111
|
className="ft-header__ask-ft-button ft-header__drawer-ask-ft-button"
|
|
112
112
|
data-trackable="ask-ft-button-drawer"
|
|
113
113
|
href="https://ask.ft.com"
|
|
114
|
+
id="ask-ft-button-drawer"
|
|
114
115
|
title="ASK FT"
|
|
115
116
|
>
|
|
116
117
|
<span
|
|
@@ -51,6 +51,7 @@ exports[`dotcom-ui-header/src/components/MainHeader renders ASK FT button 1`] =
|
|
|
51
51
|
className="ft-header__ask-ft-button ft-header__top-ask-ft-button"
|
|
52
52
|
data-trackable="ask-ft-button-header"
|
|
53
53
|
href="https://ask.ft.com"
|
|
54
|
+
id="ask-ft-button-header"
|
|
54
55
|
title="ASK FT"
|
|
55
56
|
>
|
|
56
57
|
<span
|
|
@@ -100,17 +101,13 @@ exports[`dotcom-ui-header/src/components/MainHeader renders ASK FT button 1`] =
|
|
|
100
101
|
Subscribe
|
|
101
102
|
</a>
|
|
102
103
|
<a
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
href="/myft"
|
|
108
|
-
id="o-header-top-link-myft"
|
|
104
|
+
className="o-header__top-link ft-header__top-link--myaccount"
|
|
105
|
+
data-trackable="My Account"
|
|
106
|
+
href="/myaccount"
|
|
107
|
+
id="o-header-top-link-myaccount"
|
|
109
108
|
>
|
|
110
|
-
<span
|
|
111
|
-
|
|
112
|
-
>
|
|
113
|
-
myFT
|
|
109
|
+
<span>
|
|
110
|
+
My Account
|
|
114
111
|
</span>
|
|
115
112
|
</a>
|
|
116
113
|
</div>
|
|
@@ -1948,17 +1945,13 @@ exports[`dotcom-ui-header/src/components/MainHeader renders a right aligned subn
|
|
|
1948
1945
|
Subscribe
|
|
1949
1946
|
</a>
|
|
1950
1947
|
<a
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
href="/myft"
|
|
1956
|
-
id="o-header-top-link-myft"
|
|
1948
|
+
className="o-header__top-link ft-header__top-link--myaccount"
|
|
1949
|
+
data-trackable="My Account"
|
|
1950
|
+
href="/myaccount"
|
|
1951
|
+
id="o-header-top-link-myaccount"
|
|
1957
1952
|
>
|
|
1958
|
-
<span
|
|
1959
|
-
|
|
1960
|
-
>
|
|
1961
|
-
myFT
|
|
1953
|
+
<span>
|
|
1954
|
+
My Account
|
|
1962
1955
|
</span>
|
|
1963
1956
|
</a>
|
|
1964
1957
|
</div>
|
|
@@ -3791,17 +3784,13 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as a logged in user
|
|
|
3791
3784
|
Subscribe
|
|
3792
3785
|
</a>
|
|
3793
3786
|
<a
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
href="/myft"
|
|
3799
|
-
id="o-header-top-link-myft"
|
|
3787
|
+
className="o-header__top-link ft-header__top-link--myaccount"
|
|
3788
|
+
data-trackable="My Account"
|
|
3789
|
+
href="/myaccount"
|
|
3790
|
+
id="o-header-top-link-myaccount"
|
|
3800
3791
|
>
|
|
3801
|
-
<span
|
|
3802
|
-
|
|
3803
|
-
>
|
|
3804
|
-
myFT
|
|
3792
|
+
<span>
|
|
3793
|
+
My Account
|
|
3805
3794
|
</span>
|
|
3806
3795
|
</a>
|
|
3807
3796
|
</div>
|
|
@@ -5639,24 +5628,13 @@ exports[`dotcom-ui-header/src/components/MainHeader renders as an anonymous user
|
|
|
5639
5628
|
Subscribe
|
|
5640
5629
|
</a>
|
|
5641
5630
|
<a
|
|
5642
|
-
className="o-header__top-link
|
|
5631
|
+
className="o-header__top-link ft-header__top-link--myaccount"
|
|
5643
5632
|
data-trackable="Sign In"
|
|
5644
5633
|
href="/login?location=#"
|
|
5634
|
+
id="o-header-top-link-signin"
|
|
5645
5635
|
>
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
<a
|
|
5649
|
-
aria-label="My F T"
|
|
5650
|
-
className="o-header__top-icon-link o-header__top-icon-link--myft o-header__top-icon-link--show-m"
|
|
5651
|
-
data-tour-stage="myFt"
|
|
5652
|
-
data-trackable="my-ft"
|
|
5653
|
-
href="/myft"
|
|
5654
|
-
id="o-header-top-link-myft"
|
|
5655
|
-
>
|
|
5656
|
-
<span
|
|
5657
|
-
className="o-header__visually-hidden"
|
|
5658
|
-
>
|
|
5659
|
-
myFT
|
|
5636
|
+
<span>
|
|
5637
|
+
Sign In
|
|
5660
5638
|
</span>
|
|
5661
5639
|
</a>
|
|
5662
5640
|
</div>
|
|
@@ -50,6 +50,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
|
|
|
50
50
|
className="ft-header__ask-ft-button ft-header__top-ask-ft-button"
|
|
51
51
|
data-trackable="ask-ft-button-sticky"
|
|
52
52
|
href="https://ask.ft.com"
|
|
53
|
+
id="ask-ft-button-sticky"
|
|
53
54
|
title="ASK FT"
|
|
54
55
|
>
|
|
55
56
|
<span
|
|
@@ -32,10 +32,6 @@ describe('dotcom-ui-header', () => {
|
|
|
32
32
|
|
|
33
33
|
const logo = container.querySelector('div[data-trackable="header-top"] .o-header__top-logo')
|
|
34
34
|
expect(logo?.hasChildNodes()).toBe(true)
|
|
35
|
-
|
|
36
|
-
const myFtLink = container.querySelector('div[data-trackable="header-top"] .o-header__top-icon-link--myft')
|
|
37
|
-
expect(myFtLink?.innerHTML).toContain('myFT')
|
|
38
|
-
|
|
39
35
|
})
|
|
40
36
|
|
|
41
37
|
it('renders an inlined SVG logo image', () => {
|
|
@@ -64,7 +60,8 @@ describe('dotcom-ui-header', () => {
|
|
|
64
60
|
const { container } = render(subscribedUserHeader)
|
|
65
61
|
|
|
66
62
|
expect(container.querySelector('a[data-trackable="Portfolio"]')).not.toBeNull()
|
|
67
|
-
expect(container.querySelector('a[data-trackable="
|
|
63
|
+
expect(container.querySelector('a[data-trackable="My Account"]')).not.toBeNull()
|
|
64
|
+
expect(container.querySelector('a[data-trackable="myFT Feed"]')).not.toBeNull()
|
|
68
65
|
})
|
|
69
66
|
|
|
70
67
|
it('does not render sign in link', () => {
|
|
@@ -80,7 +77,8 @@ describe('dotcom-ui-header', () => {
|
|
|
80
77
|
const { container } = render(loggedInUserHeader)
|
|
81
78
|
|
|
82
79
|
expect(container.querySelector('a[data-trackable="Portfolio"]')).not.toBeNull()
|
|
83
|
-
expect(container.querySelector('a[data-trackable="
|
|
80
|
+
expect(container.querySelector('a[data-trackable="My Account"]')).not.toBeNull()
|
|
81
|
+
expect(container.querySelector('a[data-trackable="myFT Feed"]')).not.toBeNull()
|
|
84
82
|
})
|
|
85
83
|
|
|
86
84
|
it('does not render sign in link', () => {
|
|
@@ -96,10 +94,14 @@ describe('dotcom-ui-header', () => {
|
|
|
96
94
|
const { container } = render(anonymousUserHeader)
|
|
97
95
|
|
|
98
96
|
expect(
|
|
99
|
-
container.querySelector(
|
|
97
|
+
container.querySelector(
|
|
98
|
+
'.o-header__top-column .o-header__top-column--right a[data-trackable="Subscribe"]'
|
|
99
|
+
)
|
|
100
100
|
).not.toBeNull()
|
|
101
|
-
|
|
102
|
-
container.querySelector(
|
|
101
|
+
expect(
|
|
102
|
+
container.querySelector(
|
|
103
|
+
'.o-header__top-column .o-header__top-column--right a[data-trackable="Sign In"]'
|
|
104
|
+
)
|
|
103
105
|
).not.toBeNull()
|
|
104
106
|
})
|
|
105
107
|
|
|
@@ -107,7 +109,8 @@ describe('dotcom-ui-header', () => {
|
|
|
107
109
|
const { container } = render(anonymousUserHeader)
|
|
108
110
|
|
|
109
111
|
expect(container.querySelector('a[data-trackable="Portfolio"]')).toBeNull()
|
|
110
|
-
expect(container.querySelector('a[data-trackable="
|
|
112
|
+
expect(container.querySelector('a[data-trackable="My Account"]')).toBeNull()
|
|
113
|
+
expect(container.querySelector('a[data-trackable="myFT Feed"]')).toBeNull()
|
|
111
114
|
})
|
|
112
115
|
})
|
|
113
116
|
})
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
export interface AskFtButtonProps {
|
|
4
|
+
id: string
|
|
4
5
|
className: string
|
|
5
6
|
dataTrackable: string
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
export const AskFtButton = ({ className, dataTrackable }: AskFtButtonProps) => (
|
|
9
|
+
export const AskFtButton = ({ id, className, dataTrackable }: AskFtButtonProps) => (
|
|
9
10
|
<a
|
|
11
|
+
id={id}
|
|
10
12
|
className={`ft-header__ask-ft-button ${className}`}
|
|
11
13
|
data-trackable={dataTrackable}
|
|
12
14
|
href="https://ask.ft.com"
|
|
@@ -97,7 +97,11 @@ const Search = (props: Pick<THeaderProps, 'showAskButton'>) => (
|
|
|
97
97
|
<span className="o-header__visually-hidden">Search</span>
|
|
98
98
|
</button>
|
|
99
99
|
{props.showAskButton && (
|
|
100
|
-
<AskFtButton
|
|
100
|
+
<AskFtButton
|
|
101
|
+
className="ft-header__drawer-ask-ft-button"
|
|
102
|
+
id="ask-ft-button-drawer"
|
|
103
|
+
dataTrackable="ask-ft-button-drawer"
|
|
104
|
+
/>
|
|
101
105
|
)}
|
|
102
106
|
</form>
|
|
103
107
|
</div>
|
|
@@ -80,23 +80,15 @@ const NavListRight = (props: THeaderProps) => {
|
|
|
80
80
|
return props.userIsLoggedIn ? (
|
|
81
81
|
<NavListRightLoggedIn
|
|
82
82
|
items={props.data['navbar-right'].items}
|
|
83
|
-
experimentalAccountEntryTest={props.experimentalAccountEntryTest}
|
|
84
83
|
/>
|
|
85
84
|
) : null
|
|
86
85
|
}
|
|
87
86
|
|
|
88
87
|
const NavListRightLoggedIn = ({
|
|
89
88
|
items,
|
|
90
|
-
experimentalAccountEntryTest
|
|
91
89
|
}: {
|
|
92
90
|
items: TNavMenuItem[]
|
|
93
|
-
experimentalAccountEntryTest?: boolean
|
|
94
91
|
}) => {
|
|
95
|
-
/**
|
|
96
|
-
* Accounts entry test
|
|
97
|
-
* In this rendering theres a hacky solution to replace "Settings & Account" with "MyFT Feed"
|
|
98
|
-
* Once the test is concluded the real data should be updated accordingly and the hack removed
|
|
99
|
-
*/
|
|
100
92
|
return (
|
|
101
93
|
<ul
|
|
102
94
|
data-component="nav-list--right"
|
|
@@ -105,15 +97,9 @@ const NavListRightLoggedIn = ({
|
|
|
105
97
|
>
|
|
106
98
|
{items.map((item, index) => (
|
|
107
99
|
<li className="o-header__nav-item" key={`link-${index}`}>
|
|
108
|
-
{item.label === 'Settings & Account' && experimentalAccountEntryTest ? (
|
|
109
|
-
<a className="o-header__nav-link" href="/myft" data-trackable="my-ft">
|
|
110
|
-
myFT Feed
|
|
111
|
-
</a>
|
|
112
|
-
) : (
|
|
113
100
|
<a className="o-header__nav-link" href={item.url ?? undefined} data-trackable={item.label}>
|
|
114
101
|
{item.label}
|
|
115
102
|
</a>
|
|
116
|
-
)}
|
|
117
103
|
</li>
|
|
118
104
|
))}
|
|
119
105
|
</ul>
|
|
@@ -114,7 +114,11 @@ const TopColumnLeftSticky = (props: Pick<THeaderProps, 'showAskButton'>) => {
|
|
|
114
114
|
<DrawerIconSticky />
|
|
115
115
|
<SearchIconSticky />
|
|
116
116
|
{props.showAskButton && (
|
|
117
|
-
<AskFtButton
|
|
117
|
+
<AskFtButton
|
|
118
|
+
className="ft-header__top-ask-ft-button"
|
|
119
|
+
id="ask-ft-button-sticky"
|
|
120
|
+
dataTrackable="ask-ft-button-sticky"
|
|
121
|
+
/>
|
|
118
122
|
)}
|
|
119
123
|
</div>
|
|
120
124
|
)
|
|
@@ -40,61 +40,15 @@ const SearchIcon = () => (
|
|
|
40
40
|
</a>
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
className,
|
|
45
|
-
signedIn,
|
|
46
|
-
experimentalAccountEntryTest
|
|
47
|
-
}: {
|
|
48
|
-
className?: string
|
|
49
|
-
signedIn: boolean
|
|
50
|
-
experimentalAccountEntryTest?: boolean
|
|
51
|
-
}) => {
|
|
52
|
-
if (experimentalAccountEntryTest) {
|
|
53
|
-
return <MyAccountLink signedIn={signedIn} />
|
|
54
|
-
} else {
|
|
55
|
-
return <MyFtLogoLink className={className} />
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const MyFtLogoLink = ({ className }: { className?: string }) => (
|
|
60
|
-
<a
|
|
61
|
-
className={`o-header__top-icon-link o-header__top-icon-link--myft ${className}`}
|
|
62
|
-
id="o-header-top-link-myft"
|
|
63
|
-
href="/myft"
|
|
64
|
-
data-trackable="my-ft"
|
|
65
|
-
data-tour-stage="myFt"
|
|
66
|
-
aria-label="My F T"
|
|
67
|
-
>
|
|
68
|
-
<span className="o-header__visually-hidden">myFT</span>
|
|
69
|
-
</a>
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
const MyAccountLink = ({ signedIn }: { signedIn: boolean }) => {
|
|
43
|
+
const MyAccountLink = ({ item, signedIn }: { item: TNavMenuItem; signedIn: boolean }) => {
|
|
73
44
|
const classNames = 'o-header__top-link ft-header__top-link--myaccount'
|
|
45
|
+
const id = signedIn ? 'o-header-top-link-myaccount' : 'o-header-top-link-signin'
|
|
74
46
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
href="/myaccount"
|
|
81
|
-
data-trackable="my-account"
|
|
82
|
-
>
|
|
83
|
-
<span>My Account</span>
|
|
84
|
-
</a>
|
|
85
|
-
)
|
|
86
|
-
} else {
|
|
87
|
-
return (
|
|
88
|
-
<a
|
|
89
|
-
className={classNames}
|
|
90
|
-
id="o-header-top-link-signin"
|
|
91
|
-
href="/login?location=/"
|
|
92
|
-
data-trackable="Sign In"
|
|
93
|
-
>
|
|
94
|
-
<span>Sign In</span>
|
|
95
|
-
</a>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
47
|
+
return (
|
|
48
|
+
<a className={classNames} id={id} href={item.url || undefined} data-trackable={item.label}>
|
|
49
|
+
<span>{item.label}</span>
|
|
50
|
+
</a>
|
|
51
|
+
)
|
|
98
52
|
}
|
|
99
53
|
|
|
100
54
|
const TopWrapper = (props) => (
|
|
@@ -110,7 +64,11 @@ const TopColumnLeft = (props: Pick<THeaderProps, 'showAskButton'>) => (
|
|
|
110
64
|
<DrawerIcon />
|
|
111
65
|
<SearchIcon />
|
|
112
66
|
{props.showAskButton && (
|
|
113
|
-
<AskFtButton
|
|
67
|
+
<AskFtButton
|
|
68
|
+
className="ft-header__top-ask-ft-button"
|
|
69
|
+
id="ask-ft-button-header"
|
|
70
|
+
dataTrackable="ask-ft-button-header"
|
|
71
|
+
/>
|
|
114
72
|
)}
|
|
115
73
|
</div>
|
|
116
74
|
)
|
|
@@ -138,7 +96,8 @@ const TopColumnCenterNoLink = () => (
|
|
|
138
96
|
)
|
|
139
97
|
|
|
140
98
|
const TopColumnRightLoggedIn = (props: THeaderProps) => {
|
|
141
|
-
const
|
|
99
|
+
const signInAction = props.data['navbar-top-right']?.items?.[0]
|
|
100
|
+
const subscribeAction = props.data['navbar-top-right']?.items?.[1]
|
|
142
101
|
return (
|
|
143
102
|
<div className="o-header__top-column o-header__top-column--right">
|
|
144
103
|
{!props.userIsSubscribed && subscribeAction && (
|
|
@@ -148,11 +107,7 @@ const TopColumnRightLoggedIn = (props: THeaderProps) => {
|
|
|
148
107
|
className="o-header__top-button--hide-m"
|
|
149
108
|
/>
|
|
150
109
|
)}
|
|
151
|
-
<
|
|
152
|
-
className=""
|
|
153
|
-
signedIn={true}
|
|
154
|
-
experimentalAccountEntryTest={props.experimentalAccountEntryTest}
|
|
155
|
-
/>
|
|
110
|
+
{signInAction && <MyAccountLink item={signInAction} signedIn={true} />}
|
|
156
111
|
</div>
|
|
157
112
|
)
|
|
158
113
|
}
|
|
@@ -203,15 +158,7 @@ const SubscribeButton = ({
|
|
|
203
158
|
)
|
|
204
159
|
}
|
|
205
160
|
|
|
206
|
-
const TopColumnRightAnon = ({
|
|
207
|
-
items,
|
|
208
|
-
variant,
|
|
209
|
-
experimentalAccountEntryTest
|
|
210
|
-
}: {
|
|
211
|
-
items: TNavMenuItem[]
|
|
212
|
-
variant?: string
|
|
213
|
-
experimentalAccountEntryTest?: boolean
|
|
214
|
-
}) => {
|
|
161
|
+
const TopColumnRightAnon = ({ items, variant }: { items: TNavMenuItem[]; variant?: string }) => {
|
|
215
162
|
// If user is anonymous the second list item is styled as a button
|
|
216
163
|
const [signInAction, subscribeAction] = items
|
|
217
164
|
|
|
@@ -220,14 +167,7 @@ const TopColumnRightAnon = ({
|
|
|
220
167
|
{subscribeAction && (
|
|
221
168
|
<SubscribeButton item={subscribeAction} variant={variant} className="o-header__top-button--hide-m" />
|
|
222
169
|
)}
|
|
223
|
-
{signInAction &&
|
|
224
|
-
<SignInLink item={signInAction} variant={variant} className="o-header__top-link--hide-m" />
|
|
225
|
-
)}
|
|
226
|
-
<TopRightAccountEntry
|
|
227
|
-
className="o-header__top-icon-link--show-m"
|
|
228
|
-
signedIn={false}
|
|
229
|
-
experimentalAccountEntryTest={experimentalAccountEntryTest}
|
|
230
|
-
/>
|
|
170
|
+
{signInAction && <MyAccountLink item={signInAction} signedIn={false} />}
|
|
231
171
|
</div>
|
|
232
172
|
)
|
|
233
173
|
}
|
|
@@ -236,14 +176,8 @@ const TopColumnRight = (props: THeaderProps) => {
|
|
|
236
176
|
if (props.userIsLoggedIn) {
|
|
237
177
|
return <TopColumnRightLoggedIn {...props} />
|
|
238
178
|
} else {
|
|
239
|
-
const userNavAnonItems = props.data['navbar-right-anon'].items
|
|
240
|
-
return
|
|
241
|
-
<TopColumnRightAnon
|
|
242
|
-
items={userNavAnonItems}
|
|
243
|
-
variant={props.variant}
|
|
244
|
-
experimentalAccountEntryTest={props.experimentalAccountEntryTest}
|
|
245
|
-
/>
|
|
246
|
-
)
|
|
179
|
+
const userNavAnonItems = props.data['navbar-top-right-anon'].items
|
|
180
|
+
return <TopColumnRightAnon items={userNavAnonItems} variant={props.variant} />
|
|
247
181
|
}
|
|
248
182
|
}
|
|
249
183
|
|
package/src/interfaces.d.ts
CHANGED
|
@@ -11,12 +11,6 @@ export type THeaderOptions = {
|
|
|
11
11
|
showMegaNav?: boolean
|
|
12
12
|
showLogoLink?: boolean
|
|
13
13
|
showAskButton?: boolean
|
|
14
|
-
/*
|
|
15
|
-
* experimentalAccountEntryTest is an experimental feature switch
|
|
16
|
-
* This is being run as an AB test and should be removed afterwards
|
|
17
|
-
* This option shouldn't be used by anyone without consulting the CP Retention team first
|
|
18
|
-
*/
|
|
19
|
-
experimentalAccountEntryTest?: boolean
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
export type THeaderProps = THeaderOptions & {
|