diff --git a/src/components/PymChild/PymChild.mdx b/src/components/PymChild/PymChild.mdx new file mode 100644 index 00000000..927d6bd3 --- /dev/null +++ b/src/components/PymChild/PymChild.mdx @@ -0,0 +1,36 @@ +import { Meta } from '@storybook/blocks'; + +import * as PymChildStories from './PymChild.stories.svelte'; + + + +# PymChild + +The `PymChild` component creates a [Pym.js](https://blog.apps.npr.org/pym.js/) child instance for embeddables. + +```svelte + + + +``` + +You can access the Pym.js child via `pymChildState` in other components to send custom height updates to parent frames: + +```svelte + + + + + +``` diff --git a/src/components/PymChild/PymChild.stories.svelte b/src/components/PymChild/PymChild.stories.svelte index 5119f692..36c1f1f3 100644 --- a/src/components/PymChild/PymChild.stories.svelte +++ b/src/components/PymChild/PymChild.stories.svelte @@ -1,27 +1,11 @@ - - - - - + diff --git a/src/components/PymChild/PymChild.svelte b/src/components/PymChild/PymChild.svelte index c60f870c..f7cb9831 100644 --- a/src/components/PymChild/PymChild.svelte +++ b/src/components/PymChild/PymChild.svelte @@ -1,8 +1,9 @@ diff --git a/src/components/PymChild/state.svelte.ts b/src/components/PymChild/state.svelte.ts new file mode 100644 index 00000000..3dfee824 --- /dev/null +++ b/src/components/PymChild/state.svelte.ts @@ -0,0 +1,5 @@ +import pym from 'pym.js'; + +type PymChildState = { pymChild: pym.Child | null }; + +export const pymChildState: PymChildState = $state({ pymChild: null }); diff --git a/src/components/PymChild/stores.js b/src/components/PymChild/stores.js deleted file mode 100644 index 690e8453..00000000 --- a/src/components/PymChild/stores.js +++ /dev/null @@ -1,3 +0,0 @@ -import { writable } from 'svelte/store'; - -export const pymChildStore = writable(null); diff --git a/src/components/PymChild/stories/docs/component.md b/src/components/PymChild/stories/docs/component.md deleted file mode 100644 index ac261b84..00000000 --- a/src/components/PymChild/stories/docs/component.md +++ /dev/null @@ -1,28 +0,0 @@ -A Pym.js child instance for embeddables. - -```svelte - - - -``` - -You can access the Pym.js child through its store in other components to send custom height updates to parent frames: - -```svelte - - - - - -```