docs: create stories for Login page
This is the second form I have touched. Here, I even have a light validation implemented on the server. Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
parent
b0366f26ed
commit
390c54a2bf
2 changed files with 90 additions and 0 deletions
45
stories/pages/Login.stories.ts
Normal file
45
stories/pages/Login.stories.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
|
||||
import Login from '$lib/components/pages/Login.svelte';
|
||||
|
||||
const meta = {
|
||||
title: 'Pages/Login',
|
||||
component: Login,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
form: { controls: 'object' }
|
||||
}
|
||||
} satisfies Meta<Login>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Plain: Story = {
|
||||
args: {
|
||||
form: {
|
||||
account: 'jane.doe@domain.example',
|
||||
incorrect: false,
|
||||
missing: false,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const MissingInput: Story = {
|
||||
args: {
|
||||
form: {
|
||||
account: '',
|
||||
incorrect: false,
|
||||
missing: true,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const InvalidFormData: Story = {
|
||||
args: {
|
||||
form: {
|
||||
account: 'jane.doe@domain.example',
|
||||
incorrect: true,
|
||||
missing: false,
|
||||
}
|
||||
}
|
||||
};
|
45
stories/templates/Login.stories.ts
Normal file
45
stories/templates/Login.stories.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import type { Meta, StoryObj } from '@storybook/svelte';
|
||||
|
||||
import Login from '$lib/components/templates/Login.svelte';
|
||||
|
||||
const meta = {
|
||||
title: 'Templates/Login',
|
||||
component: Login,
|
||||
tags: ['autodocs'],
|
||||
argTypes: {
|
||||
form: { controls: 'object' }
|
||||
}
|
||||
} satisfies Meta<Login>;
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof meta>;
|
||||
|
||||
export const Plain: Story = {
|
||||
args: {
|
||||
form: {
|
||||
account: 'jane.doe@domain.example',
|
||||
incorrect: false,
|
||||
missing: false,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const MissingInput: Story = {
|
||||
args: {
|
||||
form: {
|
||||
account: '',
|
||||
incorrect: false,
|
||||
missing: true,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const InvalidFormData: Story = {
|
||||
args: {
|
||||
form: {
|
||||
account: 'jane.doe@domain.example',
|
||||
incorrect: true,
|
||||
missing: false,
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue