generated from openscd/oscd-component
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oscd-component.stories.ts
53 lines (45 loc) · 1014 Bytes
/
oscd-component.stories.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { html, TemplateResult } from 'lit';
import './oscd-component.js';
export default {
title: 'OscdComponent',
component: 'oscd-component',
argTypes: {
title: { control: 'text' },
counter: { control: 'number' },
textColor: { control: 'color' },
},
};
interface Story<T> {
(args: T): TemplateResult;
args?: Partial<T>;
argTypes?: Record<string, unknown>;
}
interface ArgTypes {
title?: string;
counter?: number;
textColor?: string;
slot?: TemplateResult;
}
const Template: Story<ArgTypes> = ({
title = 'Hello world',
counter = 5,
textColor,
slot,
}: ArgTypes) => html`
<oscd-component
style="--oscd-component-text-color: ${textColor || 'black'}"
.title=${title}
.counter=${counter}
>
${slot}
</oscd-component>
`;
export const Regular = Template.bind({});
export const CustomTitle = Template.bind({});
CustomTitle.args = {
title: 'My title',
};
export const CustomCounter = Template.bind({});
CustomCounter.args = {
counter: 123456,
};