hypnagaga/packages/graphics-components/docs/assets/Byline-CKwG9hDU.js

83 lines
4.3 KiB
JavaScript

import{j as e}from"./index-bIIEL2MP.js";import{useMDXComponents as a}from"./index-CO-0pc0F.js";import{M as o,C as s}from"./index-Z-6k0Xrj.js";import{B as r,D as p,C as l,a as c}from"./Byline.stories-CX-euSiO.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./iframe-CzjIX-qr.js";import"./index-aQYXhgXp.js";import"./index-DrFu-skq.js";import"./props-b4vEeO_8.js";import"./runtime-C3rQLW--.js";import"./lifecycle-F2p_Qkk3.js";import"./create-runtime-stories-7AWWVphH.js";import"./snippet-C5kbqVpq.js";import"./svelte-component-C8Ginrj8.js";import"./get-C3XmtPLd.js";import"./Byline-BhU2Zjcl.js";import"./each-CVpBMMjG.js";import"./attributes-Cg6aLqN3.js";import"./style-DvJ3IcV1.js";import"./index-CX1x869l.js";import"./Block-D3Ui8rd-.js";import"./journalize-K6hK94UL.js";function i(t){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...a(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(o,{of:r}),`
`,e.jsx(n.h1,{id:"byline",children:"Byline"}),`
`,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"Byline"})," component adds a byline, published and updated datelines to your page."]}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-svelte",children:`<script>
import { Byline } from '@reuters-graphics/graphics-components';
<\/script>
<Byline
authors={[
'Dea Bankova',
'Prasanta Kumar Dutta',
'Anurag Rao',
'Mariano Zafra',
]}
publishTime="2021-09-12T00:00:00.000Z"
updateTime="2021-09-12T12:57:00.000Z"
/>
`})}),`
`,e.jsx(n.h2,{id:"using-with-archieml-docs",children:"Using with ArchieML docs"}),`
`,e.jsx(n.p,{children:"With the graphics kit, you'll likely get your text value from an ArchieML doc..."}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-yaml",children:`# ArchieML doc
[authors]
* Dea Bankova
* Prasanta Kumar Dutta
* Anurag Rao
* Mariano Zafra
[]
publishTime: 2021-09-12T00:00:00.000Z
updateTime: 2021-09-12T12:57:00.000Z
`})}),`
`,e.jsxs(n.p,{children:["... which you'll pass to the ",e.jsx(n.code,{children:"Byline"})," component."]}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-svelte",children:`<script>
import { Byline } from '@reuters-graphics/graphics-components';
import content from '$locales/en/content.json';
<\/script>
<Byline
authors={content.authors}
publishTime={content.publishTime}
updateTime={content.updateTime}
/>
`})}),`
`,e.jsx(s,{of:p}),`
`,e.jsx(n.h2,{id:"custom-byline-published-and-updated-datelines",children:"Custom byline, published and updated datelines"}),`
`,e.jsxs(n.p,{children:["Use ",e.jsx(n.a,{href:"https://svelte.dev/docs/svelte/snippet",rel:"nofollow",children:"snippets"})," to customise the byline, published and updated datelines."]}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-svelte",children:`<Byline publishTime="2021-09-12T00:00:00Z" updateTime="2021-09-12T13:57:00Z">
<!-- Optional custom byline -->
{#snippet byline()}
<strong>BY REUTERS GRAPHICS</strong>
{/snippet}
<!-- Optional custom published dateline -->
{#snippet published()}
PUBLISHED on some custom date and time
{/snippet}
<!-- Optional custom updated dateline -->
{#snippet updated()}
<em>Updated every 5 minutes</em>
{/snippet}
</Byline>
`})}),`
`,e.jsx(s,{of:l}),`
`,e.jsx(n.h2,{id:"custom-author-page",children:"Custom author page"}),`
`,e.jsxs(n.p,{children:["By default, the ",e.jsx(n.code,{children:"Byline"})," component will hyperlink each author's byline to their Reuters.com page, formatted ",e.jsx(n.code,{children:"https://www.reuters.com/authors/{author-slug}/"}),"."]}),`
`,e.jsxs(n.p,{children:["To hyperlink to different pages or email addresses, pass a custom function to the ",e.jsx(n.code,{children:"getAuthorPage"})," prop."]}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-svelte",children:`<!-- Pass a custom function as \`getAuthorPage\` -->
<Byline
authors={[
'Dea Bankova',
'Prasanta Kumar Dutta',
'Anurag Rao',
'Mariano Zafra',
]}
publishTime="2021-09-12T00:00:00Z"
updateTime="2021-09-12T13:57:00Z"
getAuthorPage={(author) => {
return \`mailto:\${author.replace(' ', '')}@example.com\`;
}}
/>
`})}),`
`,e.jsx(s,{of:c}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{})})]})}function L(t={}){const{wrapper:n}={...a(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(i,{...t})}):i(t)}export{L as default};