@financial-times/dotcom-ui-header 9.3.4 → 9.4.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 +1 -0
- package/dist/node/components/ask-ft/askFtButton.d.ts +6 -0
- package/dist/node/components/ask-ft/askFtButton.js +10 -0
- package/dist/node/components/drawer/topLevelPartials.js +5 -3
- package/dist/node/components/sticky/partials.d.ts +1 -1
- package/dist/node/components/sticky/partials.js +4 -2
- package/dist/node/components/top/partials.d.ts +1 -1
- package/dist/node/components/top/partials.js +4 -2
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +4 -3
- package/dist/tsconfig.tsbuildinfo +24 -9
- package/package.json +2 -2
- package/src/__stories__/story.tsx +12 -6
- package/src/__test__/components/Drawer.spec.tsx +6 -0
- package/src/__test__/components/MainHeader.spec.tsx +6 -0
- package/src/__test__/components/StickyHeader.spec.tsx +6 -0
- package/src/__test__/components/__snapshots__/Drawer.spec.tsx.snap +1376 -0
- package/src/__test__/components/__snapshots__/MainHeader.spec.tsx.snap +1860 -0
- package/src/__test__/components/__snapshots__/StickyHeader.spec.tsx.snap +317 -0
- package/src/components/ask-ft/askFtButton.tsx +17 -0
- package/src/components/drawer/topLevelPartials.tsx +6 -2
- package/src/components/sticky/partials.tsx +6 -6
- package/src/components/top/partials.tsx +5 -1
- package/src/header.scss +43 -1
- package/src/index.tsx +4 -3
- package/src/interfaces.d.ts +1 -0
package/README.md
CHANGED
|
@@ -76,6 +76,7 @@ All header components with the exception of `<LogoOnly />` require the following
|
|
|
76
76
|
| showSubNavigation | boolean | true | true | Show the sub-navigation component which may include the crumbtrail |
|
|
77
77
|
| showStickyHeader | boolean | true | true | Enable rendering of the sticky header component |
|
|
78
78
|
| showMegaNav | boolean | true | true | Enable rendering of the drop-down "mega-nav" |
|
|
79
|
+
| showAskButton | boolean | true | false | Enable rendering of the ASK button |
|
|
79
80
|
| data | object | false | | Navigation data for rendering the header links fetched from the navigation API |
|
|
80
81
|
|
|
81
82
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AskFtButton = void 0;
|
|
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" },
|
|
9
|
+
react_1.default.createElement("span", { className: "ft-header__ask-ft-button-label" }, "Ask FT")));
|
|
10
|
+
exports.AskFtButton = AskFtButton;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.IncludeDrawer = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const additionalPartials_1 = require("./additionalPartials");
|
|
9
|
+
const askFtButton_1 = require("../ask-ft/askFtButton");
|
|
9
10
|
const IncludeDrawer = (props) => react_1.default.createElement(Drawer, Object.assign({}, props));
|
|
10
11
|
exports.IncludeDrawer = IncludeDrawer;
|
|
11
12
|
const Drawer = (props) => {
|
|
@@ -17,7 +18,7 @@ const Drawer = (props) => {
|
|
|
17
18
|
react_1.default.createElement("div", { className: "o-header__drawer-inner" },
|
|
18
19
|
react_1.default.createElement(DrawerTools, Object.assign({}, editions)),
|
|
19
20
|
!props.userIsSubscribed && subscribeAction && react_1.default.createElement(additionalPartials_1.SubscribeButton, Object.assign({}, subscribeAction)),
|
|
20
|
-
react_1.default.createElement(Search,
|
|
21
|
+
react_1.default.createElement(Search, Object.assign({}, props)),
|
|
21
22
|
react_1.default.createElement("nav", { className: "o-header__drawer-menu", "aria-label": "Edition switcher" }, editions && react_1.default.createElement(additionalPartials_1.EditionsSwitcher, Object.assign({}, editions))),
|
|
22
23
|
react_1.default.createElement("nav", { className: "o-header__drawer-menu o-header__drawer-menu--primary" },
|
|
23
24
|
primary ? react_1.default.createElement(SectionPrimary, Object.assign({}, primary)) : null,
|
|
@@ -31,14 +32,15 @@ const DrawerTools = (props) => (react_1.default.createElement("div", { className
|
|
|
31
32
|
react_1.default.createElement("a", { className: "o-header__drawer-tools-logo", href: "/", "data-trackable": "logo" },
|
|
32
33
|
react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Financial Times")),
|
|
33
34
|
props.current && react_1.default.createElement("p", { className: "o-header__drawer-current-edition" }, `${props.current.name} Edition`)));
|
|
34
|
-
const Search = () => (react_1.default.createElement("div", { className: "o-header__drawer-search" },
|
|
35
|
+
const Search = (props) => (react_1.default.createElement("div", { className: "o-header__drawer-search" },
|
|
35
36
|
react_1.default.createElement("form", { className: "o-header__drawer-search-form", action: "/search", role: "search", "aria-label": "Site search", "data-n-topic-search": true, "data-n-topic-search-categories": "concepts,equities", "data-n-topic-search-view-all": true },
|
|
36
37
|
react_1.default.createElement("label", { className: "o-header__visually-hidden", htmlFor: "o-header-drawer-search-term" },
|
|
37
38
|
"Search the ",
|
|
38
39
|
react_1.default.createElement("abbr", { title: "Financial Times" }, "FT")),
|
|
39
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 }),
|
|
40
41
|
react_1.default.createElement("button", { className: "o-header__drawer-search-submit", type: "submit", "data-trackable": "search-submit" },
|
|
41
|
-
react_1.default.createElement("span", { className: "o-header__visually-hidden" }, "Search"))
|
|
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" })))));
|
|
42
44
|
const SectionPrimary = (props) => {
|
|
43
45
|
var _a;
|
|
44
46
|
const sectionId = props.label.toLowerCase().replace(' ', '-');
|
|
@@ -4,7 +4,7 @@ declare const StickyHeaderWrapper: (props: THeaderProps & {
|
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
6
|
declare const TopWrapperSticky: (props: any) => React.JSX.Element;
|
|
7
|
-
declare const TopColumnLeftSticky: () => React.JSX.Element;
|
|
7
|
+
declare const TopColumnLeftSticky: (props: Pick<THeaderProps, 'showAskButton'>) => React.JSX.Element;
|
|
8
8
|
declare const TopColumnCenterSticky: (props: THeaderProps) => React.JSX.Element;
|
|
9
9
|
declare const TopColumnRightSticky: (props: THeaderProps) => React.JSX.Element;
|
|
10
10
|
export { StickyHeaderWrapper, TopWrapperSticky, TopColumnLeftSticky, TopColumnCenterSticky, TopColumnRightSticky };
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.TopColumnRightSticky = exports.TopColumnCenterSticky = exports.TopColumnLeftSticky = exports.TopWrapperSticky = exports.StickyHeaderWrapper = void 0;
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
10
|
const partials_1 = require("../top/partials");
|
|
11
|
+
const askFtButton_1 = require("../ask-ft/askFtButton");
|
|
11
12
|
const StickyHeaderWrapper = (props) => (react_1.default.createElement("header", { className: `o-header o-header--simple o-header--sticky o--if-js`, "data-o-component": "o-header", "data-o-header--sticky": true, "aria-hidden": "true" }, props.children));
|
|
12
13
|
exports.StickyHeaderWrapper = StickyHeaderWrapper;
|
|
13
14
|
const DrawerIconSticky = () => (react_1.default.createElement("a", { href: "#", className: "o-header__top-icon-link o-header__top-icon-link--menu", "aria-controls": "o-header-drawer", "data-trackable": "drawer-toggle", tabIndex: -1 },
|
|
@@ -37,10 +38,11 @@ const TopWrapperSticky = (props) => (react_1.default.createElement("div", { clas
|
|
|
37
38
|
react_1.default.createElement("div", { className: "o-header__container" },
|
|
38
39
|
react_1.default.createElement("div", { className: "o-header__top-wrapper" }, props.children))));
|
|
39
40
|
exports.TopWrapperSticky = TopWrapperSticky;
|
|
40
|
-
const TopColumnLeftSticky = () => {
|
|
41
|
+
const TopColumnLeftSticky = (props) => {
|
|
41
42
|
return (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--left" },
|
|
42
43
|
react_1.default.createElement(DrawerIconSticky, null),
|
|
43
|
-
react_1.default.createElement(SearchIconSticky, null)
|
|
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" }))));
|
|
44
46
|
};
|
|
45
47
|
exports.TopColumnLeftSticky = TopColumnLeftSticky;
|
|
46
48
|
const TopColumnCenterSticky = (props) => {
|
|
@@ -3,7 +3,7 @@ import { THeaderProps } from '../../interfaces';
|
|
|
3
3
|
import { TNavMenuItem } from '@financial-times/dotcom-types-navigation';
|
|
4
4
|
declare const HeaderWrapper: (props: any) => React.JSX.Element;
|
|
5
5
|
declare const TopWrapper: (props: any) => React.JSX.Element;
|
|
6
|
-
declare const TopColumnLeft: () => React.JSX.Element;
|
|
6
|
+
declare const TopColumnLeft: (props: Pick<THeaderProps, 'showAskButton'>) => React.JSX.Element;
|
|
7
7
|
declare const TopColumnCenter: () => React.JSX.Element;
|
|
8
8
|
declare const TopColumnCenterNoLink: () => React.JSX.Element;
|
|
9
9
|
declare const SignInLink: ({ item, variant, className }: {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SignInLink = exports.SubscribeButton = exports.TopColumnRightAnon = exports.TopColumnRight = exports.TopColumnCenterNoLink = exports.TopColumnCenter = exports.TopColumnLeft = exports.TopWrapper = exports.HeaderWrapper = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const BrandFtMasthead_1 = __importDefault(require("../svg-components/BrandFtMasthead"));
|
|
9
|
+
const askFtButton_1 = require("../ask-ft/askFtButton");
|
|
9
10
|
const HeaderWrapper = (props) => (react_1.default.createElement("header", { id: "site-navigation", className: `o-header o-header--${props.variant || 'simple'}`, "data-o-component": "o-header", "data-o-header--no-js": true, tabIndex: -1 }, props.children));
|
|
10
11
|
exports.HeaderWrapper = HeaderWrapper;
|
|
11
12
|
const DrawerIcon = () => (react_1.default.createElement("a", { href: "#o-header-drawer", className: "o-header__top-icon-link o-header__top-icon-link--menu", "aria-controls": "o-header-drawer", title: "Open side navigation menu", "data-trackable": "drawer-toggle" },
|
|
@@ -37,9 +38,10 @@ const TopWrapper = (props) => (react_1.default.createElement("div", { className:
|
|
|
37
38
|
react_1.default.createElement("div", { className: "o-header__container" },
|
|
38
39
|
react_1.default.createElement("div", { className: "o-header__top-wrapper" }, props.children))));
|
|
39
40
|
exports.TopWrapper = TopWrapper;
|
|
40
|
-
const TopColumnLeft = () => (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--left" },
|
|
41
|
+
const TopColumnLeft = (props) => (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--left" },
|
|
41
42
|
react_1.default.createElement(DrawerIcon, null),
|
|
42
|
-
react_1.default.createElement(SearchIcon, null)
|
|
43
|
+
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" }))));
|
|
43
45
|
exports.TopColumnLeft = TopColumnLeft;
|
|
44
46
|
const TopColumnCenter = () => (react_1.default.createElement("div", { className: "o-header__top-column o-header__top-column--center" },
|
|
45
47
|
react_1.default.createElement("a", { className: "o-header__top-logo", style: { backgroundImage: 'none' }, "data-trackable": "logo", href: "/", title: "Go to Financial Times homepage" },
|
package/dist/node/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare namespace MainHeader {
|
|
|
12
12
|
showUserNavigation?: boolean | undefined;
|
|
13
13
|
showStickyHeader?: boolean | undefined;
|
|
14
14
|
showMegaNav?: boolean | undefined;
|
|
15
|
+
showAskButton?: boolean | undefined;
|
|
15
16
|
experimentalAccountEntryTest?: boolean | undefined;
|
|
16
17
|
};
|
|
17
18
|
}
|
package/dist/node/index.js
CHANGED
|
@@ -17,7 +17,8 @@ const defaultProps = {
|
|
|
17
17
|
userIsAnonymous: true,
|
|
18
18
|
userIsLoggedIn: false,
|
|
19
19
|
showStickyHeader: true,
|
|
20
|
-
showMegaNav: true
|
|
20
|
+
showMegaNav: true,
|
|
21
|
+
showAskButton: false
|
|
21
22
|
};
|
|
22
23
|
function MainHeader(props) {
|
|
23
24
|
const includeUserActionsNav = props.showUserNavigation && !props.userIsLoggedIn;
|
|
@@ -25,7 +26,7 @@ function MainHeader(props) {
|
|
|
25
26
|
return (react_1.default.createElement(partials_1.HeaderWrapper, Object.assign({}, props),
|
|
26
27
|
includeUserActionsNav ? react_1.default.createElement(partials_2.UserActionsNav, Object.assign({}, props)) : null,
|
|
27
28
|
react_1.default.createElement(partials_1.TopWrapper, null,
|
|
28
|
-
react_1.default.createElement(partials_1.TopColumnLeft,
|
|
29
|
+
react_1.default.createElement(partials_1.TopColumnLeft, Object.assign({}, props)),
|
|
29
30
|
props.showLogoLink ? react_1.default.createElement(partials_1.TopColumnCenter, null) : react_1.default.createElement(partials_1.TopColumnCenterNoLink, null),
|
|
30
31
|
react_1.default.createElement(partials_1.TopColumnRight, Object.assign({}, props))),
|
|
31
32
|
react_1.default.createElement(partials_5.Search, { instance: "primary" }),
|
|
@@ -40,7 +41,7 @@ MainHeader.defaultProps = { ...defaultProps, showLogoLink: true };
|
|
|
40
41
|
function StickyHeader(props) {
|
|
41
42
|
return props.showStickyHeader ? (react_1.default.createElement(partials_3.StickyHeaderWrapper, Object.assign({}, props),
|
|
42
43
|
react_1.default.createElement(partials_3.TopWrapperSticky, null,
|
|
43
|
-
react_1.default.createElement(partials_3.TopColumnLeftSticky,
|
|
44
|
+
react_1.default.createElement(partials_3.TopColumnLeftSticky, Object.assign({}, props)),
|
|
44
45
|
react_1.default.createElement(partials_3.TopColumnCenterSticky, Object.assign({}, props)),
|
|
45
46
|
react_1.default.createElement(partials_3.TopColumnRightSticky, Object.assign({}, props))),
|
|
46
47
|
react_1.default.createElement(partials_5.Search, { instance: "sticky" }))) : null;
|
|
@@ -172,8 +172,8 @@
|
|
|
172
172
|
"affectsGlobalScope": false
|
|
173
173
|
},
|
|
174
174
|
"../src/interfaces.d.ts": {
|
|
175
|
-
"version": "
|
|
176
|
-
"signature": "
|
|
175
|
+
"version": "70f3e895f97f22b3db1daf03c0ceb1805eb8ee437a00a715afb4c2b7580cb722",
|
|
176
|
+
"signature": "70f3e895f97f22b3db1daf03c0ceb1805eb8ee437a00a715afb4c2b7580cb722",
|
|
177
177
|
"affectsGlobalScope": false
|
|
178
178
|
},
|
|
179
179
|
"../src/components/svg-components/BrandFtMasthead.tsx": {
|
|
@@ -181,9 +181,14 @@
|
|
|
181
181
|
"signature": "9d8d05b4e7f09ae6f6e59780e0717c60f7ec779c4173e07bfb9a82654fd87bbc",
|
|
182
182
|
"affectsGlobalScope": false
|
|
183
183
|
},
|
|
184
|
+
"../src/components/ask-ft/askFtButton.tsx": {
|
|
185
|
+
"version": "8c8444f554f26ea6fbcea191e5532a37264d95cd3faea27930dfefbe34242b00",
|
|
186
|
+
"signature": "5ddb1285819df48e1e0f886a1721f76d4ac406a582ccea39dfa824942139fcc6",
|
|
187
|
+
"affectsGlobalScope": false
|
|
188
|
+
},
|
|
184
189
|
"../src/components/top/partials.tsx": {
|
|
185
|
-
"version": "
|
|
186
|
-
"signature": "
|
|
190
|
+
"version": "732b60d9df8503d55336544446f02ef622fe85ce096733dcab25f593324195e4",
|
|
191
|
+
"signature": "d0d54633228c5569ef99ff2a2dce45f2e9e0e946ed5ef4b4833221516529e8d9",
|
|
187
192
|
"affectsGlobalScope": false
|
|
188
193
|
},
|
|
189
194
|
"../src/utils.ts": {
|
|
@@ -197,8 +202,8 @@
|
|
|
197
202
|
"affectsGlobalScope": false
|
|
198
203
|
},
|
|
199
204
|
"../src/components/sticky/partials.tsx": {
|
|
200
|
-
"version": "
|
|
201
|
-
"signature": "
|
|
205
|
+
"version": "825880195fd7a94976e8b9b21f148216751251b44dc353117160e6b96893e45d",
|
|
206
|
+
"signature": "8fbeb8e68c5be0e2f41a60731bb91f6c54327ecca0d18857c3feeaa06e1cd389",
|
|
202
207
|
"affectsGlobalScope": false
|
|
203
208
|
},
|
|
204
209
|
"../src/components/sub-navigation/partials.tsx": {
|
|
@@ -212,7 +217,7 @@
|
|
|
212
217
|
"affectsGlobalScope": false
|
|
213
218
|
},
|
|
214
219
|
"../src/components/drawer/topLevelPartials.tsx": {
|
|
215
|
-
"version": "
|
|
220
|
+
"version": "9063a811aade637b6a310b720b71da54f05fedbc12da6f90e934a183941ee44c",
|
|
216
221
|
"signature": "9d1b0a09950f10403acbd59a85db578c3d6d0eec6d4fd6b26deacd7fc69b5bb4",
|
|
217
222
|
"affectsGlobalScope": false
|
|
218
223
|
},
|
|
@@ -222,8 +227,8 @@
|
|
|
222
227
|
"affectsGlobalScope": false
|
|
223
228
|
},
|
|
224
229
|
"../src/index.tsx": {
|
|
225
|
-
"version": "
|
|
226
|
-
"signature": "
|
|
230
|
+
"version": "1590223c256c5d68b425be24b35676fdefdb9460dac8c04b7e6fbe4c9ce82477",
|
|
231
|
+
"signature": "c48821858a0ef93b2790d21732b882cb1817ffa6fa4dce5f09099846929bab4a",
|
|
227
232
|
"affectsGlobalScope": false
|
|
228
233
|
},
|
|
229
234
|
"../../../node_modules/@types/aria-query/index.d.ts": {
|
|
@@ -1882,6 +1887,9 @@
|
|
|
1882
1887
|
"../../../node_modules/pretty-format/build/index.d.ts": [
|
|
1883
1888
|
"../../../node_modules/pretty-format/build/types.d.ts"
|
|
1884
1889
|
],
|
|
1890
|
+
"../src/components/ask-ft/askFtButton.tsx": [
|
|
1891
|
+
"../../../node_modules/@types/react/index.d.ts"
|
|
1892
|
+
],
|
|
1885
1893
|
"../src/components/drawer/additionalPartials.tsx": [
|
|
1886
1894
|
"../../../node_modules/@types/react/index.d.ts",
|
|
1887
1895
|
"../../dotcom-types-navigation/index.d.ts",
|
|
@@ -1890,6 +1898,7 @@
|
|
|
1890
1898
|
"../src/components/drawer/topLevelPartials.tsx": [
|
|
1891
1899
|
"../../../node_modules/@types/react/index.d.ts",
|
|
1892
1900
|
"../../dotcom-types-navigation/index.d.ts",
|
|
1901
|
+
"../src/components/ask-ft/askFtButton.tsx",
|
|
1893
1902
|
"../src/components/drawer/additionalPartials.tsx",
|
|
1894
1903
|
"../src/interfaces.d.ts"
|
|
1895
1904
|
],
|
|
@@ -1904,6 +1913,7 @@
|
|
|
1904
1913
|
],
|
|
1905
1914
|
"../src/components/sticky/partials.tsx": [
|
|
1906
1915
|
"../../../node_modules/@types/react/index.d.ts",
|
|
1916
|
+
"../src/components/ask-ft/askFtButton.tsx",
|
|
1907
1917
|
"../src/components/top/partials.tsx",
|
|
1908
1918
|
"../src/interfaces.d.ts"
|
|
1909
1919
|
],
|
|
@@ -1919,6 +1929,7 @@
|
|
|
1919
1929
|
"../src/components/top/partials.tsx": [
|
|
1920
1930
|
"../../../node_modules/@types/react/index.d.ts",
|
|
1921
1931
|
"../../dotcom-types-navigation/index.d.ts",
|
|
1932
|
+
"../src/components/ask-ft/askFtButton.tsx",
|
|
1922
1933
|
"../src/components/svg-components/BrandFtMasthead.tsx",
|
|
1923
1934
|
"../src/interfaces.d.ts"
|
|
1924
1935
|
],
|
|
@@ -2687,6 +2698,9 @@
|
|
|
2687
2698
|
"../../../node_modules/pretty-format/build/index.d.ts": [
|
|
2688
2699
|
"../../../node_modules/pretty-format/build/types.d.ts"
|
|
2689
2700
|
],
|
|
2701
|
+
"../src/components/ask-ft/askFtButton.tsx": [
|
|
2702
|
+
"../../../node_modules/@types/react/index.d.ts"
|
|
2703
|
+
],
|
|
2690
2704
|
"../src/components/drawer/additionalPartials.tsx": [
|
|
2691
2705
|
"../../../node_modules/@types/react/index.d.ts",
|
|
2692
2706
|
"../../dotcom-types-navigation/index.d.ts"
|
|
@@ -2939,6 +2953,7 @@
|
|
|
2939
2953
|
"../../../node_modules/typescript/lib/lib.es5.d.ts",
|
|
2940
2954
|
"../../../node_modules/typescript/lib/lib.esnext.intl.d.ts",
|
|
2941
2955
|
"../../dotcom-types-navigation/index.d.ts",
|
|
2956
|
+
"../src/components/ask-ft/askFtButton.tsx",
|
|
2942
2957
|
"../src/components/drawer/additionalPartials.tsx",
|
|
2943
2958
|
"../src/components/drawer/topLevelPartials.tsx",
|
|
2944
2959
|
"../src/components/navigation/partials.tsx",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/dotcom-ui-header",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0",
|
|
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.
|
|
25
|
+
"@financial-times/dotcom-types-navigation": "^9.4.0",
|
|
26
26
|
"n-topic-search": "^4.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -52,7 +52,8 @@ DefaultHeaderWithDrawer.args = {
|
|
|
52
52
|
showUserNavigation: true,
|
|
53
53
|
userIsLoggedIn: false,
|
|
54
54
|
userIsSubscribed: false,
|
|
55
|
-
showLogoLink: false
|
|
55
|
+
showLogoLink: false,
|
|
56
|
+
showAskButton: false
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
export const DefaultHeaderWithDrawerEntryTestAnon = (args) => (
|
|
@@ -72,7 +73,8 @@ DefaultHeaderWithDrawerEntryTestAnon.args = {
|
|
|
72
73
|
userIsLoggedIn: false,
|
|
73
74
|
userIsSubscribed: false,
|
|
74
75
|
showLogoLink: false,
|
|
75
|
-
experimentalAccountEntryTest: true
|
|
76
|
+
experimentalAccountEntryTest: true,
|
|
77
|
+
showAskButton: false
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
export const DefaultHeaderWithDrawerEntryTest = (args) => (
|
|
@@ -92,7 +94,8 @@ DefaultHeaderWithDrawerEntryTest.args = {
|
|
|
92
94
|
userIsLoggedIn: true,
|
|
93
95
|
userIsSubscribed: false,
|
|
94
96
|
showLogoLink: false,
|
|
95
|
-
experimentalAccountEntryTest: true
|
|
97
|
+
experimentalAccountEntryTest: true,
|
|
98
|
+
showAskButton: false
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
export const DefaultHeaderWithRightAlignedSubnav = (args) => (
|
|
@@ -110,7 +113,8 @@ DefaultHeaderWithRightAlignedSubnav.args = {
|
|
|
110
113
|
showMegaNav: true,
|
|
111
114
|
showUserNavigation: true,
|
|
112
115
|
userIsLoggedIn: true,
|
|
113
|
-
showLogoLink: false
|
|
116
|
+
showLogoLink: false,
|
|
117
|
+
showAskButton: false
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
export const LargeHeaderWithDrawer = (args) => (
|
|
@@ -131,7 +135,8 @@ LargeHeaderWithDrawer.args = {
|
|
|
131
135
|
showMegaNav: true,
|
|
132
136
|
showUserNavigation: true,
|
|
133
137
|
userIsLoggedIn: false,
|
|
134
|
-
variant: 'large-logo'
|
|
138
|
+
variant: 'large-logo',
|
|
139
|
+
showAskButton: false
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
export const _StickyHeader = (args) => (
|
|
@@ -148,7 +153,8 @@ _StickyHeader.args = {
|
|
|
148
153
|
showUserNavigation: true,
|
|
149
154
|
userIsLoggedIn: false,
|
|
150
155
|
userIsSubscribed: false,
|
|
151
|
-
showStickyHeader: false
|
|
156
|
+
showStickyHeader: false,
|
|
157
|
+
showAskButton: false
|
|
152
158
|
}
|
|
153
159
|
_StickyHeader.argTypes = {
|
|
154
160
|
currentPath: {
|
|
@@ -5,6 +5,7 @@ import { Drawer as Subject } from '../../index'
|
|
|
5
5
|
|
|
6
6
|
const propsAnonymous = { ...fixture, userIsAnonymous: true, userIsLoggedIn: false }
|
|
7
7
|
const propsLoggedIn = { ...fixture, userIsAnonymous: false, userIsLoggedIn: true }
|
|
8
|
+
const propsAskFt = { ...fixture, showAskButton: true }
|
|
8
9
|
|
|
9
10
|
describe('dotcom-ui-header/src/components/Drawer', () => {
|
|
10
11
|
it('renders as an anonymous user', () => {
|
|
@@ -16,4 +17,9 @@ describe('dotcom-ui-header/src/components/Drawer', () => {
|
|
|
16
17
|
const tree = renderer.create(<Subject {...propsLoggedIn} />).toJSON()
|
|
17
18
|
expect(tree).toMatchSnapshot()
|
|
18
19
|
})
|
|
20
|
+
|
|
21
|
+
it('renders ASK FT button', () => {
|
|
22
|
+
const tree = renderer.create(<Subject {...propsAskFt} />).toJSON()
|
|
23
|
+
expect(tree).toMatchSnapshot()
|
|
24
|
+
})
|
|
19
25
|
})
|
|
@@ -7,6 +7,7 @@ import { MainHeader as Subject } from '../../index'
|
|
|
7
7
|
const propsAnonymous = { ...fixture, userIsAnonymous: true, userIsLoggedIn: false }
|
|
8
8
|
const propsLoggedIn = { ...fixture, userIsAnonymous: false, userIsLoggedIn: true }
|
|
9
9
|
const propsRightAligned = { ...profileFixture }
|
|
10
|
+
const propsAskFt = { ...fixture, showAskButton: true }
|
|
10
11
|
|
|
11
12
|
describe('dotcom-ui-header/src/components/MainHeader', () => {
|
|
12
13
|
it('renders as an anonymous user', () => {
|
|
@@ -23,4 +24,9 @@ describe('dotcom-ui-header/src/components/MainHeader', () => {
|
|
|
23
24
|
const tree = renderer.create(<Subject {...propsRightAligned} />).toJSON()
|
|
24
25
|
expect(tree).toMatchSnapshot()
|
|
25
26
|
})
|
|
27
|
+
|
|
28
|
+
it('renders ASK FT button', () => {
|
|
29
|
+
const tree = renderer.create(<Subject {...propsAskFt} />).toJSON()
|
|
30
|
+
expect(tree).toMatchSnapshot()
|
|
31
|
+
})
|
|
26
32
|
})
|
|
@@ -5,6 +5,7 @@ import { StickyHeader as Subject } from '../../index'
|
|
|
5
5
|
|
|
6
6
|
const propsAnonymous = { ...fixture, userIsAnonymous: true, userIsLoggedIn: false }
|
|
7
7
|
const propsLoggedIn = { ...fixture, userIsAnonymous: false, userIsLoggedIn: true }
|
|
8
|
+
const propsAskFt = { ...fixture, showAskButton: true }
|
|
8
9
|
|
|
9
10
|
describe('dotcom-ui-header/src/components/StickyHeader', () => {
|
|
10
11
|
it('renders as an anonymous user', () => {
|
|
@@ -16,4 +17,9 @@ describe('dotcom-ui-header/src/components/StickyHeader', () => {
|
|
|
16
17
|
const tree = renderer.create(<Subject {...propsLoggedIn} />).toJSON()
|
|
17
18
|
expect(tree).toMatchSnapshot()
|
|
18
19
|
})
|
|
20
|
+
|
|
21
|
+
it('renders ASK FT button', () => {
|
|
22
|
+
const tree = renderer.create(<Subject {...propsAskFt} />).toJSON()
|
|
23
|
+
expect(tree).toMatchSnapshot()
|
|
24
|
+
})
|
|
19
25
|
})
|