Skip to content

Commit

Permalink
docs: add promise card histoire story (#145)
Browse files Browse the repository at this point in the history
* docs: add story for Prom
iseCard

* fix: fix latestProgressDate state in PromiseCard story
  • Loading branch information
badgooooor authored Oct 22, 2024
1 parent 973285d commit 2a09b48
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/components/PromiseList/PromiseCard.story.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<script lang="ts">
import type { Hst } from '@histoire/plugin-svelte';
import PromiseCard from './PromiseCard.svelte';
import { PromiseStatus, type PromiseSummary } from '$models/promise';
export let Hst: Hst;
let statements = [
'1 กีฬา 1 รัฐวิสาหกิจพลัส (OSOS) จับคู่รัฐวิสาหกิจที่มีกำไรและหน่วยงานรัฐ-เอกชนมาสนับสนุนสมาคมกีฬา'
];
let party = {
name: 'เพื่อไทย',
color: '#F41724',
logo: '/images/parties/เพื่อไทย.webp'
};
let keywords = ['Soft Power', 'THACCA', 'กีฬา'];
let categories = ['วัฒนธรรม'];
let dateString = '2024-10-24T00:00:00.000Z';
let status = PromiseStatus.fulfilled;
let statusOptions = [
{ label: 'notStarted', value: PromiseStatus.notStarted },
{ label: 'inProgress', value: PromiseStatus.inProgress },
{ label: 'clarifying', value: PromiseStatus.clarifying },
{ label: 'fulfilled', value: PromiseStatus.fulfilled },
{ label: 'unhonored', value: PromiseStatus.unhonored }
];
$: promiseSummary = {
id: 'PST-33',
status,
statements,
keywords,
categories,
party,
latestProgressDate: new Date(dateString)
};
</script>

<Hst.Story title="PromiseCard">
<Hst.Variant title="PromiseCard.notList">
<PromiseCard {promiseSummary} isList={false} />
</Hst.Variant>
<Hst.Variant title="PromiseCard.isList">
<PromiseCard {promiseSummary} isList={true} />
</Hst.Variant>

<svelte:fragment slot="controls">
<Hst.Select title="status" bind:value={status} options={statusOptions} />
<Hst.Json title="statements" bind:value={statements} />
<Hst.Json title="keywords" bind:value={keywords} />
<Hst.Json title="categories" bind:value={categories} />
<Hst.Json title="party" bind:value={party} />
<Hst.Text title="latestProgressDate" bind:value={dateString} />
</svelte:fragment>
</Hst.Story>

0 comments on commit 2a09b48

Please sign in to comment.