@financial-times/dotcom-ui-header 11.0.1 → 11.0.3
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/drawer/additionalPartials.js +1 -2
- package/dist/node/components/drawer/topLevelPartials.js +5 -2
- package/dist/tsconfig.tsbuildinfo +2 -2
- package/package.json +3 -3
- package/src/__test__/components/__snapshots__/Drawer.spec.tsx.snap +9 -9
- package/src/components/drawer/additionalPartials.tsx +18 -17
- package/src/components/drawer/topLevelPartials.tsx +9 -3
|
@@ -42,6 +42,5 @@ const EditionsSwitcher = (editions) => {
|
|
|
42
42
|
_b.map(({ name, id, url }) => (react_1.default.createElement("a", { key: id, className: "o-header__drawer-menu-link", href: `${url}?edition=${id}` }, name)))));
|
|
43
43
|
};
|
|
44
44
|
exports.EditionsSwitcher = EditionsSwitcher;
|
|
45
|
-
const SubscribeButton = (action) => (react_1.default.createElement("
|
|
46
|
-
react_1.default.createElement("a", { className: "o-header__drawer-button", role: "button", href: action.url, "data-trackable": "subscribe-button" }, action.name)));
|
|
45
|
+
const SubscribeButton = (action) => (react_1.default.createElement("a", { className: "o-header__drawer-button", role: "button", href: action.url, "data-trackable": "subscribe-button" }, action.name));
|
|
47
46
|
exports.SubscribeButton = SubscribeButton;
|
|
@@ -14,12 +14,15 @@ const Drawer = (props) => {
|
|
|
14
14
|
const subscribeAction = props.data.subscribeAction;
|
|
15
15
|
const [primary, secondary, tertiary] = props.data.drawer.items;
|
|
16
16
|
const user = props.userIsLoggedIn ? props.data.user : props.data.anon;
|
|
17
|
+
const showSubscribeButton = !props.userIsSubscribed && subscribeAction;
|
|
18
|
+
const showDrawerActions = props.showAskButton || showSubscribeButton;
|
|
17
19
|
return (react_1.default.createElement("div", { className: "o-header__drawer", id: "o-header-drawer", role: "modal", "aria-label": "Drawer menu", "aria-modal": "true", "data-o-header-drawer": true, "data-o-header-drawer--no-js": true, "data-trackable": "drawer", "data-trackable-terminate": true },
|
|
18
20
|
react_1.default.createElement("div", { className: "o-header__drawer-inner" },
|
|
19
21
|
react_1.default.createElement(DrawerTools, Object.assign({}, editions)),
|
|
20
22
|
react_1.default.createElement(Search, null),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
showDrawerActions && (react_1.default.createElement("div", { className: "o-header__drawer-actions" },
|
|
24
|
+
props.showAskButton && (react_1.default.createElement(askFtButton_1.AskFtButton, { variant: "drawer", dataTrackable: "ask-ft-button-drawer", id: "ask-ft-button-drawer" })),
|
|
25
|
+
showSubscribeButton && subscribeAction && react_1.default.createElement(additionalPartials_1.SubscribeButton, Object.assign({}, subscribeAction)))),
|
|
23
26
|
react_1.default.createElement("nav", { className: "o-header__drawer-menu o-header__drawer-menu--primary" },
|
|
24
27
|
primary ? react_1.default.createElement(SectionPrimary, Object.assign({}, primary)) : null,
|
|
25
28
|
secondary ? react_1.default.createElement(SectionSecondary, Object.assign({}, secondary)) : null,
|
|
@@ -212,12 +212,12 @@
|
|
|
212
212
|
"affectsGlobalScope": false
|
|
213
213
|
},
|
|
214
214
|
"../src/components/drawer/additionalPartials.tsx": {
|
|
215
|
-
"version": "
|
|
215
|
+
"version": "5b1649b0dc6ece11b51fb0fc04404e71521b66bf30dade6b63e0345b5b015432",
|
|
216
216
|
"signature": "4d2af22c877fa282f11402da8da4ccabca6e1c6515b03579caa84e44a3a56067",
|
|
217
217
|
"affectsGlobalScope": false
|
|
218
218
|
},
|
|
219
219
|
"../src/components/drawer/topLevelPartials.tsx": {
|
|
220
|
-
"version": "
|
|
220
|
+
"version": "c0f060328d36190f0107473ce85c0fd0463a2c04963f08606ae9bb78b0e17b3c",
|
|
221
221
|
"signature": "9d1b0a09950f10403acbd59a85db578c3d6d0eec6d4fd6b26deacd7fc69b5bb4",
|
|
222
222
|
"affectsGlobalScope": false
|
|
223
223
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/dotcom-ui-header",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "browser.js",
|
|
6
6
|
"main": "component.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@financial-times/dotcom-types-navigation": "^11.0.
|
|
26
|
-
"n-topic-search": "^8.0.
|
|
25
|
+
"@financial-times/dotcom-types-navigation": "^11.0.3",
|
|
26
|
+
"n-topic-search": "^8.0.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@financial-times/logo-images": "^1.10.1",
|
|
@@ -117,18 +117,18 @@ exports[`dotcom-ui-header/src/components/Drawer renders ASK FT button 1`] = `
|
|
|
117
117
|
</label>
|
|
118
118
|
</form>
|
|
119
119
|
</div>
|
|
120
|
-
<a
|
|
121
|
-
className="o-header__ask-ft-button o-header__ask-ft-button--drawer"
|
|
122
|
-
data-trackable="ask-ft-button-drawer"
|
|
123
|
-
href="https://ask.ft.com"
|
|
124
|
-
id="ask-ft-button-drawer"
|
|
125
|
-
title="ASK FT"
|
|
126
|
-
>
|
|
127
|
-
Ask FT
|
|
128
|
-
</a>
|
|
129
120
|
<div
|
|
130
121
|
className="o-header__drawer-actions"
|
|
131
122
|
>
|
|
123
|
+
<a
|
|
124
|
+
className="o-header__ask-ft-button o-header__ask-ft-button--drawer"
|
|
125
|
+
data-trackable="ask-ft-button-drawer"
|
|
126
|
+
href="https://ask.ft.com"
|
|
127
|
+
id="ask-ft-button-drawer"
|
|
128
|
+
title="ASK FT"
|
|
129
|
+
>
|
|
130
|
+
Ask FT
|
|
131
|
+
</a>
|
|
132
132
|
<a
|
|
133
133
|
className="o-header__drawer-button"
|
|
134
134
|
data-trackable="subscribe-button"
|
|
@@ -16,20 +16,23 @@ export const DrawerParentItem = ({ item, idSuffix }: TDrawerParentItemProps) =>
|
|
|
16
16
|
className={`o-header__drawer-menu-link o-header__drawer-menu-link--${selected} o-header__drawer-menu-link--parent`}
|
|
17
17
|
href={item.url ?? undefined}
|
|
18
18
|
{...ariaSelected(item)}
|
|
19
|
-
data-trackable={item.label}
|
|
19
|
+
data-trackable={item.label}
|
|
20
|
+
>
|
|
20
21
|
{item.label}
|
|
21
22
|
</a>
|
|
22
23
|
<button
|
|
23
24
|
className={`o-header__drawer-menu-toggle o-header__drawer-menu-toggle--${selected}`}
|
|
24
25
|
aria-controls={`o-header-drawer-child-${idSuffix}`}
|
|
25
|
-
data-trackable={`sub-level-toggle | ${item.label}`}
|
|
26
|
+
data-trackable={`sub-level-toggle | ${item.label}`}
|
|
27
|
+
>
|
|
26
28
|
{`Show more ${item.label}`}
|
|
27
29
|
</button>
|
|
28
30
|
</div>
|
|
29
31
|
<ul
|
|
30
32
|
className="o-header__drawer-menu-list o-header__drawer-menu-list--child"
|
|
31
33
|
id={`o-header-drawer-child-${idSuffix}`}
|
|
32
|
-
data-trackable="sub-level"
|
|
34
|
+
data-trackable="sub-level"
|
|
35
|
+
>
|
|
33
36
|
{(item.submenu?.items as TNavMenuItem[]).map((item) => {
|
|
34
37
|
const selected = item.selected ? 'selected' : 'unselected'
|
|
35
38
|
return (
|
|
@@ -38,7 +41,8 @@ export const DrawerParentItem = ({ item, idSuffix }: TDrawerParentItemProps) =>
|
|
|
38
41
|
className={`o-header__drawer-menu-link o-header__drawer-menu-link--${selected} o-header__drawer-menu-link--child`}
|
|
39
42
|
href={item.url ?? undefined}
|
|
40
43
|
data-trackable={item.label}
|
|
41
|
-
{...ariaSelected(item)}
|
|
44
|
+
{...ariaSelected(item)}
|
|
45
|
+
>
|
|
42
46
|
{item.label}
|
|
43
47
|
</a>
|
|
44
48
|
</li>
|
|
@@ -56,7 +60,8 @@ export const DrawerSingleItem = (item: TNavMenuItem) => {
|
|
|
56
60
|
className={`o-header__drawer-menu-link o-header__drawer-menu-link--${selected}`}
|
|
57
61
|
href={item.url ?? undefined}
|
|
58
62
|
data-trackable={item.label}
|
|
59
|
-
{...ariaSelected(item)}
|
|
63
|
+
{...ariaSelected(item)}
|
|
64
|
+
>
|
|
60
65
|
{item.label}
|
|
61
66
|
</a>
|
|
62
67
|
)
|
|
@@ -69,34 +74,30 @@ export const DrawerSpecialItem = (item: TNavMenuItem) => {
|
|
|
69
74
|
className={`o-header__drawer-menu-link o-header__drawer-menu-link--${selected} o-header__drawer-menu-link--secondary`}
|
|
70
75
|
href={item.url ?? undefined}
|
|
71
76
|
data-trackable={item.label}
|
|
72
|
-
{...ariaSelected(item)}
|
|
77
|
+
{...ariaSelected(item)}
|
|
78
|
+
>
|
|
73
79
|
{item.label}
|
|
74
80
|
</a>
|
|
75
81
|
)
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
export const EditionsSwitcher = (editions: TNavEditions) => (
|
|
79
|
-
<nav
|
|
80
|
-
className="o-header__drawer-menu o-header__drawer-edition-switcher"
|
|
81
|
-
aria-label="Edition switcher">
|
|
85
|
+
<nav className="o-header__drawer-menu o-header__drawer-edition-switcher" aria-label="Edition switcher">
|
|
82
86
|
<span className="o-header__drawer-menu-item">Edition:</span>
|
|
83
87
|
<span className="o-header__drawer-menu-item o-header__drawer-current-edition">
|
|
84
88
|
{editions.current?.name}
|
|
85
89
|
</span>
|
|
86
90
|
<div className="o-header__drawer-divider"></div>
|
|
87
|
-
{editions.others?.map(({name, id, url}) => (
|
|
91
|
+
{editions.others?.map(({ name, id, url }) => (
|
|
88
92
|
<a key={id} className="o-header__drawer-menu-link" href={`${url}?edition=${id}`}>
|
|
89
93
|
{name}
|
|
90
94
|
</a>
|
|
91
95
|
))}
|
|
92
96
|
</nav>
|
|
93
|
-
)
|
|
94
|
-
|
|
97
|
+
)
|
|
95
98
|
|
|
96
99
|
export const SubscribeButton = (action: TNavAction) => (
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</a>
|
|
101
|
-
</div>
|
|
100
|
+
<a className="o-header__drawer-button" role="button" href={action.url} data-trackable="subscribe-button">
|
|
101
|
+
{action.name}
|
|
102
|
+
</a>
|
|
102
103
|
)
|
|
@@ -17,6 +17,8 @@ const Drawer = (props: THeaderProps) => {
|
|
|
17
17
|
const subscribeAction = props.data.subscribeAction
|
|
18
18
|
const [primary, secondary, tertiary] = props.data.drawer.items
|
|
19
19
|
const user = props.userIsLoggedIn ? props.data.user : props.data.anon
|
|
20
|
+
const showSubscribeButton = !props.userIsSubscribed && subscribeAction
|
|
21
|
+
const showDrawerActions = props.showAskButton || showSubscribeButton
|
|
20
22
|
|
|
21
23
|
return (
|
|
22
24
|
<div
|
|
@@ -33,10 +35,14 @@ const Drawer = (props: THeaderProps) => {
|
|
|
33
35
|
<div className="o-header__drawer-inner">
|
|
34
36
|
<DrawerTools {...editions} />
|
|
35
37
|
<Search />
|
|
36
|
-
{
|
|
37
|
-
<
|
|
38
|
+
{showDrawerActions && (
|
|
39
|
+
<div className="o-header__drawer-actions">
|
|
40
|
+
{props.showAskButton && (
|
|
41
|
+
<AskFtButton variant="drawer" dataTrackable="ask-ft-button-drawer" id="ask-ft-button-drawer" />
|
|
42
|
+
)}
|
|
43
|
+
{showSubscribeButton && subscribeAction && <SubscribeButton {...subscribeAction} />}
|
|
44
|
+
</div>
|
|
38
45
|
)}
|
|
39
|
-
{!props.userIsSubscribed && subscribeAction && <SubscribeButton {...subscribeAction} />}
|
|
40
46
|
<nav className="o-header__drawer-menu o-header__drawer-menu--primary">
|
|
41
47
|
{primary ? <SectionPrimary {...primary} /> : null}
|
|
42
48
|
{secondary ? <SectionSecondary {...secondary} /> : null}
|