@financial-times/dotcom-ui-header 13.2.3 → 13.4.0-beta.0
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/README.md +15 -15
- package/browser.js +1 -0
- package/dist/node/components/drawer/topLevelPartials.js +1 -1
- package/dist/node/components/mpr/mprButton.d.ts +3 -0
- package/dist/node/components/mpr/mprButton.js +16 -0
- package/dist/node/components/navigation/partials.js +5 -5
- package/dist/node/components/search/partials.js +1 -1
- package/dist/node/components/sticky/partials.js +1 -1
- package/dist/node/components/top/partials.d.ts +1 -1
- package/dist/node/components/top/partials.js +6 -4
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/__test__/components/MainHeader.spec.tsx +11 -0
- package/src/__test__/components/__snapshots__/Drawer.spec.tsx.snap +3 -0
- package/src/__test__/components/__snapshots__/MainHeader.spec.tsx.snap +4090 -270
- package/src/__test__/components/__snapshots__/NoOutboundLinks.spec.tsx.snap +2 -0
- package/src/__test__/components/__snapshots__/StickyHeader.spec.tsx.snap +15 -0
- package/src/components/ask-ft/askFtButton.scss +2 -1
- package/src/components/drawer/topLevelPartials.tsx +1 -1
- package/src/components/mpr/mprButton.scss +9 -0
- package/src/components/mpr/mprButton.tsx +22 -0
- package/src/components/navigation/partials.tsx +13 -2
- package/src/components/search/partials.tsx +1 -0
- package/src/components/sticky/partials.tsx +1 -0
- package/src/components/top/partials.tsx +14 -3
- package/src/header.scss +3 -0
- package/src/index.tsx +2 -1
- package/src/interfaces.d.ts +1 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports[`dotcom-ui-header/src/components/NoOutboundLinksHeader renders as a logged in user 1`] = `
|
|
4
4
|
<header
|
|
5
5
|
className="o-header o-header--simple"
|
|
6
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
6
7
|
data-o-component="o-header"
|
|
7
8
|
data-o-header--no-js={true}
|
|
8
9
|
id="site-navigation"
|
|
@@ -171,6 +172,7 @@ exports[`dotcom-ui-header/src/components/NoOutboundLinksHeader renders as a logg
|
|
|
171
172
|
exports[`dotcom-ui-header/src/components/NoOutboundLinksHeader renders as an anonymous user 1`] = `
|
|
172
173
|
<header
|
|
173
174
|
className="o-header o-header--simple"
|
|
175
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
174
176
|
data-o-component="o-header"
|
|
175
177
|
data-o-header--no-js={true}
|
|
176
178
|
id="site-navigation"
|
|
@@ -4,6 +4,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
|
|
|
4
4
|
<header
|
|
5
5
|
aria-hidden="true"
|
|
6
6
|
className="o-header o-header--simple o-header--sticky o--if-js"
|
|
7
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
7
8
|
data-o-component="o-header"
|
|
8
9
|
data-o-header--sticky={true}
|
|
9
10
|
>
|
|
@@ -221,6 +222,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
|
|
|
221
222
|
</div>
|
|
222
223
|
<div
|
|
223
224
|
className="o-header__top-column o-header__top-column--right"
|
|
225
|
+
data-ft-origin="npm:@financial-times/middleware-user-data"
|
|
224
226
|
>
|
|
225
227
|
<a
|
|
226
228
|
className="o-header__top-button o-header__top-button--hide-m"
|
|
@@ -248,6 +250,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders ASK FT button 1`]
|
|
|
248
250
|
</div>
|
|
249
251
|
<div
|
|
250
252
|
className="o-header__row o-header__search o-header__search--sticky"
|
|
253
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
251
254
|
data-o-header-search={true}
|
|
252
255
|
data-trackable="header-search"
|
|
253
256
|
id="o-header-search-sticky"
|
|
@@ -335,6 +338,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders FT Pro dropdown me
|
|
|
335
338
|
<header
|
|
336
339
|
aria-hidden="true"
|
|
337
340
|
className="o-header o-header--simple o-header--sticky o--if-js"
|
|
341
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
338
342
|
data-o-component="o-header"
|
|
339
343
|
data-o-header--sticky={true}
|
|
340
344
|
>
|
|
@@ -542,6 +546,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders FT Pro dropdown me
|
|
|
542
546
|
</div>
|
|
543
547
|
<div
|
|
544
548
|
className="o-header__top-column o-header__top-column--right"
|
|
549
|
+
data-ft-origin="npm:@financial-times/middleware-user-data"
|
|
545
550
|
>
|
|
546
551
|
<a
|
|
547
552
|
className="o-header__top-button o-header__top-button--hide-m"
|
|
@@ -846,6 +851,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders FT Pro dropdown me
|
|
|
846
851
|
</div>
|
|
847
852
|
<div
|
|
848
853
|
className="o-header__row o-header__search o-header__search--sticky"
|
|
854
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
849
855
|
data-o-header-search={true}
|
|
850
856
|
data-trackable="header-search"
|
|
851
857
|
id="o-header-search-sticky"
|
|
@@ -933,6 +939,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as a logged in use
|
|
|
933
939
|
<header
|
|
934
940
|
aria-hidden="true"
|
|
935
941
|
className="o-header o-header--simple o-header--sticky o--if-js"
|
|
942
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
936
943
|
data-o-component="o-header"
|
|
937
944
|
data-o-header--sticky={true}
|
|
938
945
|
>
|
|
@@ -1140,6 +1147,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as a logged in use
|
|
|
1140
1147
|
</div>
|
|
1141
1148
|
<div
|
|
1142
1149
|
className="o-header__top-column o-header__top-column--right"
|
|
1150
|
+
data-ft-origin="npm:@financial-times/middleware-user-data"
|
|
1143
1151
|
>
|
|
1144
1152
|
<a
|
|
1145
1153
|
className="o-header__top-button o-header__top-button--hide-m"
|
|
@@ -1167,6 +1175,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as a logged in use
|
|
|
1167
1175
|
</div>
|
|
1168
1176
|
<div
|
|
1169
1177
|
className="o-header__row o-header__search o-header__search--sticky"
|
|
1178
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
1170
1179
|
data-o-header-search={true}
|
|
1171
1180
|
data-trackable="header-search"
|
|
1172
1181
|
id="o-header-search-sticky"
|
|
@@ -1254,6 +1263,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as an anonymous us
|
|
|
1254
1263
|
<header
|
|
1255
1264
|
aria-hidden="true"
|
|
1256
1265
|
className="o-header o-header--simple o-header--sticky o--if-js"
|
|
1266
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
1257
1267
|
data-o-component="o-header"
|
|
1258
1268
|
data-o-header--sticky={true}
|
|
1259
1269
|
>
|
|
@@ -1461,6 +1471,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as an anonymous us
|
|
|
1461
1471
|
</div>
|
|
1462
1472
|
<div
|
|
1463
1473
|
className="o-header__top-column o-header__top-column--right"
|
|
1474
|
+
data-ft-origin="npm:@financial-times/middleware-user-data"
|
|
1464
1475
|
>
|
|
1465
1476
|
<a
|
|
1466
1477
|
className="o-header__top-button o-header__top-button--hide-m"
|
|
@@ -1488,6 +1499,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders as an anonymous us
|
|
|
1488
1499
|
</div>
|
|
1489
1500
|
<div
|
|
1490
1501
|
className="o-header__row o-header__search o-header__search--sticky"
|
|
1502
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
1491
1503
|
data-o-header-search={true}
|
|
1492
1504
|
data-trackable="header-search"
|
|
1493
1505
|
id="o-header-search-sticky"
|
|
@@ -1575,6 +1587,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders restart subscripti
|
|
|
1575
1587
|
<header
|
|
1576
1588
|
aria-hidden="true"
|
|
1577
1589
|
className="o-header o-header--simple o-header--sticky o--if-js"
|
|
1590
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
1578
1591
|
data-o-component="o-header"
|
|
1579
1592
|
data-o-header--sticky={true}
|
|
1580
1593
|
>
|
|
@@ -1782,6 +1795,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders restart subscripti
|
|
|
1782
1795
|
</div>
|
|
1783
1796
|
<div
|
|
1784
1797
|
className="o-header__top-column o-header__top-column--right"
|
|
1798
|
+
data-ft-origin="npm:@financial-times/middleware-user-data"
|
|
1785
1799
|
>
|
|
1786
1800
|
<a
|
|
1787
1801
|
className="o-header__top-button o3-button o3-button--primary o3-button--small o-header__top-button--hide-m"
|
|
@@ -1818,6 +1832,7 @@ exports[`dotcom-ui-header/src/components/StickyHeader renders restart subscripti
|
|
|
1818
1832
|
</div>
|
|
1819
1833
|
<div
|
|
1820
1834
|
className="o-header__row o-header__search o-header__search--sticky"
|
|
1835
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
1821
1836
|
data-o-header-search={true}
|
|
1822
1837
|
data-trackable="header-search"
|
|
1823
1838
|
id="o-header-search-sticky"
|
|
@@ -32,7 +32,7 @@ const Drawer = (props: THeaderProps) => {
|
|
|
32
32
|
data-trackable="drawer"
|
|
33
33
|
data-trackable-terminate
|
|
34
34
|
>
|
|
35
|
-
<div className="o-header__drawer-inner">
|
|
35
|
+
<div className="o-header__drawer-inner" data-ft-origin="npm:@financial-times/dotcom-ui-header" >
|
|
36
36
|
<DrawerTools {...editions} />
|
|
37
37
|
<Search />
|
|
38
38
|
{showDrawerActions && (
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// The o3-button class selector has higher specificity due to its default styling rules,
|
|
2
|
+
// which can override custom styles applied to the button. To ensure our styles take precedence,
|
|
3
|
+
// we use a combination of class selectors to increase specificity.
|
|
4
|
+
|
|
5
|
+
.o3-button.o-header__mpr-button {
|
|
6
|
+
@include oGridRespondTo($until: 'L') {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { LinkButton } from '@financial-times/o3-button'
|
|
3
|
+
import type { MprButtonProps } from '@financial-times/o-header/src/tsx/components/mpr-button'
|
|
4
|
+
|
|
5
|
+
const MPR_URL = 'https://professional-monetary-policy-radar.ft.com/'
|
|
6
|
+
|
|
7
|
+
export const MprButton = ({ id, dataTrackable }: MprButtonProps) => (
|
|
8
|
+
<LinkButton
|
|
9
|
+
href={MPR_URL}
|
|
10
|
+
icon="radar"
|
|
11
|
+
label="MPR"
|
|
12
|
+
size="small"
|
|
13
|
+
type="primary"
|
|
14
|
+
theme="mono"
|
|
15
|
+
attributes={{
|
|
16
|
+
id: id,
|
|
17
|
+
'data-trackable': dataTrackable,
|
|
18
|
+
className: `o-header__mpr-button`,
|
|
19
|
+
'data-ft-origin': 'pro-central-banking'
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
@@ -23,6 +23,7 @@ const NavMobile = ({ items }: { items: TNavMenuItem[] }) => {
|
|
|
23
23
|
id="o-header-nav-mobile"
|
|
24
24
|
className="o-header__row o-header__nav o-header__nav--mobile"
|
|
25
25
|
data-trackable="header-nav:mobile"
|
|
26
|
+
data-ft-origin="npm:@financial-times/dotcom-middleware-navigation"
|
|
26
27
|
>
|
|
27
28
|
<ul className="o-header__nav-list">
|
|
28
29
|
{items.map((item, index) => (
|
|
@@ -55,7 +56,11 @@ const NavDesktop = (props) => (
|
|
|
55
56
|
)
|
|
56
57
|
|
|
57
58
|
const NavListLeft = (props: THeaderProps) => (
|
|
58
|
-
<ul
|
|
59
|
+
<ul
|
|
60
|
+
className="o-header__nav-list o-header__nav-list--left"
|
|
61
|
+
data-trackable="primary-nav"
|
|
62
|
+
data-ft-origin="npm:@financial-times/dotcom-middleware-navigation"
|
|
63
|
+
>
|
|
59
64
|
{props.data.navbar.items.map((item, index) => (
|
|
60
65
|
<li className="o-header__nav-item" key={`link-${index}`}>
|
|
61
66
|
<a
|
|
@@ -102,6 +107,7 @@ const NavListRightLoggedIn = ({
|
|
|
102
107
|
data-component="nav-list--right"
|
|
103
108
|
className="o-header__nav-list o-header__nav-list--right"
|
|
104
109
|
data-trackable="user-nav"
|
|
110
|
+
data-ft-origin="npm:@financial-times/dotcom-middleware-navigation"
|
|
105
111
|
>
|
|
106
112
|
{items.map((item, index) => (
|
|
107
113
|
<li className="o-header__nav-item" key={`link-${index}`}>
|
|
@@ -126,6 +132,7 @@ const MegaNav = ({ label, meganav, index }: { label: string; meganav: TNavMegana
|
|
|
126
132
|
aria-labelledby={`o-header-link-${index}`}
|
|
127
133
|
data-o-header-mega
|
|
128
134
|
data-trackable={`meganav | ${label}`}
|
|
135
|
+
data-ft-origin="npm:@financial-times/dotcom-middleware-navigation"
|
|
129
136
|
>
|
|
130
137
|
<div className="o-header__container">
|
|
131
138
|
<div className="o-header__mega-wrapper">
|
|
@@ -191,7 +198,11 @@ const UserActionsNav = (props: THeaderProps) => {
|
|
|
191
198
|
const userNavItems = props.data['navbar-right-anon'].items
|
|
192
199
|
|
|
193
200
|
return (
|
|
194
|
-
<div
|
|
201
|
+
<div
|
|
202
|
+
className="o-header__row o-header__anon"
|
|
203
|
+
data-trackable="header-anon"
|
|
204
|
+
data-ft-origin="npm:@financial-times/dotcom-middleware-navigation"
|
|
205
|
+
>
|
|
195
206
|
<ul className="o-header__anon-list">
|
|
196
207
|
{userNavItems.map((item, index) => (
|
|
197
208
|
<li className="o-header__anon-item" key={`link-${index}`}>
|
|
@@ -7,6 +7,7 @@ const Search = ({ instance }) => {
|
|
|
7
7
|
id={`o-header-search-${instance}`}
|
|
8
8
|
className={`o-header__row o-header__search o-header__search--${instance}`}
|
|
9
9
|
data-trackable="header-search"
|
|
10
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
10
11
|
data-o-header-search
|
|
11
12
|
>
|
|
12
13
|
<div className="o-header__container">
|
|
@@ -9,6 +9,7 @@ import { AskFtButton } from '../ask-ft/askFtButton'
|
|
|
9
9
|
const StickyHeaderWrapper = (props: THeaderProps & { children: React.ReactNode }) => (
|
|
10
10
|
<header
|
|
11
11
|
className={`o-header o-header--simple o-header--sticky o--if-js`}
|
|
12
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
12
13
|
data-o-component="o-header"
|
|
13
14
|
data-o-header--sticky
|
|
14
15
|
aria-hidden="true"
|
|
@@ -5,11 +5,13 @@ import { TNavMenuItem } from '@financial-times/dotcom-types-navigation'
|
|
|
5
5
|
import { AskFtButton } from '../ask-ft/askFtButton'
|
|
6
6
|
import { DropdownNavigation, ProfessionalLabel } from '../dropdown-navigation/dropdownNavigation'
|
|
7
7
|
import { PRO_NAVIGATION_DROPDOWN_DEFAULT_LIST } from '../dropdown-navigation/constants'
|
|
8
|
+
import { MprButton } from '../mpr/mprButton'
|
|
8
9
|
|
|
9
10
|
const HeaderWrapper = (props) => (
|
|
10
11
|
<header
|
|
11
12
|
id="site-navigation"
|
|
12
13
|
className={`o-header o-header--${props.variant || 'simple'}`}
|
|
14
|
+
data-ft-origin="npm:@financial-times/dotcom-ui-header"
|
|
13
15
|
data-o-component="o-header"
|
|
14
16
|
data-o-header--no-js={true}
|
|
15
17
|
tabIndex={-1}
|
|
@@ -76,13 +78,16 @@ const TopWrapper = (props) => (
|
|
|
76
78
|
</div>
|
|
77
79
|
)
|
|
78
80
|
|
|
79
|
-
const TopColumnLeft = (props:
|
|
81
|
+
const TopColumnLeft = (props: THeaderProps) => (
|
|
80
82
|
<div className="o-header__top-column o-header__top-column--left">
|
|
81
83
|
<DrawerIcon />
|
|
82
84
|
<SearchIcon />
|
|
83
85
|
{props.showAskButton && (
|
|
84
86
|
<AskFtButton variant="top" dataTrackable="ask-ft-button-header" id="ask-ft-button-header" />
|
|
85
87
|
)}
|
|
88
|
+
{props.showMprButton && (
|
|
89
|
+
<MprButton dataTrackable="mpr-button-header" id="mpr-button-header" />
|
|
90
|
+
)}
|
|
86
91
|
</div>
|
|
87
92
|
)
|
|
88
93
|
|
|
@@ -115,7 +120,10 @@ const TopColumnRightLoggedIn = (props: THeaderProps) => {
|
|
|
115
120
|
restartSubscriptionAction
|
|
116
121
|
] = props.data['navbar-top-right']?.items ?? [];
|
|
117
122
|
return (
|
|
118
|
-
<div
|
|
123
|
+
<div
|
|
124
|
+
className="o-header__top-column o-header__top-column--right"
|
|
125
|
+
data-ft-origin="npm:@financial-times/middleware-user-data"
|
|
126
|
+
>
|
|
119
127
|
{props.showRestartSubscriptionButton && restartSubscriptionAction && (
|
|
120
128
|
<RestartSubscriptionButton
|
|
121
129
|
item={restartSubscriptionAction}
|
|
@@ -229,7 +237,10 @@ const TopColumnRightAnon = ({ items, variant }: { items: TNavMenuItem[]; variant
|
|
|
229
237
|
const [signInAction, subscribeAction] = items
|
|
230
238
|
|
|
231
239
|
return (
|
|
232
|
-
<div
|
|
240
|
+
<div
|
|
241
|
+
className="o-header__top-column o-header__top-column--right"
|
|
242
|
+
data-ft-origin="npm:@financial-times/middleware-user-data"
|
|
243
|
+
>
|
|
233
244
|
{subscribeAction && (
|
|
234
245
|
<SubscribeButton item={subscribeAction} variant={variant} className="o-header__top-button--hide-m" />
|
|
235
246
|
)}
|
package/src/header.scss
CHANGED
package/src/index.tsx
CHANGED