Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 56 additions & 47 deletions src/components/SyncCard.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,7 @@ const meta: Meta<typeof SyncCard> = {
// This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
args: {
title: 'Sync Card Demo',
},
parameters: {
docs: {
/*
source: {
format: true,
code: `
<sync-card title="Sync Card Demo" v-model="sync-card-model">
<template v-slot:icon>
<span>
<img :src="icon" alt="icon alt text"/>
</span>
</template>
</sync-card>
`
},
*/
},
title: 'Title',
},
render: (args) => ({
components: { SyncCard },
Expand All @@ -44,69 +26,96 @@ const meta: Meta<typeof SyncCard> = {

return { args, model };
},
template: `
<sync-card v-bind="args" v-model="model">
<template v-slot:icon>
<span class="icon-calendar">
<img src="${CalendarIcon}" alt="Calendar Icon"/>
</span>
</template>
</sync-card>`,
template: `<sync-card v-bind="args" v-model="model" />`,
}),
};

export default meta;
type Story = StoryObj<typeof meta>;
export const CalendarSync: Story = {

export const Standard: Story = {
args: {
modelValue: [
{
key: 0,
label: 'My calendar',
label: 'Option 1',
checked: false,
},
{
key: 1,
label: 'Test Calendar',
checked: false,
},
{
key: 2,
label: 'Where all the spam events go',
label: 'Option 2',
checked: true,
},
{
key: 3,
label: 'Work PTO',
checked: false,
},
{
key: 4,
label: 'That calendar you never use but its full of holidays',
key: 2,
label: 'Option 3',
checked: false,
},
],
},
parameters: {
docs: {
source: {
code: '<sync-card\n title="Title"\n v-model="[\n { key: 0, label: \'Option 1\', checked: false },\n { key: 1, label: \'Option 2\', checked: true },\n { key: 2, label: \'Option 3\', checked: false },\n ]"\n/>',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can v-models be given a inline list? Maybe we should do:

Suggested change
code: '<sync-card\n title="Title"\n v-model="[\n { key: 0, label: \'Option 1\', checked: false },\n { key: 1, label: \'Option 2\', checked: true },\n { key: 2, label: \'Option 3\', checked: false },\n ]"\n/>',
code: 'const model = ref([\n { key: 0, label: \'Option 1\', checked: false },\n { key: 1, label: \'Option 2\', checked: true },\n { key: 2, label: \'Option 3\', checked: false },\n ]);\n<sync-card\n title="Title"\n v-model="model"\n/>',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Please check that the newlines make sense 😅

},
},
},
};

export const FileSync: Story = {
export const Icon: Story = {
args: {
title: 'Select calendars to sync',
modelValue: [
{
key: 0,
label: 'acorn.png',
checked: false,
label: 'My calendar',
checked: true,
},
{
key: 1,
label: 'squirrel shopping list.txt',
label: 'Test Calendar',
checked: false,
},
{
key: 2,
label: 'chill beats to hibernate to.zip',
label: 'Where all the spam events go',
checked: false,
},
{
key: 3,
label: 'Work PTO',
checked: true,
},
],
},
render: (args) => ({
components: { SyncCard },
setup() {
const model = ref(args.modelValue);

watch(
() => args.modelValue,
(val) => {
model.value = val;
}
);

return { args, model };
},
template: `
<sync-card v-bind="args" v-model="model">
<template v-slot:icon>
<span class="icon-calendar">
<img src="${CalendarIcon}" alt="Calendar Icon"/>
</span>
</template>
</sync-card>`,
}),
parameters: {
docs: {
source: {
code: '<sync-card\n title="Title"\n v-model="[\n { key: 0, label: \'My calendar\', checked: true },\n { key: 1, label: \'Test Calendar\', checked: false },\n { key: 2, label: \'Where all the spam events go\', checked: false },\n { key: 3, label: \'Work PTO\', checked: true },\n ]"\n>\n <template v-slot:icon>\n <img src="/assets/svg/icons/calendar.svg" alt="Calendar Icon"/>\n </template>\n</sync-card>',
},
},
},
};
1 change: 1 addition & 0 deletions src/components/SyncCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ withDefaults(defineProps<Props>(), {
background-color: var(--colour-neutral-base);
padding: 0.375rem 0.75rem;
font-size: var(--txt-input);
box-sizing: border-box;

&:nth-child(even) {
background-color: var(--colour-neutral-lower);
Expand Down
Loading