diff --git a/src/components/Headline/Headline.stories.svelte b/src/components/Headline/Headline.stories.svelte index d0c09215..fc9d8aaa 100644 --- a/src/components/Headline/Headline.stories.svelte +++ b/src/components/Headline/Headline.stories.svelte @@ -44,6 +44,7 @@ section: 'World News', hed: 'Reuters Graphics interactive', hedSize: 'normal', + authors: ['Dea Bankova', 'Aditi Bhandari'], }}" /> @@ -52,16 +53,9 @@ hed="{'Reuters Graphics Interactive'}" dek="{'The beginning of a beautiful page'}" section="{'Global news'}" - > - - By Peppa Pig - - Published - + authors="{['Dea Bankova', 'Aditi Bhandari']}" + publishTime="{new Date('2020-01-01').toISOString()}" + /> @@ -79,16 +73,16 @@ - + Illustration of Europe

Europa

- Published + > -->
diff --git a/src/components/Headline/Headline.svelte b/src/components/Headline/Headline.svelte index 8628af00..e27073ad 100644 --- a/src/components/Headline/Headline.svelte +++ b/src/components/Headline/Headline.svelte @@ -24,8 +24,23 @@ * @type {string} */ export let section: string | null = null; + /** + * Array of author names, which will be slugified to create links to Reuters author pages + */ + export let authors: string[] = []; + /** + * Publish time as a datetime string. + * @type {string} + */ + export let publishTime: string = ''; + /** + * Update time as a datetime string. + * @type {string} + */ + export let updateTime: string = ''; import Block from '../Block/Block.svelte'; + import Byline from '../Byline/Byline.svelte'; import { marked } from 'marked'; let hedClass; @@ -57,7 +72,7 @@ {/if} -
+
{#if section}

{section}

{/if} @@ -74,31 +89,16 @@ {@html marked(dek)} {/if}
- {#if $$slots.byline || $$slots.dateline} - + {#if $$slots.byline} + + + {:else if authors.length > 0 || publishTime} + {/if} diff --git a/src/components/SiteHeadline/SiteHeadline.svelte b/src/components/SiteHeadline/SiteHeadline.svelte index 0e4a3252..ad8afde3 100644 --- a/src/components/SiteHeadline/SiteHeadline.svelte +++ b/src/components/SiteHeadline/SiteHeadline.svelte @@ -53,26 +53,7 @@ export { cls as class }; import Block from '../Block/Block.svelte'; - import slugify from 'slugify'; - import { apdate } from 'journalize'; - - const isValidDate = (datetime) => { - if (!datetime) return false; - if (!Date.parse(datetime)) return false; - return true; - }; - - const formatTime = (datetime) => - new Date(datetime).toLocaleTimeString([], { - hour: '2-digit', - minute: '2-digit', - timeZoneName: 'short', - }); - - const areSameDay = (first, second) => - first.getFullYear() === second.getFullYear() && - first.getMonth() === second.getMonth() && - first.getDate() === second.getDate(); + import Byline from '../Byline/Byline.svelte'; let hedClass; $: { @@ -113,93 +94,20 @@ {/if}
- +