refactored the FeaturePhoto component as well

This commit is contained in:
deaxmachina 2025-01-16 13:01:02 +00:00
parent bf10a61f9d
commit b6c135f4d7
Failed to extract signature
4 changed files with 41 additions and 65 deletions

View file

@ -1,38 +1,20 @@
<script module lang="ts"> <script module lang="ts">
import { defineMeta } from '@storybook/addon-svelte-csf';
import DatawrapperChart from './DatawrapperChart.svelte'; import DatawrapperChart from './DatawrapperChart.svelte';
// @ts-ignore raw
import componentDocs from './stories/docs/component.md?raw';
// @ts-ignore raw
import withChatterDocs from './stories/docs/withChatter.md?raw';
import { const { Story } = defineMeta({
withComponentDocs,
withStoryDocs,
} from '$lib/docs/utils/withParams.js';
export const meta = {
title: 'Components/Graphics/DatawrapperChart', title: 'Components/Graphics/DatawrapperChart',
component: DatawrapperChart, component: DatawrapperChart,
...withComponentDocs(componentDocs), tags: ['autodocs'],
argTypes: { argTypes: {
width: { width: {
control: 'select', control: 'select',
options: ['normal', 'wide', 'wider', 'widest', 'fluid'], options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
}, },
}, },
}; });
</script> </script>
<script>
import { Template, Story } from '@storybook/addon-svelte-csf';
</script>
<Template >
{#snippet children({ args })}
<DatawrapperChart {...args} />
{/snippet}
</Template>
<Story <Story
name="Default" name="Default"
args="{{ args="{{
@ -43,14 +25,16 @@
}}" }}"
/> />
<Story name="With chatter" {...withStoryDocs(withChatterDocs)}> <Story
<DatawrapperChart name="With chatter"
frameTitle="Global abortion access" args="{{
ariaLabel="map" frameTitle: 'Global abortion access',
id="abortion-rights-map" ariaLabel: 'map',
src="https://reuters.com/graphics/USA-ABORTION/lgvdwemlbpo/media-embed.html" id: 'abortion-rights-map',
title="Global abortion access" src: 'https://reuters.com/graphics/USA-ABORTION/lgvdwemlbpo/media-embed.html',
description="A map of worldwide access to abortion." title: 'Global abortion access',
notes="{'Note: Different indicators and additional restrictions, including different gestational limits, apply in some countries. Refer to source for full classification. Current as of May 4, 2022.\n\nSource: Center for Reproductive Rights'}" description: 'A map of worldwide access to abortion.',
/> notes:
</Story> 'Note: Different indicators and additional restrictions, including different gestational limits, apply in some countries. Refer to source for full classification. Current as of May 4, 2022.\n\nSource: Center for Reproductive Rights',
}}"
/>

View file

@ -1,4 +1,6 @@
<script module lang="ts"> <script module lang="ts">
import { defineMeta } from '@storybook/addon-svelte-csf';
// @ts-ignore raw // @ts-ignore raw
import componentDocs from './stories/docs/component.md?raw'; import componentDocs from './stories/docs/component.md?raw';
// @ts-ignore raw // @ts-ignore raw
@ -8,15 +10,17 @@
import FeaturePhoto from './FeaturePhoto.svelte'; import FeaturePhoto from './FeaturePhoto.svelte';
import { // import {
withComponentDocs, // withComponentDocs,
withStoryDocs, // withStoryDocs,
} from '$lib/docs/utils/withParams.js'; // } from '$lib/docs/utils/withParams.js';
export const meta = {
const { Story } = defineMeta({
title: 'Components/Multimedia/FeaturePhoto', title: 'Components/Multimedia/FeaturePhoto',
component: FeaturePhoto, component: FeaturePhoto,
...withComponentDocs(componentDocs), // ...withComponentDocs(componentDocs),
tags: ['autodocs'],
argTypes: { argTypes: {
width: { width: {
control: 'select', control: 'select',
@ -27,21 +31,14 @@
options: ['normal', 'wide', 'wider', 'widest', 'fluid'], options: ['normal', 'wide', 'wider', 'widest', 'fluid'],
}, },
}, },
}; });
</script> </script>
<script> <script>
import { Template, Story } from '@storybook/addon-svelte-csf';
// @ts-ignore jpg // @ts-ignore jpg
import sharkSrc from './stories/shark.jpg'; import sharkSrc from './stories/shark.jpg';
</script> </script>
<Template >
{#snippet children({ args })}
<FeaturePhoto {...args} />
{/snippet}
</Template>
<Story <Story
name="Default" name="Default"
@ -61,8 +58,8 @@
width: 'normal', width: 'normal',
caption: 'Carcharodon carcharias - REUTERS', caption: 'Carcharodon carcharias - REUTERS',
}}" }}"
{...withStoryDocs(archieMLDocs)}
/> />
<!-- {...withStoryDocs(archieMLDocs)} -->
<Story <Story
name="Missing altText" name="Missing altText"
@ -71,5 +68,5 @@
width: 'normal', width: 'normal',
caption: 'Carcharodon carcharias - REUTERS', caption: 'Carcharodon carcharias - REUTERS',
}}" }}"
{...withStoryDocs(missingAltTextDocs)}
/> />
<!-- {...withStoryDocs(missingAltTextDocs)} -->

