@times-components/ts-components 1.78.1-alpha.52 → 1.79.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.
@@ -24,7 +24,7 @@ storiesOf('Typescript Component/Article Header', module).add(
24
24
  const props = getAttributes();
25
25
  return (
26
26
  <ArticleBylineBlock
27
- data={{
27
+ authorData={{
28
28
  slug: 'oliver-wright',
29
29
  name: props.name,
30
30
  jobTitle: props.jobTitle,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ArticleByline } from '../../types/related-article-slice';
2
+ import { ArticleBylineAuthorData } from '../../types/related-article-slice';
3
3
  import {
4
4
  BylineBlockContainer,
5
5
  BylineBlockImgContainer,
@@ -8,42 +8,43 @@ import {
8
8
  BylineBlockAuthorContent,
9
9
  BylineBlockAuthorName,
10
10
  BylineBlockAuthorJobTitle,
11
- BylineBlockAuthorDescription
11
+ BylineBlockDescription
12
12
  } from './styles';
13
13
 
14
14
  export const ArticleBylineBlock: React.FC<{
15
- data?: ArticleByline;
15
+ authorData?: ArticleBylineAuthorData;
16
16
  description?: string;
17
- }> = ({ data, description }) => {
18
- if (!((data && data.name) || (data && data.image)) && !description) {
17
+ }> = ({ authorData, description }) => {
18
+ if (
19
+ !((authorData && authorData.name) || (authorData && authorData.image)) &&
20
+ !description
21
+ ) {
19
22
  return null;
20
23
  }
21
24
 
22
25
  return (
23
26
  <BylineBlockContainer>
24
- {data &&
25
- data.image && (
27
+ {authorData &&
28
+ authorData.image && (
26
29
  <BylineBlockImgContainer>
27
- <BylineBlockImg src={data.image} alt={data.name} />
30
+ <BylineBlockImg src={authorData.image} alt={authorData.name} />
28
31
  </BylineBlockImgContainer>
29
32
  )}
30
33
  <BylineBlockContent>
31
34
  <BylineBlockAuthorContent>
32
- {data &&
33
- data.name && (
34
- <BylineBlockAuthorName>{data.name}</BylineBlockAuthorName>
35
+ {authorData &&
36
+ authorData.name && (
37
+ <BylineBlockAuthorName>{authorData.name}</BylineBlockAuthorName>
35
38
  )}
36
- {data &&
37
- data.jobTitle && (
39
+ {authorData &&
40
+ authorData.jobTitle && (
38
41
  <BylineBlockAuthorJobTitle>
39
- {data.jobTitle}
42
+ {authorData.jobTitle}
40
43
  </BylineBlockAuthorJobTitle>
41
44
  )}
42
45
  </BylineBlockAuthorContent>
43
46
  {description && (
44
- <BylineBlockAuthorDescription>
45
- {description}
46
- </BylineBlockAuthorDescription>
47
+ <BylineBlockDescription>{description}</BylineBlockDescription>
47
48
  )}
48
49
  </BylineBlockContent>
49
50
  </BylineBlockContainer>
@@ -21,7 +21,7 @@ import {
21
21
  UpdatesContainer,
22
22
  FlagContainer
23
23
  } from './styles';
24
- import { ArticleByline } from '../../types/related-article-slice';
24
+ import { ArticleBylineAuthorData } from '../../types/related-article-slice';
25
25
  import { ArticleBylineBlock } from './ArticleBylineBlock';
26
26
 
27
27
  const anchorString = (updateTxt = '', headlineTxt = '') => {
@@ -41,7 +41,7 @@ const ArticleHeader: React.FC<{
41
41
  description?: string;
42
42
  }> = ({ updated, breaking, headline, authorSlug, description }) => {
43
43
  const [timezone, setTimezone] = useState<string>('');
44
- const [bylineData, setBylineData] = useState<ArticleByline>();
44
+ const [authorData, setAuthorData] = useState<ArticleBylineAuthorData>();
45
45
 
46
46
  const currentDateTime = new Date();
47
47
  const updatedDate = new Date(updated);
@@ -63,7 +63,7 @@ const ArticleHeader: React.FC<{
63
63
  try {
64
64
  const response = await fetch(`/api/author-profile/${authorSlug}`);
65
65
  const authorDetails = await response.json();
66
- setBylineData(authorDetails);
66
+ setAuthorData(authorDetails);
67
67
  } catch (err) {
68
68
  // tslint:disable-next-line:no-console
69
69
  console.log(err);
@@ -125,7 +125,7 @@ const ArticleHeader: React.FC<{
125
125
  </UpdatesContainer>
126
126
 
127
127
  {headline && <Headline>{safeDecodeURIComponent(headline)}</Headline>}
128
- <ArticleBylineBlock data={bylineData} description={description} />
128
+ <ArticleBylineBlock authorData={authorData} description={description} />
129
129
  </Container>
130
130
  );
131
131
  };
@@ -16,7 +16,7 @@ describe('Article byline block', () => {
16
16
 
17
17
  it('Displays description', () => {
18
18
  const { getByText } = render(
19
- <ArticleBylineBlock data={undefined} description={description} />
19
+ <ArticleBylineBlock authorData={undefined} description={description} />
20
20
  );
21
21
 
22
22
  expect(getByText(description)).toBeVisible();
@@ -31,7 +31,7 @@ describe('Article byline block', () => {
31
31
 
32
32
  it('Displays author details and description', () => {
33
33
  const { getByText, getByRole } = render(
34
- <ArticleBylineBlock data={data} description={description} />
34
+ <ArticleBylineBlock authorData={data} description={description} />
35
35
  );
36
36
  expect(getByText(data.name)).toBeVisible();
37
37
  expect(getByText(data.jobTitle)).toBeVisible();
@@ -133,7 +133,7 @@ export const BylineBlockAuthorJobTitle = styled.p`
133
133
  margin-block: 0;
134
134
  `;
135
135
 
136
- export const BylineBlockAuthorDescription = styled.p`
136
+ export const BylineBlockDescription = styled.p`
137
137
  color: #696969;
138
138
  font-weight: 500;
139
139
  margin-block: 0;
@@ -18,7 +18,7 @@ type Byline = {
18
18
 
19
19
  type Bylines = Array<{ byline: Byline[]; image?: any }>;
20
20
 
21
- export type ArticleByline = {
21
+ export type ArticleBylineAuthorData = {
22
22
  slug: string;
23
23
  name?: string;
24
24
  jobTitle?: string;