@financial-times/n-myft-ui 23.1.3 → 25.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/.circleci/config.yml +27 -30
  2. package/.circleci/shared-helpers/helper-npm-install-peer-deps +6 -5
  3. package/.github/settings.yml +1 -1
  4. package/.scss-lint.yml +3 -3
  5. package/Makefile +1 -0
  6. package/README.md +62 -8
  7. package/build-state/npm-shrinkwrap.json +49383 -17508
  8. package/components/collections/collections.jsx +68 -0
  9. package/components/collections/collections.test.js +83 -0
  10. package/components/concept-list/concept-list.jsx +55 -0
  11. package/components/concept-list/concept-list.test.js +116 -0
  12. package/components/csrf-token/__tests__/input.test.js +23 -0
  13. package/components/csrf-token/input.jsx +26 -0
  14. package/components/follow-button/__tests__/follow-button.test.js +40 -0
  15. package/components/follow-button/follow-button.jsx +174 -0
  16. package/components/index.js +15 -0
  17. package/components/instant-alert/instant-alert.html +1 -1
  18. package/components/pin-button/pin-button.jsx +40 -0
  19. package/components/pin-button/pin-button.test.js +57 -0
  20. package/components/save-for-later/save-for-later.jsx +103 -0
  21. package/components/save-for-later/save-for-later.test.js +59 -0
  22. package/components/unread-articles-indicator/date-fns.js +5 -12
  23. package/demos/app.js +39 -21
  24. package/demos/templates/demo-layout.html +1 -1
  25. package/demos/templates/demo.html +436 -415
  26. package/demos/templates/demo.jsx +125 -0
  27. package/dist/bundles/bundle.js +3133 -0
  28. package/jest.config.js +8 -0
  29. package/package.json +38 -13
  30. package/webpack.config.js +34 -0
  31. package/components/collections/collections.html +0 -85
  32. package/components/concept-list/concept-list.html +0 -31
  33. package/components/csrf-token/input.html +0 -5
  34. package/components/follow-button/follow-button.html +0 -79
  35. package/components/pin-button/pin-button.html +0 -20
  36. package/components/save-for-later/save-for-later.html +0 -67
  37. package/demos/fixtures/follow-button-plus-digest.json +0 -6
  38. package/demos/templates/digest-on-follow.html +0 -12
@@ -0,0 +1,125 @@
1
+ import React from 'react';
2
+ import FollowButton from '../../components/follow-button/follow-button';
3
+ import ConceptList from '../../components/concept-list/concept-list';
4
+ import Collections from '../../components/collections/collections';
5
+ import { SaveForLater } from '../../components';
6
+ import { PinButton } from '../../components';
7
+
8
+ export default function Demo (props) {
9
+
10
+ const {
11
+ title,
12
+ flags,
13
+ followButton,
14
+ conceptList,
15
+ collections,
16
+ saveButton,
17
+ pinButton
18
+ } = props;
19
+
20
+ const followButtonProps = { ...followButton, flags };
21
+
22
+ return (
23
+ <div className="o-grid-container o-grid-container--snappy demo-container">
24
+ <h1>{title}</h1>
25
+
26
+ <section
27
+ id="follow-button"
28
+ className="demo-section">
29
+ <div className="o-grid-row">
30
+ <div data-o-grid-colspan="12">
31
+ <h2
32
+ className="demo-section__title">
33
+ Follow button
34
+ </h2>
35
+ <FollowButton {...followButtonProps} />
36
+
37
+
38
+ <h2
39
+ className="demo-section__title">
40
+ x-dash follow button
41
+ </h2>
42
+
43
+ <FollowButton {...followButtonProps} buttonText={followButton.name} />
44
+
45
+
46
+ <h2 className="demo-section__title">
47
+ Save button
48
+ </h2>
49
+ <SaveForLater flags={flags} {...saveButton} />
50
+
51
+ <h2 className="demo-section__title">
52
+ Unsave button
53
+ </h2>
54
+ <SaveForLater flags={flags} {...saveButton} isSaved={true} />
55
+
56
+ <h2 className="demo-section__title">
57
+ Unsave button with icon
58
+ </h2>
59
+ <SaveForLater flags={flags} {...saveButton} saveButtonWithIcon={true} />
60
+
61
+ <h2 className="demo-section__title">
62
+ Save button with icon
63
+ </h2>
64
+ <SaveForLater flags={flags} {...saveButton} isSaved={true} saveButtonWithIcon={true} />
65
+
66
+ <h2 className="demo-section__title">
67
+ Pin button
68
+ </h2>
69
+
70
+ {pinButton.map((item, index) => <PinButton key={index} {...item}/>)}
71
+
72
+ </div>
73
+ </div>
74
+ </section>
75
+
76
+ <section
77
+ id="topic-list"
78
+ className="demo-section">
79
+ <div className="o-grid-row">
80
+ <div data-o-grid-colspan="12">
81
+ <h2 className="demo-section__title">
82
+ Topic list
83
+ </h2>
84
+
85
+ <p className="demo-section__description">
86
+ A list of topics to follow
87
+ </p>
88
+ </div>
89
+
90
+ {
91
+ conceptList && conceptList.map((list, index) =>
92
+ <div key={index} data-o-grid-colspan="3">
93
+ <ConceptList {...list} flags={flags} />
94
+ </div>)
95
+ }
96
+
97
+ </div>
98
+ </section>
99
+
100
+ <section
101
+ id="collections"
102
+ className="demo-section">
103
+ <div className="o-grid-row">
104
+ <div data-o-grid-colspan="12">
105
+ <h2 className="demo-section__title">
106
+ Collections
107
+ </h2>
108
+
109
+ <p className="demo-section__description">
110
+ Curated collections of topics to follow.
111
+ </p>
112
+ </div>
113
+
114
+ {collections.map((collection, index) => (
115
+ <div key={index} data-o-grid-colspan="3">
116
+ <Collections {...collection} flags={flags} />
117
+ </div>
118
+ ))}
119
+
120
+ </div>
121
+ </section>
122
+
123
+ </div>
124
+ )
125
+ }