View file

@ -1,28 +1,23 @@
<!-- @component `Spinner` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-utilities-spinner--docs) --> <!-- @component `Spinner` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-utilities-spinner--docs) -->
<script lang="ts"> <script lang="ts">
interface Props { interface Props {
/** Primary colour of the spinner. */ /** Primary colour of the spinner. */
colour?: string; colour?: string;
/** /**
* Outer width of the spinner * Outer width of the spinner
*/ */
width?: number; width?: number;
/** /**
* Width of the spinner ring * Width of the spinner ring
*/ */
ringWidth?: number; ringWidth?: number;
/** /**
* How fast the spinner spins in seconds * How fast the spinner spins in seconds
*/ */
speed?: number; speed?: number;
/** /**
* Vertical padding for the spinner's container * Vertical padding for the spinner's container
*/ */
containerPadding?: number; containerPadding?: number;
} }
@ -31,7 +26,7 @@
width = 40, width = 40,
ringWidth = 6, ringWidth = 6,
speed = 0.8, speed = 0.8,
containerPadding = 10 containerPadding = 10,
}: Props = $props(); }: Props = $props();
</script> </script>

View file

@ -13,10 +13,10 @@ export { default as BeforeAfter } from './components/BeforeAfter/BeforeAfter.sve
export { default as Block } from './components/Block/Block.svelte'; export { default as Block } from './components/Block/Block.svelte';
export { default as BodyText } from './components/BodyText/BodyText.svelte'; export { default as BodyText } from './components/BodyText/BodyText.svelte';
export { default as Byline } from './components/Byline/Byline.svelte'; export { default as Byline } from './components/Byline/Byline.svelte';
export { default as DatawrapperChart } from './components/DatawrapperChart/DatawrapperChart.svelte'; // export { default as DatawrapperChart } from './components/DatawrapperChart/DatawrapperChart.svelte';
export { default as DocumentCloud } from './components/DocumentCloud/DocumentCloud.svelte'; export { default as DocumentCloud } from './components/DocumentCloud/DocumentCloud.svelte';
export { default as EmbedPreviewerLink } from './components/EmbedPreviewerLink/EmbedPreviewerLink.svelte'; export { default as EmbedPreviewerLink } from './components/EmbedPreviewerLink/EmbedPreviewerLink.svelte';
export { default as FeaturePhoto } from './components/FeaturePhoto/FeaturePhoto.svelte'; // export { default as FeaturePhoto } from './components/FeaturePhoto/FeaturePhoto.svelte';
export { default as Framer } from './components/Framer/Framer.svelte'; export { default as Framer } from './components/Framer/Framer.svelte';
export { default as GraphicBlock } from './components/GraphicBlock/GraphicBlock.svelte'; export { default as GraphicBlock } from './components/GraphicBlock/GraphicBlock.svelte';
export { default as Headline } from './components/Headline/Headline.svelte'; export { default as Headline } from './components/Headline/Headline.svelte';