@newskit-render/core 1.44.0 → 1.48.1

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/__tests__/pages/[articleSlug].test.tsx +59 -18
  3. package/__tests__/pages/__snapshots__/home.test.tsx.snap +769 -1261
  4. package/components/article/Highlights.tsx +4 -33
  5. package/components/article/RelatedArticles.tsx +4 -53
  6. package/components/article/__tests__/__snapshots__/index.test.tsx.snap +53 -43
  7. package/components/section/ArticleSlice.tsx +17 -43
  8. package/components/section/CollectionBlock.tsx +38 -6
  9. package/components/section/__tests__/ArticleSlice.test.tsx +37 -51
  10. package/components/section/__tests__/CollectionBlock.test.tsx +63 -13
  11. package/components/section/__tests__/pageBlock.test.tsx +8 -4
  12. package/components/section/index.tsx +17 -12
  13. package/components/section/layouts/Lead.tsx +36 -15
  14. package/components/section/layouts/Rows.tsx +67 -0
  15. package/components/section/layouts/{SectionRow.tsx → SectionTitle.tsx} +24 -52
  16. package/components/section/layouts/__tests__/Lead.test.tsx +31 -6
  17. package/components/section/layouts/__tests__/Rows.test.tsx +28 -0
  18. package/components/section/layouts/__tests__/SectionTitle.test.tsx +36 -0
  19. package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +274 -315
  20. package/components/section/layouts/__tests__/__snapshots__/SectionTitle.test.tsx.snap +942 -0
  21. package/components/section/layouts/gridUtils.ts +12 -9
  22. package/components/section/layouts/index.tsx +2 -1
  23. package/components/section/layouts/types.ts +5 -1
  24. package/components/section/{pageBlock.ts → pageBlock.tsx} +5 -2
  25. package/components/teaser/index.tsx +7 -6
  26. package/components/teaser/teaserVariants.ts +2 -0
  27. package/components/teaser/variants/horizontal.ts +14 -0
  28. package/cypress/e2e/account/account-page.spec.js +27 -1
  29. package/cypress/e2e/account/main-api.spec.js +4 -4
  30. package/cypress/support/commands.js +2 -2
  31. package/helpers/mocks/getPageMock.ts +2 -59
  32. package/next.config.js +4 -0
  33. package/package.json +8 -7
  34. package/pages/[section]/[articleId]/[articleSlug].tsx +14 -3
  35. package/pages/api/feed.ts +19 -0
  36. package/pages/api/news-sitemap.ts +10 -2
  37. package/pages/api/sitemap.ts +10 -6
  38. package/temp/_app.tsx +209 -0
  39. package/temp/header.tsx +1 -1
  40. package/components/section/layouts/Row.tsx +0 -28
  41. package/components/section/layouts/__tests__/SectionRow.test.tsx +0 -56
  42. package/components/section/layouts/__tests__/__snapshots__/SectionRow.test.tsx.snap +0 -4542
package/temp/_app.tsx CHANGED
@@ -13,6 +13,215 @@ if (!process.browser) {
13
13
  }
14
14
 
