migrated stories, mdx
This commit is contained in:
parent
8402b1fdbe
commit
929dca2fd8
3 changed files with 24 additions and 28 deletions
|
|
@ -1,4 +1,12 @@
|
||||||
A simple, clean text timeline.
|
import { Meta, Canvas } from '@storybook/blocks';
|
||||||
|
|
||||||
|
import * as SimpleTimelineStories from './SimpleTimeline.stories.svelte';
|
||||||
|
|
||||||
|
<Meta of={SimpleTimelineStories} />
|
||||||
|
|
||||||
|
# SimpleTimeline
|
||||||
|
|
||||||
|
The `SimpleTimeline` component creates a basic timeline with dates, titles and descriptions of events.
|
||||||
|
|
||||||
```svelte
|
```svelte
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -20,5 +28,7 @@ A simple, clean text timeline.
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<SimpleTimeline dates="{dates}" />
|
<SimpleTimeline {dates} />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<Canvas of={SimpleTimelineStories.Demo} />
|
||||||
|
|
@ -1,25 +1,18 @@
|
||||||
<script module lang="ts">
|
<script module lang="ts">
|
||||||
// @ts-ignore raw
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
||||||
import componentDocs from './stories/docs/component.md?raw';
|
|
||||||
|
|
||||||
import SimpleTimeline from './SimpleTimeline.svelte';
|
import SimpleTimeline from './SimpleTimeline.svelte';
|
||||||
|
|
||||||
import { withComponentDocs } from '$lib/docs/utils/withParams.js';
|
const { Story } = defineMeta({
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
title: 'Components/Text elements/SimpleTimeline',
|
title: 'Components/Text elements/SimpleTimeline',
|
||||||
component: SimpleTimeline,
|
component: SimpleTimeline,
|
||||||
...withComponentDocs(componentDocs),
|
|
||||||
argTypes: {
|
argTypes: {
|
||||||
symbolColour: { control: 'color' },
|
symbolColour: { control: 'color' },
|
||||||
dateColour: { control: 'color' },
|
dateColour: { control: 'color' },
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { Template, Story } from '@storybook/addon-svelte-csf';
|
|
||||||
|
|
||||||
const dates = [
|
const dates = [
|
||||||
{
|
{
|
||||||
date: 'May 18',
|
date: 'May 18',
|
||||||
|
|
@ -96,15 +89,9 @@
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Template >
|
|
||||||
{#snippet children({ args })}
|
|
||||||
<SimpleTimeline {...args} />
|
|
||||||
{/snippet}
|
|
||||||
</Template>
|
|
||||||
|
|
||||||
<Story
|
<Story
|
||||||
name="Default"
|
name="Demo"
|
||||||
args="{{
|
args={{
|
||||||
dates,
|
dates,
|
||||||
}}"
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
<!-- @migration-task Error while migrating Svelte code: Cannot set properties of undefined (setting 'next') -->
|
|
||||||
<!-- @component `SimpleTimeline` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-text-elements-simpletimeline--docs) -->
|
<!-- @component `SimpleTimeline` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-text-elements-simpletimeline--docs) -->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
interface Event {
|
interface Event {
|
||||||
|
|
@ -52,24 +51,24 @@
|
||||||
cx="10"
|
cx="10"
|
||||||
cy="12"
|
cy="12"
|
||||||
r="5"
|
r="5"
|
||||||
stroke="{symbolColour}"
|
stroke={symbolColour}
|
||||||
stroke-width="2"
|
stroke-width="2"
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
></circle>
|
></circle>
|
||||||
</svg>
|
</svg>
|
||||||
<div
|
<div
|
||||||
class="timeline-date font-note text-xs uppercase font-black tracking-wide fmb-0"
|
class="timeline-date font-note text-xs uppercase font-black tracking-wide fmb-0"
|
||||||
style:color="{dateColour}"
|
style:color={dateColour}
|
||||||
>
|
>
|
||||||
{date.date}
|
{date.date}
|
||||||
</div>
|
</div>
|
||||||
{#each date.events as event}
|
{#each date.events as event}
|
||||||
<div class="event pb-2">
|
<div class="event pb-2">
|
||||||
{#if event.titleLink}
|
{#if event.titleLink}
|
||||||
<a href="{event.titleLink}" target="_blank">
|
<a href={event.titleLink} target="_blank">
|
||||||
<div class="title h3">
|
<div class="title h3">
|
||||||
{event.title}
|
{event.title}
|
||||||
<span class="text-sm"><Fa fw icon="{faLink}" /></span>
|
<span class="text-sm"><Fa fw icon={faLink} /></span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
@ -78,7 +77,7 @@
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if event.context}
|
{#if event.context}
|
||||||
<Markdown source="{event.context}" />
|
<Markdown source={event.context} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue