@financial-times/n-myft-ui 26.1.0 → 27.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.circleci/config.yml +46 -34
- package/.nvmrc +1 -1
- package/Makefile +0 -1
- package/README.md +2 -48
- package/build-state/npm-shrinkwrap.json +10147 -20187
- package/components/collections/collections.html +85 -0
- package/components/concept-list/concept-list.html +31 -0
- package/components/csrf-token/input.html +5 -0
- package/components/follow-button/follow-button.html +79 -0
- package/components/instant-alert/instant-alert.html +47 -0
- package/components/pin-button/pin-button.html +20 -0
- package/components/save-for-later/save-for-later.html +67 -0
- package/components/unread-articles-indicator/date-fns.js +6 -6
- package/demos/app.js +3 -26
- package/demos/templates/demo.html +11 -10
- package/package.json +16 -30
- package/components/collections/collections.jsx +0 -68
- package/components/collections/collections.test.js +0 -83
- package/components/concept-list/concept-list.jsx +0 -69
- package/components/concept-list/concept-list.test.js +0 -116
- package/components/csrf-token/input.jsx +0 -20
- package/components/csrf-token/input.test.js +0 -23
- package/components/follow-button/follow-button.jsx +0 -176
- package/components/follow-button/follow-button.test.js +0 -40
- package/components/index.js +0 -17
- package/components/instant-alert/instant-alert.jsx +0 -73
- package/components/instant-alert/instant-alert.test.js +0 -86
- package/components/pin-button/pin-button.jsx +0 -40
- package/components/pin-button/pin-button.test.js +0 -57
- package/components/save-for-later/save-for-later.jsx +0 -101
- package/components/save-for-later/save-for-later.test.js +0 -59
- package/demos/templates/demo-layout.html +0 -25
- package/demos/templates/demo.jsx +0 -125
- package/dist/bundles/bundle.js +0 -3232
- package/jest.config.js +0 -8
- package/jsx-migration.md +0 -16
- package/webpack.config.js +0 -34
@@ -0,0 +1,85 @@
|
|
1
|
+
<section
|
2
|
+
class="collection {{#if liteStyle}}collection--lite{{else}}collection--regular{{/if}}"
|
3
|
+
data-trackable="{{#if trackable}}{{trackable}}{{else}}collection{{/if}}">
|
4
|
+
<header class="collection__header {{#if liteStyle}}collection__header--lite{{else}}collection__header--regular{{/if}}">
|
5
|
+
<h2 class="collection__title {{#if liteStyle}}collection__title--lite{{else}}collection__title--regular{{/if}}">
|
6
|
+
{{title}}
|
7
|
+
</h2>
|
8
|
+
</header>
|
9
|
+
<ul class="collection__concepts">
|
10
|
+
{{#concepts}}
|
11
|
+
<li class="collection__concept">
|
12
|
+
{{#if ../liteStyle}}
|
13
|
+
{{> n-myft-ui/components/follow-button/follow-button
|
14
|
+
variant="primary"
|
15
|
+
buttonText=name
|
16
|
+
collectionName=../collectionName
|
17
|
+
}}
|
18
|
+
{{else}}
|
19
|
+
{{> n-myft-ui/components/follow-button/follow-button
|
20
|
+
variant="inverse"
|
21
|
+
buttonText=name
|
22
|
+
collectionName=../collectionName
|
23
|
+
}}
|
24
|
+
{{/if}}
|
25
|
+
</li>
|
26
|
+
{{/concepts}}
|
27
|
+
</ul>
|
28
|
+
<div class="collection__meta">
|
29
|
+
<form
|
30
|
+
method="POST"
|
31
|
+
action="#"
|
32
|
+
data-myft-ui="follow"
|
33
|
+
{{#if collectionName}}data-myft-tracking="collectionName={{collectionName}}"{{/if}}
|
34
|
+
data-concept-id="
|
35
|
+
{{~#concepts~}}
|
36
|
+
{{conceptId}}
|
37
|
+
{{~#unless @last~}}
|
38
|
+
,
|
39
|
+
{{~/unless~}}
|
40
|
+
{{~/concepts~}}"
|
41
|
+
class="n-myft-ui n-myft-ui--follow n-ui-hide-core collection-follow-all">
|
42
|
+
<input
|
43
|
+
type="hidden"
|
44
|
+
name="directType"
|
45
|
+
value="
|
46
|
+
{{~#concepts~}}
|
47
|
+
{{directType}}
|
48
|
+
{{~#unless @last~}}
|
49
|
+
,
|
50
|
+
{{~/unless~}}
|
51
|
+
{{~/concepts~}}"
|
52
|
+
/>
|
53
|
+
{{> n-myft-ui/components/csrf-token/input}}
|
54
|
+
<input
|
55
|
+
type="hidden"
|
56
|
+
name="name"
|
57
|
+
value="
|
58
|
+
{{~#concepts~}}
|
59
|
+
{{name}}
|
60
|
+
{{~#unless @last~}}
|
61
|
+
,
|
62
|
+
{{~/unless~}}
|
63
|
+
{{~/concepts~}}"
|
64
|
+
/>
|
65
|
+
<button
|
66
|
+
type="submit"
|
67
|
+
aria-pressed="false"
|
68
|
+
class="collection-follow-all__button {{#if liteStyle}}collection-follow-all__button--lite{{else}}collection-follow-all__button--regular{{/if}}"
|
69
|
+
data-trackable="follow all"
|
70
|
+
data-concept-id="
|
71
|
+
{{~#concepts~}}
|
72
|
+
{{conceptId}}
|
73
|
+
{{~#unless @last~}}
|
74
|
+
,
|
75
|
+
{{~/unless~}}
|
76
|
+
{{~/concepts~}}"
|
77
|
+
aria-label="Add all topics in the {{title}} collection to my F T"
|
78
|
+
data-alternate-label="Remove all topics in the {{title}} collection from my F T"
|
79
|
+
data-alternate-text="Added"
|
80
|
+
title="Add all topics in the {{title}} collection to my F T">
|
81
|
+
Add all to myFT
|
82
|
+
</button>
|
83
|
+
</form>
|
84
|
+
</div>
|
85
|
+
</section>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{{#ifAll @root.flags.myFtApi @root.flags.myFtApiWrite concepts concepts.length}}
|
2
|
+
<div
|
3
|
+
class="concept-list"
|
4
|
+
data-trackable="{{#if trackable}}{{trackable}}{{else}}concept-list{{/if}}">
|
5
|
+
{{#ifSome contentType conceptListTitle}}
|
6
|
+
<h2 class="concept-list__title">
|
7
|
+
{{#if conceptListTitle}}
|
8
|
+
{{conceptListTitle}}
|
9
|
+
{{else}}
|
10
|
+
Follow the topics in this {{contentType}}
|
11
|
+
{{/if}}
|
12
|
+
</h2>
|
13
|
+
{{/ifSome}}
|
14
|
+
<ul class="concept-list__list">
|
15
|
+
{{#each concepts}}
|
16
|
+
<li class="concept-list__list-item">
|
17
|
+
<a
|
18
|
+
href="{{relativeUrl}}"
|
19
|
+
data-trackable="{{#if conceptTrackable}}{{conceptTrackable}}{{else}}concept{{/if}}"
|
20
|
+
class="concept-list__concept">
|
21
|
+
{{prefLabel}}
|
22
|
+
</a>
|
23
|
+
{{> n-myft-ui/components/follow-button/follow-button
|
24
|
+
conceptId=id
|
25
|
+
name=prefLabel
|
26
|
+
}}
|
27
|
+
</li>
|
28
|
+
{{/each}}
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
{{/ifAll}}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
{{#if @root.flags.myFtApiWrite}}
|
2
|
+
<form
|
3
|
+
class="n-myft-ui n-myft-ui--follow {{extraClasses}}"
|
4
|
+
method="GET"
|
5
|
+
data-myft-ui="follow"
|
6
|
+
data-concept-id="{{conceptId}}"
|
7
|
+
{{#if collectionName}}data-myft-tracking="collectionName={{collectionName}}"{{/if}}
|
8
|
+
{{#if followPlusDigestEmail}}
|
9
|
+
action="/__myft/api/core/follow-plus-digest-email/{{conceptId}}?method=put"
|
10
|
+
data-myft-ui-variant="followPlusDigestEmail"
|
11
|
+
{{else}}
|
12
|
+
{{#ifAll setFollowButtonStateToSelected @root.cacheablePersonalisedUrl}}
|
13
|
+
action="/myft/remove/{{conceptId}}"
|
14
|
+
data-js-action="/__myft/api/core/followed/concept/{{conceptId}}?method=delete"
|
15
|
+
{{else}}
|
16
|
+
action="/myft/add/{{conceptId}}"
|
17
|
+
data-js-action="/__myft/api/core/followed/concept/{{conceptId}}?method=put"
|
18
|
+
{{/ifAll}}
|
19
|
+
{{/if}}>
|
20
|
+
{{> n-myft-ui/components/csrf-token/input}}
|
21
|
+
<div
|
22
|
+
class="n-myft-ui__announcement o-normalise-visually-hidden"
|
23
|
+
aria-live="assertive"
|
24
|
+
data-pressed-text="Now following {{name}}."
|
25
|
+
data-unpressed-text="No longer following {{name}}."
|
26
|
+
></div>
|
27
|
+
<button
|
28
|
+
{{#ifAll setFollowButtonStateToSelected @root.cacheablePersonalisedUrl}}
|
29
|
+
aria-label="Remove {{name}} from myFT"
|
30
|
+
title="Remove {{name}} from myFT"
|
31
|
+
data-alternate-label="Add {{name}} to myFT"
|
32
|
+
aria-pressed="true"
|
33
|
+
{{#if alternateText}}
|
34
|
+
data-alternate-text="{{alternateText}}"
|
35
|
+
{{else}}
|
36
|
+
{{#if buttonText}}
|
37
|
+
data-alternate-text="{{buttonText}}"
|
38
|
+
{{else}}
|
39
|
+
data-alternate-text="Add to myFT"
|
40
|
+
{{/if}}
|
41
|
+
{{/if}}
|
42
|
+
{{else}}
|
43
|
+
aria-pressed="false"
|
44
|
+
aria-label="Add {{name}} to myFT"
|
45
|
+
title="Add {{name}} to myFT"
|
46
|
+
data-alternate-label="Remove {{name}} from myFT"
|
47
|
+
{{#if alternateText}}
|
48
|
+
data-alternate-text="{{alternateText}}"
|
49
|
+
{{else}}
|
50
|
+
{{#if buttonText}}
|
51
|
+
data-alternate-text="{{buttonText}}"
|
52
|
+
{{else}}
|
53
|
+
data-alternate-text="Added"
|
54
|
+
{{/if}}
|
55
|
+
{{/if}}
|
56
|
+
{{/ifAll}}
|
57
|
+
class="{{extraButtonClasses}}
|
58
|
+
n-myft-follow-button
|
59
|
+
{{~#variant}} n-myft-follow-button--{{this}}{{/variant~}}"
|
60
|
+
data-concept-id="{{conceptId}}" {{! duplicated here for tracking}}
|
61
|
+
{{#if followPlusDigestEmail}}
|
62
|
+
data-trackable-context-messaging="add-to-myft-plus-digest-button"
|
63
|
+
{{/if}}
|
64
|
+
data-trackable="follow"
|
65
|
+
type="submit">
|
66
|
+
{{~#if buttonText~}}
|
67
|
+
{{buttonText}}
|
68
|
+
{{~else~}}
|
69
|
+
{{~#ifAll setFollowButtonStateToSelected @root.cacheablePersonalisedUrl~}}
|
70
|
+
Added
|
71
|
+
{{~else~}}
|
72
|
+
Add to myFT
|
73
|
+
{{~/ifAll~}}
|
74
|
+
{{~/if~}}
|
75
|
+
</button>
|
76
|
+
</form>
|
77
|
+
{{else}}
|
78
|
+
<!-- Add to myFT button hidden due to myFtApiWrite being off -->
|
79
|
+
{{/if}}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
{{#if @root.flags.myFtApiWrite}}
|
2
|
+
<form class="n-myft-ui n-myft-ui--instant{{#if hideButtonText}} n-myft-ui--instant--hide-text{{/if}} {{extraClasses}}"
|
3
|
+
method="GET"
|
4
|
+
data-myft-ui="instant"
|
5
|
+
data-concept-id="{{conceptId}}"
|
6
|
+
action="/myft/add/{{conceptId}}?instant=true"
|
7
|
+
data-js-action="/__myft/api/core/followed/concept/{{conceptId}}?method=put">
|
8
|
+
{{> n-myft-ui/components/csrf-token/input}}
|
9
|
+
<input type="hidden" value="{{name}}" name="name">
|
10
|
+
{{#if directType}}
|
11
|
+
<input type="hidden" value="{{directType}}" name="directType">
|
12
|
+
{{else}}
|
13
|
+
<input type="hidden" value="http://www.ft.com/ontology/concept/Concept" name="directType">
|
14
|
+
{{/if}}
|
15
|
+
<button
|
16
|
+
aria-label="Get instant alerts for {{name}}"
|
17
|
+
{{#ifAll hasInstantAlert @root.cacheablePersonalisedUrl}}
|
18
|
+
aria-pressed="true"
|
19
|
+
{{else}}
|
20
|
+
aria-pressed="false"
|
21
|
+
{{/ifAll}}
|
22
|
+
class="n-myft-ui__button
|
23
|
+
{{#variant}} n-myft-ui__button--{{this}}{{/variant}}
|
24
|
+
{{#size}} n-myft-ui__button--{{this}}{{/size}}
|
25
|
+
n-myft-ui__button--instant
|
26
|
+
n-myft-ui__button--instant-light"
|
27
|
+
data-alternate-label="Stop instant alerts for {{name}}"
|
28
|
+
{{#if alternateText}}
|
29
|
+
data-alternate-text="{{alternateText}}"
|
30
|
+
{{else}}
|
31
|
+
{{#if buttonText}}
|
32
|
+
data-alternate-text="{{buttonText}}"
|
33
|
+
{{else}}
|
34
|
+
data-alternate-text="Instant alerts"
|
35
|
+
{{/if}}
|
36
|
+
{{/if}}
|
37
|
+
data-concept-id="{{conceptId}}" {{! duplicated here for tracking}}
|
38
|
+
data-trackable="instant"
|
39
|
+
title="Get instant alerts for {{name}}"
|
40
|
+
name="_rel.instant"
|
41
|
+
value="{{#if hasInstantAlert}}false{{else}}true{{/if}}"
|
42
|
+
type="submit"
|
43
|
+
>{{#if buttonText}}{{buttonText}}{{else}}Instant alerts{{/if}}</button>
|
44
|
+
</form>
|
45
|
+
{{else}}
|
46
|
+
<!-- Instant alert button hidden due to myFtApiWrite being off -->
|
47
|
+
{{/if}}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{{#if showPrioritiseButton}}
|
2
|
+
<span class="myft-pin-divider"></span>
|
3
|
+
<div class="myft-pin-button-wrapper">
|
4
|
+
<form method="post" action="/__myft/api/core/prioritised/concept/{{id}}?method={{#if prioritised}}delete{{else}}put{{/if}}" data-myft-prioritise>
|
5
|
+
{{> n-myft-ui/components/csrf-token/input }}
|
6
|
+
<input type="hidden" value="{{name}}" name="name"> {{#if directType}}
|
7
|
+
<input type="hidden" value="{{directType}}" name="directType"> {{else}}
|
8
|
+
<input type="hidden" value="http://www.ft.com/ontology/concept/Concept" name="directType"> {{/if}}
|
9
|
+
<div
|
10
|
+
class="n-myft-ui__announcement o-normalise-visually-hidden"
|
11
|
+
aria-live="assertive"
|
12
|
+
data-pressed-text="{{name}} pinned in myFT."
|
13
|
+
data-unpressed-text="Unpinned {{name}} from myFT."
|
14
|
+
></div>
|
15
|
+
<button id="myft-pin-button__{{id}}" class="myft-pin-button" data-prioritise-button data-trackable="prioritised" data-concept-id="{{id}}" data-prioritised="{{#if prioritised}}true{{else}}false{{/if}}"
|
16
|
+
aria-label="{{#if prioritised}}Unpin{{else}}Pin{{/if}} {{name}} {{#if prioritised}}from{{else}}in{{/if}} myFT" aria-pressed="{{#if prioritised}}true{{else}}false{{/if}}" title="{{#if prioritised}}Unpin{{else}}Pin{{/if}} {{name}}">
|
17
|
+
</button>
|
18
|
+
</form>
|
19
|
+
</div>
|
20
|
+
{{/if}}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
{{#if @root.flags.myFtApiWrite}}
|
2
|
+
<form class="n-myft-ui n-myft-ui--save" method="GET"
|
3
|
+
data-content-id="{{contentId}}"
|
4
|
+
data-myft-ui="saved"
|
5
|
+
action="/myft/save/{{contentId}}"
|
6
|
+
data-js-action="/__myft/api/core/saved/content/{{contentId}}?method=put">
|
7
|
+
{{> n-myft-ui/components/csrf-token/input}}
|
8
|
+
<div
|
9
|
+
class="n-myft-ui__announcement o-normalise-visually-hidden"
|
10
|
+
aria-live="assertive"
|
11
|
+
data-pressed-text="Article saved in My FT."
|
12
|
+
data-unpressed-text="Removed article from My FT."
|
13
|
+
></div>
|
14
|
+
<button
|
15
|
+
type="submit"
|
16
|
+
class="{{#if saveButtonWithIcon}}n-myft-ui__save-button-with-icon{{else}}n-myft-ui__button{{#variant}} n-myft-ui__button--{{this}}{{/variant}}{{/if}}"
|
17
|
+
data-trackable="{{#if trackableId}}{{trackableId}}{{else}}save-for-later{{/if}}"
|
18
|
+
{{#if isSaved}}
|
19
|
+
{{!-- The value of alternate label needs to be the opposite of label / the current saved state. This allows the client side JS to toggle the labels on state changes --}}
|
20
|
+
title="{{#if title}}{{title}} is{{/if}} Saved to myFT"
|
21
|
+
aria-label="{{#if title}}{{title}} is{{/if}} Saved to myFT"
|
22
|
+
data-alternate-label="{{#if title}}Save {{title}} to myFT for later{{else}}Save this article to myFT for later{{/if}}"
|
23
|
+
aria-pressed="true"
|
24
|
+
{{else}}
|
25
|
+
title="{{#if title}}Save {{title}} to myFT for later{{else}}Save this article to myFT for later{{/if}}"
|
26
|
+
aria-label="{{#if title}}Save {{title}} to myFT for later{{else}}Save this article to myFT for later{{/if}}"
|
27
|
+
data-alternate-label="{{#if title}}{{title}} is{{/if}} Saved to myFT"
|
28
|
+
aria-pressed="false"
|
29
|
+
{{/if}}
|
30
|
+
{{#unlessEquals appIsStreamPage true}}
|
31
|
+
{{#if saveButtonWithIcon}}
|
32
|
+
data-text-variant="save-button-with-icon-copy"
|
33
|
+
{{else}}
|
34
|
+
data-text-variant="save-button-longer-copy"
|
35
|
+
{{/if}}
|
36
|
+
{{/unlessEquals}}
|
37
|
+
{{#if alternateText}}
|
38
|
+
data-alternate-text="{{alternateText}}"
|
39
|
+
{{else}}
|
40
|
+
{{#if isSaved}}
|
41
|
+
data-alternate-text="Save "
|
42
|
+
{{else}}
|
43
|
+
data-alternate-text="Saved "
|
44
|
+
{{/if}}
|
45
|
+
{{/if}}
|
46
|
+
data-content-id="{{contentId}}" {{! duplicated here for tracking}}
|
47
|
+
>
|
48
|
+
{{#if saveButtonWithIcon}}
|
49
|
+
<span class="save-button-with-icon-copy" data-variant-label>{{#if buttonText~}}
|
50
|
+
{{buttonText}}
|
51
|
+
{{~else~}}
|
52
|
+
{{#if isSaved}}Saved{{else}}Save{{/if}}
|
53
|
+
{{~/if}}</span>
|
54
|
+
{{else}}
|
55
|
+
{{#if buttonText}}{{buttonText}}{{else}}
|
56
|
+
{{#unlessEquals appIsStreamPage true}}
|
57
|
+
<span class="save-button-longer-copy" data-variant-label>{{#if isSaved}}Saved {{else}}Save {{/if}}</span><span class="n-myft-ui__button--viewport-large" aria-hidden="true">to myFT</span>
|
58
|
+
{{else}}
|
59
|
+
<span>{{#if isSaved}}Saved{{else}}Save{{/if}}</span>
|
60
|
+
{{/unlessEquals}}
|
61
|
+
{{/if}}
|
62
|
+
{{/if}}
|
63
|
+
</button>
|
64
|
+
</form>
|
65
|
+
{{else}}
|
66
|
+
<!-- Save button hidden due to myFtApiWrite being off -->
|
67
|
+
{{/if }}
|
@@ -2,12 +2,12 @@
|
|
2
2
|
// the detail => https://github.com/date-fns/date-fns/blob/HEAD/CHANGELOG.md#200---2019-08-20
|
3
3
|
// By adding validation for dates before their functions allows us to know it when unexpected value passed.
|
4
4
|
|
5
|
-
import isTodayOriginal from
|
6
|
-
import isAfterOriginal from
|
7
|
-
import addMinutesOriginal from
|
8
|
-
import startOfDayOriginal from
|
9
|
-
import isValidOriginal from
|
10
|
-
import parseISO from
|
5
|
+
import isTodayOriginal from "date-fns/src/isToday";
|
6
|
+
import isAfterOriginal from "date-fns/src/isAfter";
|
7
|
+
import addMinutesOriginal from "date-fns/src/addMinutes";
|
8
|
+
import startOfDayOriginal from "date-fns/src/startOfDay";
|
9
|
+
import isValidOriginal from "date-fns/src/isValid";
|
10
|
+
import parseISO from "date-fns/src/parseISO";
|
11
11
|
|
12
12
|
const isValid = (date) => {
|
13
13
|
if (!isValidOriginal(date)) {
|
package/demos/app.js
CHANGED
@@ -1,17 +1,11 @@
|
|
1
|
-
require('sucrase/register');
|
2
1
|
const nExpress = require('@financial-times/n-express');
|
3
2
|
const chalk = require('chalk');
|
4
3
|
const errorHighlight = chalk.bold.red;
|
5
4
|
const highlight = chalk.bold.green;
|
6
|
-
const { PageKitReactJSX } = require('@financial-times/dotcom-server-react-jsx');
|
7
|
-
const fs = require('fs');
|
8
5
|
const path = require('path');
|
9
6
|
const handlebars = require('handlebars');
|
10
7
|
const { PageKitHandlebars, helpers } = require('@financial-times/dotcom-server-handlebars');
|
11
8
|
|
12
|
-
const demoJSX = require('./templates/demo').default;
|
13
|
-
const demoLayoutSource = fs.readFileSync(path.join(__dirname, './templates/demo-layout.html'),'utf8').toString();
|
14
|
-
|
15
9
|
const fixtures = {
|
16
10
|
followButton: require('./fixtures/follow-button'),
|
17
11
|
saveButton: require('./fixtures/save-button'),
|
@@ -37,43 +31,26 @@ const app = module.exports = nExpress({
|
|
37
31
|
|
38
32
|
app.set('views', path.join(__dirname, '/templates'));
|
39
33
|
app.set('view engine', '.html');
|
40
|
-
|
41
34
|
app.engine('.html', new PageKitHandlebars({
|
42
35
|
cache: false,
|
43
36
|
handlebars,
|
44
|
-
helpers
|
37
|
+
helpers: {
|
38
|
+
...helpers
|
39
|
+
}
|
45
40
|
}).engine);
|
46
41
|
|
47
42
|
app.use('/public', nExpress.static(path.join(__dirname, '../public'), { redirect: false }));
|
48
43
|
|
49
|
-
const jsxRenderer = (new PageKitReactJSX({ includeDoctype: false }));
|
50
|
-
|
51
44
|
app.get('/', (req, res) => {
|
52
45
|
res.render('demo', Object.assign({
|
53
|
-
title: 'n-myft-ui demo',
|
54
|
-
flags: {
|
55
|
-
myFtApi: true,
|
56
|
-
myFtApiWrite: true
|
57
|
-
},
|
58
|
-
}, fixtures));
|
59
|
-
});
|
60
|
-
|
61
|
-
app.get('/demo-jsx', async (req, res) => {
|
62
|
-
let demo = await jsxRenderer.render(demoJSX, Object.assign({
|
63
46
|
title: 'n-myft-ui demo',
|
64
47
|
flags: {
|
65
48
|
myFtApi: true,
|
66
49
|
myFtApiWrite: true
|
67
50
|
}
|
68
51
|
}, fixtures));
|
69
|
-
|
70
|
-
let template = handlebars.compile(demoLayoutSource);
|
71
|
-
let result = template({body: demo});
|
72
|
-
|
73
|
-
res.send(result);
|
74
52
|
});
|
75
53
|
|
76
|
-
|
77
54
|
function runPa11yTests () {
|
78
55
|
const spawn = require('child_process').spawn;
|
79
56
|
const pa11y = spawn('pa11y-ci');
|
@@ -32,7 +32,7 @@
|
|
32
32
|
</h2>
|
33
33
|
|
34
34
|
{{#followButton}}
|
35
|
-
{{
|
35
|
+
{{> n-myft-ui/components/follow-button/follow-button}}
|
36
36
|
{{/followButton}}
|
37
37
|
|
38
38
|
<h2
|
@@ -41,51 +41,52 @@
|
|
41
41
|
</h2>
|
42
42
|
|
43
43
|
{{#followButton}}
|
44
|
-
{{
|
44
|
+
{{> n-myft-ui/components/follow-button/follow-button buttonText=name}}
|
45
45
|
{{/followButton}}
|
46
46
|
|
47
47
|
{{#saveButton}}
|
48
48
|
<h2 class="demo-section__title">
|
49
49
|
Save button
|
50
50
|
</h2>
|
51
|
-
{{
|
51
|
+
{{> n-myft-ui/components/save-for-later/save-for-later }}
|
52
52
|
{{/saveButton}}
|
53
53
|
|
54
54
|
{{#saveButton}}
|
55
55
|
<h2 class="demo-section__title">
|
56
56
|
Unsave button
|
57
57
|
</h2>
|
58
|
-
{{
|
58
|
+
{{> n-myft-ui/components/save-for-later/save-for-later isSaved=true }}
|
59
59
|
{{/saveButton}}
|
60
60
|
|
61
61
|
{{#saveButton}}
|
62
62
|
<h2 class="demo-section__title">
|
63
63
|
Save button with icon
|
64
64
|
</h2>
|
65
|
-
{{
|
65
|
+
{{> n-myft-ui/components/save-for-later/save-for-later saveButtonWithIcon=true }}
|
66
66
|
{{/saveButton}}
|
67
67
|
|
68
68
|
{{#saveButton}}
|
69
69
|
<h2 class="demo-section__title">
|
70
70
|
Unsave button with icon
|
71
71
|
</h2>
|
72
|
-
{{
|
72
|
+
{{> n-myft-ui/components/save-for-later/save-for-later isSaved=true saveButtonWithIcon=true }}
|
73
73
|
{{/saveButton}}
|
74
74
|
|
75
75
|
<h2 class="demo-section__title">
|
76
76
|
Pin button
|
77
77
|
</h2>
|
78
78
|
{{#each pinButton}}
|
79
|
-
{{
|
79
|
+
{{> n-myft-ui/components/pin-button/pin-button }}
|
80
80
|
{{/each}}
|
81
81
|
|
82
82
|
{{#instantAlert}}
|
83
83
|
<h2 class="demo-section__title">
|
84
84
|
Instant Alert
|
85
85
|
</h2>
|
86
|
-
{{
|
86
|
+
{{> n-myft-ui/components/instant-alert/instant-alert }}
|
87
87
|
{{/instantAlert}}
|
88
88
|
|
89
|
+
|
89
90
|
</div>
|
90
91
|
</div>
|
91
92
|
</section>
|
@@ -448,7 +449,7 @@
|
|
448
449
|
|
449
450
|
{{#collections}}
|
450
451
|
<div data-o-grid-colspan="3">
|
451
|
-
{{
|
452
|
+
{{> n-myft-ui/components/collections/collections }}
|
452
453
|
</div>
|
453
454
|
{{/collections}}
|
454
455
|
</div>
|
@@ -470,7 +471,7 @@
|
|
470
471
|
|
471
472
|
{{#each conceptList}}
|
472
473
|
<div data-o-grid-colspan="3">
|
473
|
-
{{
|
474
|
+
{{> n-myft-ui/components/concept-list/concept-list }}
|
474
475
|
</div>
|
475
476
|
{{/each}}
|
476
477
|
</div>
|
package/package.json
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@financial-times/n-myft-ui",
|
3
|
-
"version": "
|
3
|
+
"version": "27.1.0",
|
4
4
|
"description": "Client side component for interaction with myft",
|
5
|
-
"main": "
|
6
|
-
"module": "dist/bundles/bundle.js",
|
5
|
+
"main": "server.js",
|
7
6
|
"scripts": {
|
8
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
9
8
|
"commit": "commit-wizard",
|
10
9
|
"prepare": "npx snyk protect || npx snyk protect -d || true",
|
11
|
-
"preinstall": "
|
12
|
-
"build-package": "webpack"
|
10
|
+
"preinstall": "npm_config_yes=true npx check-engine"
|
13
11
|
},
|
14
12
|
"repository": {
|
15
13
|
"type": "git",
|
@@ -22,18 +20,14 @@
|
|
22
20
|
},
|
23
21
|
"homepage": "https://github.com/Financial-Times/n-myft-ui#readme",
|
24
22
|
"devDependencies": {
|
25
|
-
"@financial-times/dotcom-build-bower-resolve": "
|
26
|
-
"@financial-times/dotcom-build-code-splitting": "0.
|
27
|
-
"@financial-times/dotcom-build-js": "0.
|
28
|
-
"@financial-times/dotcom-build-sass": "0.
|
29
|
-
"@financial-times/dotcom-page-kit-cli": "0.
|
30
|
-
"@financial-times/dotcom-server-handlebars": "^
|
31
|
-
"@financial-times/
|
32
|
-
"@financial-times/n-express": "^22.4.1",
|
23
|
+
"@financial-times/dotcom-build-bower-resolve": "^2.6.2",
|
24
|
+
"@financial-times/dotcom-build-code-splitting": "^5.0.0",
|
25
|
+
"@financial-times/dotcom-build-js": "^5.0.0",
|
26
|
+
"@financial-times/dotcom-build-sass": "^5.0.0",
|
27
|
+
"@financial-times/dotcom-page-kit-cli": "^0.6.5",
|
28
|
+
"@financial-times/dotcom-server-handlebars": "^5.0.0",
|
29
|
+
"@financial-times/n-express": "^23.0.1",
|
33
30
|
"@financial-times/n-gage": "^8.3.2",
|
34
|
-
"@sucrase/jest-plugin": "^2.2.0",
|
35
|
-
"@testing-library/jest-dom": "^5.16.1",
|
36
|
-
"@testing-library/react": "^12.1.2",
|
37
31
|
"ascii-table": "0.0.9",
|
38
32
|
"autoprefixer": "9.7.0",
|
39
33
|
"aws-sdk-mock": "4.5.0",
|
@@ -46,8 +40,6 @@
|
|
46
40
|
"babel-plugin-transform-runtime": "^6.9.0",
|
47
41
|
"babel-preset-env": "^1.7.0",
|
48
42
|
"babel-preset-es2015": "^6.6.0",
|
49
|
-
"babel-preset-react": "^6.24.1",
|
50
|
-
"babel-preset-stage-2": "^6.24.1",
|
51
43
|
"babel-runtime": "^6.9.2",
|
52
44
|
"bower": "^1.8.8",
|
53
45
|
"bower-resolve-webpack-plugin": "^1.0.5",
|
@@ -59,18 +51,14 @@
|
|
59
51
|
"css-loader": "^0.23.1",
|
60
52
|
"denodeify": "^1.2.1",
|
61
53
|
"eslint": "6.5.1",
|
62
|
-
"eslint-plugin-react": "^7.27.1",
|
63
54
|
"extract-css-block-webpack-plugin": "^1.3.0",
|
64
|
-
"extract-text-webpack-plugin": "3.0.2",
|
65
55
|
"fetch-mock": "^5.0.3",
|
66
56
|
"handlebars": "^4.0.6",
|
67
57
|
"handlebars-loader": "^1.4.0",
|
68
58
|
"http-server": "^0.11.1",
|
69
59
|
"hyperons": "^0.4.1",
|
70
60
|
"imports-loader": "0.8.0",
|
71
|
-
"inject-loader": "^
|
72
|
-
"jest": "^27.4.5",
|
73
|
-
"jsdom": "^19.0.0",
|
61
|
+
"inject-loader": "^4.0.1",
|
74
62
|
"karma": "4.4.1",
|
75
63
|
"karma-browserstack-launcher": "1.5.1",
|
76
64
|
"karma-chai": "^0.1.0",
|
@@ -81,31 +69,29 @@
|
|
81
69
|
"karma-sinon": "^1.0.5",
|
82
70
|
"karma-sinon-chai": "2.0.2",
|
83
71
|
"karma-sourcemap-loader": "^0.3.7",
|
84
|
-
"karma-webpack": "^
|
72
|
+
"karma-webpack": "^4.0.2",
|
85
73
|
"lintspaces-cli": "^0.7.0",
|
86
74
|
"lolex": "5.1.1",
|
87
75
|
"mocha": "6.2.2",
|
88
76
|
"mockery": "2.1.0",
|
89
77
|
"node-fetch": "2.6.0",
|
90
|
-
"node-sass": "^
|
78
|
+
"node-sass": "^6.0.1",
|
91
79
|
"nodemon": "^1.9.2",
|
92
80
|
"npm-prepublish": "^1.2.1",
|
93
81
|
"pa11y-ci": "^2.1.1",
|
94
82
|
"postcss-loader": "^0.9.1",
|
95
|
-
"react": "^17.0.2",
|
96
83
|
"regenerator-runtime": "^0.13.3",
|
97
84
|
"semver": "6.3.0",
|
98
85
|
"sinon": "^7.1.0",
|
99
86
|
"sinon-chai": "^3.2.0",
|
100
|
-
"snyk": "^1.216.5"
|
101
|
-
"sucrase": "^3.10.1"
|
87
|
+
"snyk": "^1.216.5"
|
102
88
|
},
|
103
89
|
"volta": {
|
104
|
-
"node": "
|
90
|
+
"node": "16.14.2",
|
105
91
|
"npm": "7.20.2"
|
106
92
|
},
|
107
93
|
"engines": {
|
108
|
-
"node": "
|
94
|
+
"node": "14.x || 16.x",
|
109
95
|
"npm": "7.x || 8.x"
|
110
96
|
},
|
111
97
|
"x-dash": {
|