15
15
  const GlobalStyling = css`
16
+ @font-face {
17
+ font-family: GillSansMTStd-Medium;
18
+ src: url('/fonts/GillSansMTStd-Medium.otf');
19
+ }
20
+ @font-face {
21
+ font-family: TimesModern-Bold;
22
+ src: url('/fonts/TimesDigital-Bold.ttf') format('truetype');
23
+ }
24
+ @font-face {
25
+ font-family: TimesModern-Regular;
26
+ src: url('/fonts/TimesDigital-Regular.ttf') format('truetype');
27
+ }
28
+ @font-face {
29
+ font-family: TimesDigitalW04-Regular;
30
+ src: url('/fonts/TimesDigitalW04-Regular.ttf') format('truetype');
31
+ }
32
+ @font-face {
33
+ font-family: Montserrat;
34
+ src: url('/fonts/Montserrat-Regular.ttf') format('truetype');
35
+ }
36
+ @font-face {
37
+ font-family: TheSun-Bold;
38
+ src: url('/fonts/TheSun-Bold.ttf') format('truetype');
39
+ }
40
+ @font-face {
41
+ font-family: TheSun-HeavyNarrow;
42
+ src: url('/fonts/TheSun-HeavyNarrow.ttf') format('truetype');
43
+ }
44
+ @font-face {
45
+ font-family: TheSun-Regular;
46
+ src: url('/fonts/TheSun-Regular.ttf') format('truetype');
47
+ }
48
+ @font-face {
49
+ font-family: TheSun-Medium;
50
+ src: url('/fonts/TheSun-Medium.ttf') format('truetype');
51
+ }
52
+ @font-face {
53
+ font-family: 'DM Sans';
54
+ src: url('/fonts/dmsans-regular-webfont.woff2') format('woff2'),
55
+ url('/fonts/dmsans-regular-webfont.woff') format('woff');
56
+ font-style: normal;
57
+ font-weight: 400;
58
+ font-display: swap;
59
+ }
60
+ @font-face {
61
+ font-family: 'DM Sans';
62
+ src: url('/fonts/dmsans-italic-webfont.woff2') format('woff2'),
63
+ url('/fonts/dmsans-italic-webfont.woff') format('woff');
64
+ font-style: italic;
65
+ font-weight: 400;
66
+ font-display: swap;
67
+ }
68
+ @font-face {
69
+ font-family: 'DM Sans';
70
+ src: url('/fonts/dmsans-medium-webfont.woff2') format('woff2'),
71
+ url('/fonts/dmsans-medium-webfont.woff') format('woff');
72
+ font-style: normal;
73
+ font-weight: 500;
74
+ font-display: swap;
75
+ }
76
+ @font-face {
77
+ font-family: 'DM Sans';
78
+ src: url('/fonts/dmsans-mediumitalic-webfont.woff2') format('woff2'),
79
+ url('/fonts/dmsans-mediumitalic-webfont.woff') format('woff');
80
+ font-style: italic;
81
+ font-weight: 500;
82
+ font-display: swap;
83
+ }
84
+ @font-face {
85
+ font-family: 'DM Sans';
86
+ src: url('/fonts/dmsans-bold-webfont.woff2') format('woff2'),
87
+ url('/fonts/dmsans-bold-webfont.woff') format('woff');
88
+ font-style: normal;
89
+ font-weight: 700;
90
+ font-display: swap;
91
+ }
92
+ @font-face {
93
+ font-family: 'DM Sans';
94
+ src: url('/fonts/dmsans-bolditalic-webfont.woff2') format('woff2'),
95
+ url('/fonts/dmsans-bolditalic-webfont.woff') format('woff');
96
+ font-style: italic;
97
+ font-weight: 700;
98
+ font-display: swap;
99
+ }
100
+ @font-face {
101
+ font-family: 'Poppins';
102
+ src: url('/fonts/poppins-bold-webfont.woff2') format('woff2'),
103
+ url('/fonts/poppins-bold-webfont.woff') format('woff');
104
+ font-weight: 700;
105
+ font-style: normal;
106
+ }
107
+ @font-face {
108
+ font-family: 'Poppins';
109
+ src: url('/fonts/poppins-bolditalic-webfont.woff2') format('woff2'),
110
+ url('/fonts/poppins-bolditalic-webfont.woff') format('woff');
111
+ font-weight: normal;
112
+ font-style: italic;
113
+ }
114
+ @font-face {
115
+ font-family: 'Poppins';
116
+ src: url('/fonts/poppins-extrabold-webfont.woff2') format('woff2'),
117
+ url('/fonts/poppins-extrabold-webfont.woff') format('woff');
118
+ font-weight: 800;
119
+ font-style: normal;
120
+ }
121
+ @font-face {
122
+ font-family: 'Poppins';
123
+ src: url('/fonts/poppins-extrabolditalic-webfont.woff2') format('woff2'),
124
+ url('/fonts/poppins-extrabolditalic-webfont.woff') format('woff');
125
+ font-weight: 800;
126
+ font-style: italic;
127
+ }
128
+ @font-face {
129
+ font-family: 'Poppins';
130
+ src: url('/fonts/poppins-italic-webfont.woff2') format('woff2'),
131
+ url('/fonts/poppins-italic-webfont.woff') format('woff');
132
+ font-weight: 400;
133
+ font-style: italic;
134
+ }
135
+ @font-face {
136
+ font-family: 'Poppins';
137
+ src: url('/fonts/poppins-light-webfont.woff2') format('woff2'),
138
+ url('/fonts/poppins-light-webfont.woff') format('woff');
139
+ font-weight: 300;
140
+ font-style: normal;
141
+ }
142
+ @font-face {
143
+ font-family: 'Poppins';
144
+ src: url('/fonts/poppins-lightitalic-webfont.woff2') format('woff2'),
145
+ url('/fonts/poppins-lightitalic-webfont.woff') format('woff');
146
+ font-weight: 300;
147
+ font-style: italic;
148
+ }
149
+ @font-face {
150
+ font-family: 'Poppins';
151
+ src: url('/fonts/poppins-medium-webfont.woff2') format('woff2'),
152
+ url('/fonts/poppins-medium-webfont.woff') format('woff');
153
+ font-weight: 500;
154
+ font-style: normal;
155
+ }
156
+ @font-face {
157
+ font-family: 'Poppins';
158
+ src: url('/fonts/poppins-mediumitalic-webfont.woff2') format('woff2'),
159
+ url('/fonts/poppins-mediumitalic-webfont.woff') format('woff');
160
+ font-weight: 500;
161
+ font-style: italic;
162
+ }
163
+ @font-face {
164
+ font-family: 'Poppins';
165
+ src: url('/fonts/poppins-regular-webfont.woff2') format('woff2'),
166
+ url('/fonts/poppins-regular-webfont.woff') format('woff');
167
+ font-weight: 400;
168
+ font-style: normal;
169
+ }
170
+ @font-face {
171
+ font-family: 'Poppins';
172
+ src: url('/fonts/poppins-semibold-webfont.woff2') format('woff2'),
173
+ url('/fonts/poppins-semibold-webfont.woff') format('woff');
174
+ font-weight: 600;
175
+ font-style: normal;
176
+ }
177
+ @font-face {
178
+ font-family: 'Poppins';
179
+ src: url('/fonts/poppins-semibolditalic-webfont.woff2') format('woff2'),
180
+ url('/fonts/poppins-semibolditalic-webfont.woff') format('woff');
181
+ font-weight: 600;
182
+ font-style: italic;
183
+ }
184
+ @font-face {
185
+ font-family: 'DM Mono';
186
+ src: url('/fonts/dmmono-medium.woff2') format('woff2'),
187
+ url('/fonts/dmmono-medium.woff') format('woff');
188
+ font-style: normal;
189
+ font-weight: 500;
190
+ font-display: swap;
191
+ }
192
+ @font-face {
193
+ font-family: 'Bitter';
194
+ src: url('/fonts/bitter-regular.woff2') format('woff2'),
195
+ url('/fonts/bitter-regular.woff') format('woff');
196
+ font-style: normal;
197
+ font-weight: 400;
198
+ font-display: swap;
199
+ }
200
+ @font-face {
201
+ font-family: 'Bitter';
202
+ src: url('/fonts/bitter-medium.woff2') format('woff2'),
203
+ url('/fonts/bitter-medium.woff') format('woff');
204
+ font-style: normal;
205
+ font-weight: 500;
206
+ font-display: swap;
207
+ }
208
+ @font-face {
209
+ font-family: 'Bitter';
210
+ src: url('/fonts/bitter-mediumitalic.woff2') format('woff2'),
211
+ url('/fonts/bitter-mediumitalic.woff') format('woff');
212
+ font-style: italic;
213
+ font-weight: 500;
214
+ font-display: swap;
215
+ }
216
+ @font-face {
217
+ font-family: 'Bitter';
218
+ src: url('/fonts/bitter-semibold.woff2') format('woff2'),
219
+ url('/fonts/bitter-semibold.woff') format('woff');
220
+ font-style: normal;
221
+ font-weight: 600;
222
+ font-display: swap;
223
+ }
224
+
16
225
  html,
17
226
  body {
18
227
  padding: 0;
package/temp/header.tsx CHANGED
@@ -25,7 +25,7 @@ export const headerSize = 'sizing100'
25
25
 
26
26
  const StyledHeader = styled.div`
