@newskit-render/core 1.49.2 → 1.59.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/CHANGELOG.md +195 -0
- package/__tests__/pages/[articleSlug].test.tsx +12 -8
- package/__tests__/pages/__snapshots__/brightcove.test.tsx.snap +20 -0
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +241 -1846
- package/__tests__/pages/brightcove.test.tsx +34 -0
- package/__tests__/pages/home.test.tsx +22 -12
- package/__tests__/pages/mocks.ts +29 -0
- package/__tests__/pages/relatedArticles.test.tsx +76 -0
- package/components/article/RelatedArticles.tsx +48 -55
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +414 -3366
- package/components/article/__tests__/index.test.tsx +46 -2
- package/components/article/index.tsx +28 -15
- package/components/common/BackToHomepage.tsx +36 -0
- package/components/footer/__snapshots__/index.test.tsx.snap +37 -271
- package/components/header/index.tsx +7 -0
- package/components/section/index.tsx +2 -0
- package/components/section/layouts/Rows.tsx +36 -17
- package/components/section/layouts/__tests__/Rows.test.tsx +12 -0
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +36 -530
- package/components/section/layouts/__tests__/__snapshots__/SectionTitle.test.tsx.snap +42 -766
- package/components/section/layouts/types.ts +3 -0
- package/config/index.ts +85 -0
- package/constants/index.ts +3 -1
- package/cypress/e2e/account/accessibility.spec.js +14 -17
- package/cypress/e2e/account/account-subscription.spec.js +9 -8
- package/cypress/e2e/account/payment-failer.spec.js +3 -3
- package/cypress/support/commands.js +2 -2
- package/helpers/__tests__/getUser.test.ts +7 -8
- package/helpers/logger.ts +3 -1
- package/helpers/mocks/articleMock.ts +1 -1
- package/helpers/mocks/getUniversalArticleMock.ts +13 -0
- package/helpers/setupTests.ts +4 -0
- package/infrastructure/.circleci/config.yml +1 -0
- package/jest.config.js +22 -19
- package/package.json +11 -11
- package/pages/[section]/[articleId]/[articleSlug].tsx +9 -4
- package/pages/[section]/[articleId]/relatedArticles.tsx +85 -0
- package/pages/_app.tsx +4 -3
- package/pages/_document.tsx +17 -18
- package/pages/api/auth/[...nextauth].ts +2 -3
- package/pages/api/feed.ts +7 -3
- package/pages/api/news-sitemap.ts +4 -6
- package/pages/api/sitemap.ts +10 -7
- package/pages/help-hub/[id]/index.tsx +11 -0
- package/pages/help-hub/index.tsx +11 -0
- package/pages/index.tsx +1 -1
- package/pages/player/brightcove.tsx +19 -0
- package/pages/preview/[articleId]/version/[versionId]/index.tsx +9 -4
- package/public/icon.png +0 -0
- package/queries/getRadioPosts.ts +1 -1
- package/queries/getUniversalArticle.ts +13 -0
- package/temp/header.tsx +7 -0
|
@@ -1,30 +1,49 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Block, GridLayout } from 'newskit'
|
|
3
|
+
import { ArticleRecommendation } from '@newskit-render/standalone-components'
|
|
3
4
|
import { LayoutProps } from './types'
|
|
4
5
|
import { outerGridOverride } from './gridUtils'
|
|
5
6
|
import { getBlock } from './Block'
|
|
6
7
|
|
|
7
8
|
export const BasicRow: React.FC<LayoutProps> = ({
|
|
8
9
|
slice,
|
|
10
|
+
articles,
|
|
9
11
|
colums,
|
|
10
12
|
variant = 'titleTeaserVertical',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
'data-testid': testid,
|
|
14
|
+
}) => {
|
|
15
|
+
const dataTestid =
|
|
16
|
+
(testid && testid) || (slice && `${slice.name}-Grid`) || 'Articles-Grid'
|
|
17
|
+
return (
|
|
18
|
+
<GridLayout
|
|
19
|
+
columns={colums}
|
|
20
|
+
columnGap="space050"
|
|
21
|
+
data-testid={dataTestid}
|
|
22
|
+
{...outerGridOverride}
|
|
23
|
+
>
|
|
24
|
+
{articles
|
|
25
|
+
? articles.map((article, i) => (
|
|
26
|
+
/* eslint-disable-next-line */
|
|
27
|
+
<Block
|
|
28
|
+
spaceStack="space050"
|
|
29
|
+
key={article.title}
|
|
30
|
+
data-testid={`articleRec-${i}`}
|
|
31
|
+
>
|
|
32
|
+
<ArticleRecommendation article={article} size="large" />
|
|
33
|
+
</Block>
|
|
34
|
+
))
|
|
35
|
+
: slice.children.map((block, i) => (
|
|
36
|
+
/* eslint-disable-next-line */
|
|
37
|
+
<Block
|
|
38
|
+
key={'article' in block ? block.article.id : i}
|
|
39
|
+
data-testid={`titleTeaserVertical-${i}`}
|
|
40
|
+
>
|
|
41
|
+
{getBlock(block, variant)}
|
|
42
|
+
</Block>
|
|
43
|
+
))}
|
|
44
|
+
</GridLayout>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
28
47
|
|
|
29
48
|
export const Row3: React.FC<LayoutProps> = ({ slice }) => (
|
|
30
49
|
<GridLayout
|
|
@@ -2,6 +2,7 @@ import { renderWithTheme } from '../../../../helpers/test-utils'
|
|
|
2
2
|
import { BasicRow, Row3 } from '../Rows'
|
|
3
3
|
import { getPageMock } from '../../../../helpers/mocks'
|
|
4
4
|
import { ArticleSlice } from '../../../../helpers/global-types'
|
|
5
|
+
import { relatedArticles } from '../../../../helpers/mocks/articleMock'
|
|
5
6
|
|
|
6
7
|
describe('Rows', () => {
|
|
7
8
|
test('should render a row with 2 columns', () => {
|
|
@@ -25,4 +26,15 @@ describe('Rows', () => {
|
|
|
25
26
|
|
|
26
27
|
expect(getAllByTestId(/titleTeaserVertical-/).length).toEqual(3)
|
|
27
28
|
})
|
|
29
|
+
|
|
30
|
+
describe('Recommended articles', () => {
|
|
31
|
+
test('should render with recommended articles', () => {
|
|
32
|
+
const { getAllByTestId } = renderWithTheme(BasicRow, {
|
|
33
|
+
articles: relatedArticles,
|
|
34
|
+
colums: { xs: '1fr', md: '1fr 1fr', lg: '1fr 1fr 1fr' },
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
expect(getAllByTestId(/articleRec-/).length).toEqual(4)
|
|
38
|
+
})
|
|
39
|
+
})
|
|
28
40
|
})
|