@financial-times/n-myft-ui 24.0.0 → 25.0.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.circleci/config.yml +18 -18
- package/README.md +51 -0
- package/build-state/npm-shrinkwrap.json +41988 -10988
- package/components/collections/collections.jsx +68 -0
- package/components/collections/collections.test.js +83 -0
- package/components/concept-list/concept-list.jsx +55 -0
- package/components/concept-list/concept-list.test.js +116 -0
- package/components/follow-button/__tests__/follow-button.test.js +3 -3
- package/components/follow-button/follow-button.jsx +3 -3
- package/components/index.js +15 -0
- package/components/pin-button/pin-button.jsx +40 -0
- package/components/pin-button/pin-button.test.js +57 -0
- package/components/save-for-later/save-for-later.jsx +103 -0
- package/components/save-for-later/save-for-later.test.js +59 -0
- package/demos/app.js +18 -27
- package/demos/templates/demo-layout.html +1 -1
- package/demos/templates/demo.html +436 -413
- package/demos/templates/demo.jsx +93 -1
- package/dist/bundles/bundle.js +3133 -0
- package/package.json +19 -9
- package/webpack.config.js +34 -0
- package/components/collections/collections.html +0 -77
- package/components/concept-list/concept-list.html +0 -28
- package/components/pin-button/pin-button.html +0 -20
- package/components/save-for-later/save-for-later.html +0 -67
- package/demos/fixtures/follow-button-plus-digest.json +0 -6
- package/demos/templates/digest-on-follow.html +0 -12
package/demos/app.js
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require('sucrase/register');
|
2
|
-
const
|
2
|
+
const nExpress = require('@financial-times/n-express');
|
3
3
|
const chalk = require('chalk');
|
4
4
|
const errorHighlight = chalk.bold.red;
|
5
5
|
const highlight = chalk.bold.green;
|
6
6
|
const { PageKitReactJSX } = require('@financial-times/dotcom-server-react-jsx');
|
7
7
|
const fs = require('fs');
|
8
8
|
const path = require('path');
|
9
|
-
const xHandlebars = require('@financial-times/x-handlebars');
|
10
9
|
const handlebars = require('handlebars');
|
11
|
-
const { helpers } = require('@financial-times/dotcom-server-handlebars');
|
10
|
+
const { PageKitHandlebars, helpers } = require('@financial-times/dotcom-server-handlebars');
|
12
11
|
|
13
12
|
const demoJSX = require('./templates/demo').default;
|
14
13
|
const demoLayoutSource = fs.readFileSync(path.join(__dirname, './templates/demo-layout.html'),'utf8').toString();
|
@@ -22,43 +21,46 @@ const fixtures = {
|
|
22
21
|
instantAlert: require('./fixtures/instant-alert')
|
23
22
|
};
|
24
23
|
|
25
|
-
const app = module.exports =
|
24
|
+
const app = module.exports = nExpress({
|
26
25
|
name: 'public',
|
27
26
|
systemCode: 'n-myft-ui-demo',
|
28
27
|
withFlags: true,
|
29
|
-
|
30
|
-
|
28
|
+
withConsent: false,
|
29
|
+
withServiceMetrics: false,
|
31
30
|
withAnonMiddleware: false,
|
32
31
|
hasHeadCss: false,
|
33
|
-
layoutsDir: 'demos/templates',
|
34
|
-
viewsDirectory: '/demos/templates',
|
35
32
|
partialsDirectory: process.cwd(),
|
36
33
|
directory: process.cwd(),
|
37
34
|
demo: true,
|
38
|
-
|
39
|
-
helpers: {
|
40
|
-
x: xHandlebars(),
|
41
|
-
renderReactComponent: helpers.renderReactComponent
|
42
|
-
},
|
35
|
+
withBackendAuthentication: false,
|
43
36
|
});
|
44
37
|
|
38
|
+
app.set('views', path.join(__dirname, '/templates'));
|
39
|
+
app.set('view engine', '.html');
|
40
|
+
|
41
|
+
app.engine('.html', new PageKitHandlebars({
|
42
|
+
cache: false,
|
43
|
+
handlebars,
|
44
|
+
helpers
|
45
|
+
}).engine);
|
46
|
+
|
47
|
+
app.use('/public', nExpress.static(path.join(__dirname, '../public'), { redirect: false }));
|
48
|
+
|
45
49
|
const jsxRenderer = (new PageKitReactJSX({ includeDoctype: false }));
|
46
50
|
|
47
51
|
app.get('/', (req, res) => {
|
48
52
|
res.render('demo', Object.assign({
|
49
53
|
title: 'n-myft-ui demo',
|
50
|
-
layout: 'demo-layout',
|
51
54
|
flags: {
|
52
55
|
myFtApi: true,
|
53
56
|
myFtApiWrite: true
|
54
|
-
}
|
57
|
+
},
|
55
58
|
}, fixtures));
|
56
59
|
});
|
57
60
|
|
58
61
|
app.get('/demo-jsx', async (req, res) => {
|
59
62
|
let demo = await jsxRenderer.render(demoJSX, Object.assign({
|
60
63
|
title: 'n-myft-ui demo',
|
61
|
-
layout: 'demo-layout',
|
62
64
|
flags: {
|
63
65
|
myFtApi: true,
|
64
66
|
myFtApiWrite: true
|
@@ -71,17 +73,6 @@ app.get('/demo-jsx', async (req, res) => {
|
|
71
73
|
res.send(result);
|
72
74
|
});
|
73
75
|
|
74
|
-
app.get('/digest-on-follow', (req, res) => {
|
75
|
-
res.render('digest-on-follow', Object.assign({
|
76
|
-
title: 'n-myft-ui digest on follow',
|
77
|
-
layout: 'demo-layout',
|
78
|
-
flags: {
|
79
|
-
myFtApi: true,
|
80
|
-
myFtApiWrite: true,
|
81
|
-
},
|
82
|
-
appIsStreamPage: false
|
83
|
-
}, fixtures.followButtonPlusDigest));
|
84
|
-
});
|
85
76
|
|
86
77
|
function runPa11yTests () {
|
87
78
|
const spawn = require('child_process').spawn;
|