27
27
  ${getSizingCssFromTheme('height', headerSize)}
28
- ${getColorCssFromTheme('backgroundColor', 'neutral100')};
28
+ ${getColorCssFromTheme('backgroundColor', 'interfaceBrand010')};
29
29
  a,
30
30
  a:visited:not(:disabled) {
31
31
  ${getColorCssFromTheme('color', 'white')};
@@ -1,28 +0,0 @@
1
- import React from 'react'
2
- import { Grid, Cell } from 'newskit'
3
- import { LayoutProps } from './types'
4
- import { outerGridOverride } from './gridUtils'
5
- import { getBlock } from './Block'
6
-
7
- const Row: React.FC<LayoutProps> = ({ slice }) => (
8
- <Grid {...outerGridOverride} data-testid={`${slice.name}-Grid`}>
9
- {slice.children.map((block, i) => (
10
- <Cell
11
- xs={12}
12
- md={6}
13
- xl={3}
14
- key={
15
- ('article' in block && block.article.id) ||
16
- ('author' in block && block.author.id) ||
17
- ('accountId' in block && block.id) ||
18
- i
19
- }
20
- data-testid={`titleTeaserVertical-${i}`}
21
- >
22
- {getBlock(block, 'titleTeaserVertical')}
23
- </Cell>
24
- ))}
25
- </Grid>
26
- )
27
-
28
- export default Row
@@ -1,56 +0,0 @@
1
- import { renderWithTheme } from '../../../../helpers/test-utils'
2
- import { SectionRow } from '../SectionRow'
3
- import { getPageMock } from '../../../../helpers/mocks'
4
- import { ArticleSlice } from '../../../../helpers/global-types'
5
-
6
- describe('SectionRow', () => {
7
- test('SectionRow with title', () => {
8
- const { asFragment } = renderWithTheme(SectionRow, {
9
- slice: getPageMock.page.body[0].children[1] as ArticleSlice,
10
- sectionURL: getPageMock.page.body[0].link.url,
11
- collection: getPageMock.page.body[0],
12
- })
13
- expect(asFragment()).toMatchSnapshot()
14
- })
15
-
16
- test('SectionRow without title', () => {
17
- const { asFragment } = renderWithTheme(SectionRow, {
18
- slice: getPageMock.page.body[0].children[1] as ArticleSlice,
19
- sectionURL: getPageMock.page.body[0].link.url,
20
- collection: getPageMock.page.body[0],
21
- showTitle: false,
22
- })
23
- expect(asFragment()).toMatchSnapshot()
24
- })
25
-
26
- test('SectionRow isDarkBackground', () => {
27
- const { asFragment } = renderWithTheme(SectionRow, {
28
- slice: getPageMock.page.body[0].children[1] as ArticleSlice,
29
- sectionURL: getPageMock.page.body[0].link.url,
30
- collection: getPageMock.page.body[0],
31
- isDarkBackground: true,
32
- })
33
- expect(asFragment()).toMatchSnapshot()
34
- })
35
-
36
- test('SectionRow without extra space', () => {
37
- const { asFragment } = renderWithTheme(SectionRow, {
38
- slice: getPageMock.page.body[0].children[1] as ArticleSlice,
39
- sectionURL: getPageMock.page.body[0].link.url,
40
- collection: getPageMock.page.body[0],
41
- addTopSpace: true,
42
- })
43
- expect(asFragment()).toMatchSnapshot()
44
- })
45
-
46
- test('SectionRow alternative titlebar', () => {
47
- const { asFragment } = renderWithTheme(SectionRow, {
48
- slice: getPageMock.page.body[0].children[1] as ArticleSlice,
49
- sectionURL: getPageMock.page.body[0].link.url,
50
- collection: getPageMock.page.body[0],
51
- titleBarStylePreset: 'inkContrast',
52
- titleBarColour: 'transparent',
53
- })
54
- expect(asFragment()).toMatchSnapshot()
55
- })
56
- })