hypnagaga/packages/graphics-components/docs/assets/PymChild-BXN5mFOj.js

22 lines
1.8 KiB
JavaScript

import{j as e}from"./index-bIIEL2MP.js";import{useMDXComponents as r}from"./index-CO-0pc0F.js";import{M as i}from"./index-Z-6k0Xrj.js";import{P as s}from"./PymChild.stories-Dl4xYtZ5.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"./index-client-BAw8T8-V.js";import"./pym.v1-C8pfgSnW.js";function o(t){const n={a:"a",code:"code",h1:"h1",p:"p",pre:"pre",...r(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(i,{of:s}),`
`,e.jsx(n.h1,{id:"pymchild",children:"PymChild"}),`
`,e.jsxs(n.p,{children:["The ",e.jsx(n.code,{children:"PymChild"})," component creates a ",e.jsx(n.a,{href:"https://blog.apps.npr.org/pym.js/",rel:"nofollow",children:"Pym.js"})," child instance for embeddables."]}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-svelte",children:`<script>
import { PymChild } from '@reuters-graphics/graphics-components';
<\/script>
<PymChild polling={500} />
`})}),`
`,e.jsxs(n.p,{children:["You can access the Pym.js child via ",e.jsx(n.code,{children:"pym"})," in other components to send custom height updates to parent frames:"]}),`
`,e.jsx(n.pre,{children:e.jsx(n.code,{className:"language-svelte",children:`<script>
import { PymChild, pym } from '@reuters-graphics/graphics-components';
const updateHeight = () => {
if (pym.child) pym.child.sendHeight();
};
<\/script>
<PymChild />
<button onclick={updateHeight}>Update height</button>
`})})]})}function v(t={}){const{wrapper:n}={...r(),...t.components};return n?e.jsx(n,{...t,children:e.jsx(o,{...t})}):o(t)}export{v as default};