platform/dev/storybook/stories/Button.stories.ts
Andrey Sobolev a4cd43dbe2
Squashed commit of the following: (#3102)
commit fa57e53c9e
Author: Oleg Markelov <markelolegov@gmail.com>
Date:   Tue Apr 25 13:56:16 2023 +0700

    Add format script placeholder

    Signed-off-by: Oleg Markelov <markelolegov@gmail.com>

commit fb185be4b1
Author: Oleg Markelov <markelolegov@gmail.com>
Date:   Tue Apr 25 13:17:22 2023 +0700

    Update pnpm-lock.yaml

    Signed-off-by: Oleg Markelov <markelolegov@gmail.com>

commit babd91c87a
Merge: 5e0b1929a 5c30b8897
Author: Oleg Markelov <markelolegov@gmail.com>
Date:   Tue Apr 25 13:01:18 2023 +0700

    Merge branch 'main' into storybook-7-infrastructure
    Signed-off-by: Oleg Markelov <markelolegov@gmail.com>

commit 5e0b1929a9
Author: Oleg Markelov <markelolegov@gmail.com>
Date:   Tue Apr 25 12:59:07 2023 +0700

    Create initial Button stories

    Signed-off-by: Oleg Markelov <markelolegov@gmail.com>

commit 04099e8c22
Author: Oleg Markelov <markelolegov@gmail.com>
Date:   Tue Apr 25 12:58:26 2023 +0700

    Add storybook-7 infrastructure

    Signed-off-by: Oleg Markelov <markelolegov@gmail.com>

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
2023-04-28 11:41:22 +07:00

140 lines
3.4 KiB
TypeScript

import type { StoryObj } from '@storybook/svelte';
import { Button } from '@hcengineering/ui';
import uiPlugin from '@hcengineering/ui';
const meta = {
title: 'UI/Button',
component: Button,
tags: ['autodocs'],
argTypes: {
label: {
control: 'text',
description: 'label description',
table: {
type: { summary: 'IntlString | undefined' },
defaultValue: { summary: 'undefined' },
}
},
kind: {
control: 'select',
options: ['primary', 'secondary', 'no-border', 'transparent', 'link', 'link-bordered', 'dangerous', 'list', 'list-header'],
description: 'kind description',
table: {
type: { summary: 'ButtonKind' },
defaultValue: { summary: '"secondary"' },
}
},
size: {
control: 'select',
options: ['inline', 'small', 'medium', 'large', 'x-large'],
description: 'size description',
table: {
type: { summary: 'ButtonSize' },
defaultValue: { summary: '"medium"' },
}
},
shape: {
control: 'select',
options: ['rectangle', 'rectangle-left', 'rectangle-right', 'circle', 'round', undefined],
description: 'shape description',
table: {
type: { summary: 'ButtonShape | undefined' },
defaultValue: { summary: 'undefined' },
}
},
justify: {
control: 'inline-radio',
options: ['left', 'center'],
description: 'justify description',
table: {
type: { summary: '"left" | "center"' },
defaultValue: { summary: '"center"' },
}
},
disabled: {
control: 'boolean',
description: 'disabled description',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
}
},
loading: {
control: 'boolean',
description: 'loading description',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
}
},
width: {
control: 'text',
description: 'width description',
table: {
type: { summary: 'string | undefined' },
defaultValue: { summary: 'undefined' },
}
},
height: {
control: 'text',
description: 'height description',
table: {
type: { summary: 'string | undefined' },
defaultValue: { summary: 'undefined' },
}
},
title: {
control: 'text',
description: 'title description',
table: {
type: { summary: 'string | undefined' },
defaultValue: { summary: 'undefined' },
}
},
borderStyle: {
control: 'inline-radio',
options: ['solid', 'dashed'],
description: 'borderStyle description',
table: {
type: { summary: '"solid" | "dashed"' },
defaultValue: { summary: '"solid"' },
}
}
}
};
export default meta;
type Story = StoryObj<typeof meta>;
export const Ok: Story = {
args: {
label: uiPlugin.string.Ok,
kind: 'primary',
size: 'medium',
shape: undefined,
justify: 'left',
disabled: false,
loading: false,
width: undefined,
height: undefined,
title: 'This is a button',
borderStyle: 'dashed'
},
};
export const Cancel: Story = {
args: {
label: uiPlugin.string.Cancel,
kind: 'primary',
size: 'medium',
shape: undefined,
justify: 'left',
disabled: false,
loading: false,
width: undefined,
height: undefined,
title: 'This is a button',
borderStyle: 'dashed'
},
};