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>
45 lines
732 B
TypeScript
45 lines
732 B
TypeScript
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,
|
|
}
|
|
}
|
|
};
|