@storybook/cli 7.0.0-alpha.46 → 7.0.0-alpha.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generate.js +99 -99
- package/dist/generate.mjs +107 -107
- package/package.json +10 -10
- package/rendererAssets/angular/Button.stories.ts +0 -43
- package/rendererAssets/angular/Header.stories.ts +0 -35
- package/rendererAssets/angular/Page.stories.ts +0 -37
- package/rendererAssets/angular/User.ts +0 -2
- package/rendererAssets/angular/button.component.ts +0 -53
- package/rendererAssets/angular/header.component.ts +0 -75
- package/rendererAssets/angular/page.component.ts +0 -77
- package/rendererAssets/aurelia/1-Button.stories.ts +0 -49
- package/rendererAssets/aurelia/button.ts +0 -28
- package/rendererAssets/ember/1-Button.stories.js +0 -57
- package/rendererAssets/html/js/Button.js +0 -21
- package/rendererAssets/html/js/Button.stories.js +0 -48
- package/rendererAssets/html/js/Header.js +0 -47
- package/rendererAssets/html/js/Header.stories.js +0 -27
- package/rendererAssets/html/js/Page.js +0 -94
- package/rendererAssets/html/js/Page.stories.js +0 -23
- package/rendererAssets/html/ts/Button.stories.ts +0 -50
- package/rendererAssets/html/ts/Button.ts +0 -51
- package/rendererAssets/html/ts/Header.stories.ts +0 -27
- package/rendererAssets/html/ts/Header.ts +0 -54
- package/rendererAssets/html/ts/Page.stories.ts +0 -24
- package/rendererAssets/html/ts/Page.ts +0 -98
- package/rendererAssets/marionette/index.stories.js +0 -20
- package/rendererAssets/marko/1-Button.stories.js +0 -24
- package/rendererAssets/marko/Button.marko +0 -13
- package/rendererAssets/mithril/Button.js +0 -22
- package/rendererAssets/mithril/Button.stories.js +0 -43
- package/rendererAssets/mithril/Header.js +0 -51
- package/rendererAssets/mithril/Header.stories.js +0 -20
- package/rendererAssets/mithril/Page.js +0 -70
- package/rendererAssets/mithril/Page.stories.js +0 -24
- package/rendererAssets/nextjs/js/Button.jsx +0 -54
- package/rendererAssets/nextjs/js/Button.stories.jsx +0 -40
- package/rendererAssets/nextjs/js/Header.jsx +0 -57
- package/rendererAssets/nextjs/js/Header.stories.jsx +0 -24
- package/rendererAssets/nextjs/js/Introduction.stories.mdx +0 -228
- package/rendererAssets/nextjs/js/Page.jsx +0 -69
- package/rendererAssets/nextjs/js/Page.stories.jsx +0 -25
- package/rendererAssets/nextjs/ts/Button.stories.tsx +0 -41
- package/rendererAssets/nextjs/ts/Button.tsx +0 -52
- package/rendererAssets/nextjs/ts/Header.stories.tsx +0 -25
- package/rendererAssets/nextjs/ts/Header.tsx +0 -56
- package/rendererAssets/nextjs/ts/Introduction.stories.mdx +0 -228
- package/rendererAssets/nextjs/ts/Page.stories.tsx +0 -26
- package/rendererAssets/nextjs/ts/Page.tsx +0 -73
- package/rendererAssets/preact/Button.jsx +0 -49
- package/rendererAssets/preact/Button.stories.jsx +0 -39
- package/rendererAssets/preact/Header.jsx +0 -56
- package/rendererAssets/preact/Header.stories.jsx +0 -27
- package/rendererAssets/preact/Page.jsx +0 -69
- package/rendererAssets/preact/Page.stories.jsx +0 -24
- package/rendererAssets/rax/Button.js +0 -26
- package/rendererAssets/rax/Button.stories.js +0 -40
- package/rendererAssets/rax/Header.js +0 -44
- package/rendererAssets/rax/Header.stories.js +0 -17
- package/rendererAssets/rax/Page.js +0 -64
- package/rendererAssets/rax/Page.stories.js +0 -21
- package/rendererAssets/react/js/Button.jsx +0 -50
- package/rendererAssets/react/js/Button.stories.jsx +0 -40
- package/rendererAssets/react/js/Header.jsx +0 -57
- package/rendererAssets/react/js/Header.stories.jsx +0 -24
- package/rendererAssets/react/js/Page.jsx +0 -69
- package/rendererAssets/react/js/Page.stories.jsx +0 -25
- package/rendererAssets/react/ts/Button.stories.tsx +0 -41
- package/rendererAssets/react/ts/Button.tsx +0 -48
- package/rendererAssets/react/ts/Header.stories.tsx +0 -25
- package/rendererAssets/react/ts/Header.tsx +0 -56
- package/rendererAssets/react/ts/Page.stories.tsx +0 -26
- package/rendererAssets/react/ts/Page.tsx +0 -73
- package/rendererAssets/riot/1-Button.stories.js +0 -52
- package/rendererAssets/riot/MyButton.tag +0 -24
- package/rendererAssets/server/button.stories.json +0 -32
- package/rendererAssets/server/header.stories.json +0 -15
- package/rendererAssets/server/page.stories.json +0 -15
- package/rendererAssets/svelte/Button.stories.js +0 -51
- package/rendererAssets/svelte/Button.svelte +0 -43
- package/rendererAssets/svelte/Header.stories.js +0 -35
- package/rendererAssets/svelte/Header.svelte +0 -51
- package/rendererAssets/svelte/Page.stories.js +0 -27
- package/rendererAssets/svelte/Page.svelte +0 -63
- package/rendererAssets/vue/Button.stories.js +0 -46
- package/rendererAssets/vue/Button.vue +0 -54
- package/rendererAssets/vue/Header.stories.js +0 -27
- package/rendererAssets/vue/Header.vue +0 -51
- package/rendererAssets/vue/Page.stories.js +0 -27
- package/rendererAssets/vue/Page.vue +0 -88
- package/rendererAssets/vue3/Button.stories.js +0 -52
- package/rendererAssets/vue3/Button.vue +0 -52
- package/rendererAssets/vue3/Header.stories.js +0 -34
- package/rendererAssets/vue3/Header.vue +0 -41
- package/rendererAssets/vue3/Page.stories.js +0 -29
- package/rendererAssets/vue3/Page.vue +0 -88
- package/rendererAssets/web-components/js/Button.js +0 -21
- package/rendererAssets/web-components/js/Button.stories.js +0 -42
- package/rendererAssets/web-components/js/Header.js +0 -45
- package/rendererAssets/web-components/js/Header.stories.js +0 -15
- package/rendererAssets/web-components/js/Page.js +0 -61
- package/rendererAssets/web-components/js/Page.stories.js +0 -19
- package/rendererAssets/web-components/ts/Button.stories.ts +0 -44
- package/rendererAssets/web-components/ts/Button.ts +0 -43
- package/rendererAssets/web-components/ts/Header.stories.ts +0 -17
- package/rendererAssets/web-components/ts/Header.ts +0 -52
- package/rendererAssets/web-components/ts/Page.stories.ts +0 -21
- package/rendererAssets/web-components/ts/Page.ts +0 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/cli",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.47",
|
|
4
4
|
"description": "Storybook's CLI - easiest method of adding storybook to your projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/core": "^7.12.10",
|
|
45
45
|
"@babel/preset-env": "^7.12.11",
|
|
46
|
-
"@storybook/codemod": "7.0.0-alpha.
|
|
47
|
-
"@storybook/core-common": "7.0.0-alpha.
|
|
48
|
-
"@storybook/core-server": "7.0.0-alpha.
|
|
49
|
-
"@storybook/csf-tools": "7.0.0-alpha.
|
|
50
|
-
"@storybook/node-logger": "7.0.0-alpha.
|
|
51
|
-
"@storybook/telemetry": "7.0.0-alpha.
|
|
52
|
-
"@storybook/types": "7.0.0-alpha.
|
|
46
|
+
"@storybook/codemod": "7.0.0-alpha.47",
|
|
47
|
+
"@storybook/core-common": "7.0.0-alpha.47",
|
|
48
|
+
"@storybook/core-server": "7.0.0-alpha.47",
|
|
49
|
+
"@storybook/csf-tools": "7.0.0-alpha.47",
|
|
50
|
+
"@storybook/node-logger": "7.0.0-alpha.47",
|
|
51
|
+
"@storybook/telemetry": "7.0.0-alpha.47",
|
|
52
|
+
"@storybook/types": "7.0.0-alpha.47",
|
|
53
53
|
"@types/semver": "^7.3.4",
|
|
54
54
|
"boxen": "^5.1.2",
|
|
55
55
|
"chalk": "^4.1.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"util-deprecate": "^1.0.2"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@storybook/client-api": "7.0.0-alpha.
|
|
80
|
+
"@storybook/client-api": "7.0.0-alpha.47",
|
|
81
81
|
"@types/cross-spawn": "^6.0.2",
|
|
82
82
|
"@types/degit": "^2.8.3",
|
|
83
83
|
"@types/prompts": "^2.0.9",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
],
|
|
100
100
|
"platform": "node"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "1c706a4a778831e012343c905f86225fa71491a7"
|
|
103
103
|
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/angular';
|
|
2
|
-
import Button from './button.component';
|
|
3
|
-
|
|
4
|
-
// More on default export: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export
|
|
5
|
-
export default {
|
|
6
|
-
title: 'Example/Button',
|
|
7
|
-
component: Button,
|
|
8
|
-
// More on argTypes: https://storybook.js.org/docs/angular/api/argtypes
|
|
9
|
-
argTypes: {
|
|
10
|
-
backgroundColor: { control: 'color' },
|
|
11
|
-
},
|
|
12
|
-
} as Meta;
|
|
13
|
-
|
|
14
|
-
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args
|
|
15
|
-
const Template: StoryFn<Button> = (args: Button) => {
|
|
16
|
-
return {
|
|
17
|
-
props: { backgroundColor: null, ...args },
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Primary = Template.bind({});
|
|
22
|
-
// More on args: https://storybook.js.org/docs/angular/writing-stories/args
|
|
23
|
-
Primary.args = {
|
|
24
|
-
primary: true,
|
|
25
|
-
label: 'Button',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Secondary = Template.bind({});
|
|
29
|
-
Secondary.args = {
|
|
30
|
-
label: 'Button',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Large = Template.bind({});
|
|
34
|
-
Large.args = {
|
|
35
|
-
size: 'large',
|
|
36
|
-
label: 'Button',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Small = Template.bind({});
|
|
40
|
-
Small.args = {
|
|
41
|
-
size: 'small',
|
|
42
|
-
label: 'Button',
|
|
43
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { moduleMetadata } from '@storybook/angular';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import type { Meta, StoryFn } from '@storybook/angular';
|
|
4
|
-
|
|
5
|
-
import Button from './button.component';
|
|
6
|
-
import Header from './header.component';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Example/Header',
|
|
10
|
-
component: Header,
|
|
11
|
-
decorators: [
|
|
12
|
-
moduleMetadata({
|
|
13
|
-
declarations: [Button],
|
|
14
|
-
imports: [CommonModule],
|
|
15
|
-
}),
|
|
16
|
-
],
|
|
17
|
-
parameters: {
|
|
18
|
-
// More on Story layout: https://storybook.js.org/docs/angular/configure/story-layout
|
|
19
|
-
layout: 'fullscreen',
|
|
20
|
-
},
|
|
21
|
-
} as Meta;
|
|
22
|
-
|
|
23
|
-
const Template: StoryFn<Header> = (args: Header) => ({
|
|
24
|
-
props: args,
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export const LoggedIn = Template.bind({});
|
|
28
|
-
LoggedIn.args = {
|
|
29
|
-
user: {
|
|
30
|
-
name: 'Jane Doe',
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const LoggedOut = Template.bind({});
|
|
35
|
-
LoggedOut.args = {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { StoryFn, Meta } from '@storybook/angular';
|
|
2
|
-
import { moduleMetadata } from '@storybook/angular';
|
|
3
|
-
import { within, userEvent } from '@storybook/testing-library';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
|
|
6
|
-
import Button from './button.component';
|
|
7
|
-
import Header from './header.component';
|
|
8
|
-
import Page from './page.component';
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
title: 'Example/Page',
|
|
12
|
-
component: Page,
|
|
13
|
-
parameters: {
|
|
14
|
-
// More on StoryFn layout: https://storybook.js.org/docs/angular/configure/story-layout
|
|
15
|
-
layout: 'fullscreen',
|
|
16
|
-
},
|
|
17
|
-
decorators: [
|
|
18
|
-
moduleMetadata({
|
|
19
|
-
declarations: [Button, Header],
|
|
20
|
-
imports: [CommonModule],
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
|
-
} as Meta;
|
|
24
|
-
|
|
25
|
-
const Template: StoryFn<Page> = (args: Page) => ({
|
|
26
|
-
props: args,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export const LoggedOut = Template.bind({});
|
|
30
|
-
|
|
31
|
-
// More on interaction testing: https://storybook.js.org/docs/angular/writing-tests/interaction-testing
|
|
32
|
-
export const LoggedIn = Template.bind({});
|
|
33
|
-
LoggedIn.play = async ({ canvasElement }) => {
|
|
34
|
-
const canvas = within(canvasElement);
|
|
35
|
-
const loginButton = await canvas.getByRole('button', { name: /Log in/i });
|
|
36
|
-
await userEvent.click(loginButton);
|
|
37
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
selector: 'storybook-button',
|
|
5
|
-
template: ` <button
|
|
6
|
-
type="button"
|
|
7
|
-
(click)="onClick.emit($event)"
|
|
8
|
-
[ngClass]="classes"
|
|
9
|
-
[ngStyle]="{ 'background-color': backgroundColor }"
|
|
10
|
-
>
|
|
11
|
-
{{ label }}
|
|
12
|
-
</button>`,
|
|
13
|
-
styleUrls: ['./button.css'],
|
|
14
|
-
})
|
|
15
|
-
export default class ButtonComponent {
|
|
16
|
-
/**
|
|
17
|
-
* Is this the principal call to action on the page?
|
|
18
|
-
*/
|
|
19
|
-
@Input()
|
|
20
|
-
primary = false;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* What background color to use
|
|
24
|
-
*/
|
|
25
|
-
@Input()
|
|
26
|
-
backgroundColor?: string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* How large should the button be?
|
|
30
|
-
*/
|
|
31
|
-
@Input()
|
|
32
|
-
size: 'small' | 'medium' | 'large' = 'medium';
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Button contents
|
|
36
|
-
*
|
|
37
|
-
* @required
|
|
38
|
-
*/
|
|
39
|
-
@Input()
|
|
40
|
-
label = 'Button';
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Optional click handler
|
|
44
|
-
*/
|
|
45
|
-
@Output()
|
|
46
|
-
onClick = new EventEmitter<Event>();
|
|
47
|
-
|
|
48
|
-
public get classes(): string[] {
|
|
49
|
-
const mode = this.primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
50
|
-
|
|
51
|
-
return ['storybook-button', `storybook-button--${this.size}`, mode];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
|
2
|
-
import type { User } from './User';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'storybook-header',
|
|
6
|
-
template: `<header>
|
|
7
|
-
<div class="wrapper">
|
|
8
|
-
<div>
|
|
9
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
-
<g fill="none" fillRule="evenodd">
|
|
11
|
-
<path
|
|
12
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
13
|
-
fill="#FFF"
|
|
14
|
-
/>
|
|
15
|
-
<path
|
|
16
|
-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
17
|
-
fill="#555AB9"
|
|
18
|
-
/>
|
|
19
|
-
<path
|
|
20
|
-
d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
|
|
21
|
-
fill="#91BAF8"
|
|
22
|
-
/>
|
|
23
|
-
</g>
|
|
24
|
-
</svg>
|
|
25
|
-
<h1>Acme</h1>
|
|
26
|
-
</div>
|
|
27
|
-
<div>
|
|
28
|
-
<div *ngIf="user">
|
|
29
|
-
<span class="welcome">
|
|
30
|
-
Welcome, <b>{{ user.name }}</b
|
|
31
|
-
>!
|
|
32
|
-
</span>
|
|
33
|
-
<storybook-button
|
|
34
|
-
*ngIf="user"
|
|
35
|
-
size="small"
|
|
36
|
-
(onClick)="onLogout.emit($event)"
|
|
37
|
-
label="Log out"
|
|
38
|
-
></storybook-button>
|
|
39
|
-
</div>
|
|
40
|
-
<div *ngIf="!user">
|
|
41
|
-
<storybook-button
|
|
42
|
-
*ngIf="!user"
|
|
43
|
-
size="small"
|
|
44
|
-
class="margin-left"
|
|
45
|
-
(onClick)="onLogin.emit($event)"
|
|
46
|
-
label="Log in"
|
|
47
|
-
></storybook-button>
|
|
48
|
-
<storybook-button
|
|
49
|
-
*ngIf="!user"
|
|
50
|
-
primary
|
|
51
|
-
size="small"
|
|
52
|
-
primary="true"
|
|
53
|
-
class="margin-left"
|
|
54
|
-
(onClick)="onCreateAccount.emit($event)"
|
|
55
|
-
label="Sign up"
|
|
56
|
-
></storybook-button>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</header>`,
|
|
61
|
-
styleUrls: ['./header.css'],
|
|
62
|
-
})
|
|
63
|
-
export default class HeaderComponent {
|
|
64
|
-
@Input()
|
|
65
|
-
user: User | null = null;
|
|
66
|
-
|
|
67
|
-
@Output()
|
|
68
|
-
onLogin = new EventEmitter<Event>();
|
|
69
|
-
|
|
70
|
-
@Output()
|
|
71
|
-
onLogout = new EventEmitter<Event>();
|
|
72
|
-
|
|
73
|
-
@Output()
|
|
74
|
-
onCreateAccount = new EventEmitter<Event>();
|
|
75
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import type { User } from './User';
|
|
3
|
-
|
|
4
|
-
@Component({
|
|
5
|
-
selector: 'storybook-page',
|
|
6
|
-
template: `<article>
|
|
7
|
-
<storybook-header
|
|
8
|
-
[user]="user"
|
|
9
|
-
(onLogout)="doLogout()"
|
|
10
|
-
(onLogin)="doLogin()"
|
|
11
|
-
(onCreateAccount)="doCreateAccount()"
|
|
12
|
-
></storybook-header>
|
|
13
|
-
<section>
|
|
14
|
-
<h2>Pages in Storybook</h2>
|
|
15
|
-
<p>
|
|
16
|
-
We recommend building UIs with a
|
|
17
|
-
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
|
18
|
-
<strong>component-driven</strong>
|
|
19
|
-
</a>
|
|
20
|
-
process starting with atomic components and ending with pages.
|
|
21
|
-
</p>
|
|
22
|
-
<p>
|
|
23
|
-
Render pages with mock data. This makes it easy to build and review page states without
|
|
24
|
-
needing to navigate to them in your app. Here are some handy patterns for managing page data
|
|
25
|
-
in Storybook:
|
|
26
|
-
</p>
|
|
27
|
-
<ul>
|
|
28
|
-
<li>
|
|
29
|
-
Use a higher-level connected component. Storybook helps you compose such data from the
|
|
30
|
-
"args" of child component stories
|
|
31
|
-
</li>
|
|
32
|
-
<li>
|
|
33
|
-
Assemble data in the page component from your services. You can mock these services out
|
|
34
|
-
using Storybook.
|
|
35
|
-
</li>
|
|
36
|
-
</ul>
|
|
37
|
-
<p>
|
|
38
|
-
Get a guided tutorial on component-driven development at
|
|
39
|
-
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
|
40
|
-
Storybook tutorials
|
|
41
|
-
</a>
|
|
42
|
-
. Read more in the
|
|
43
|
-
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer"> docs </a>
|
|
44
|
-
.
|
|
45
|
-
</p>
|
|
46
|
-
<div class="tip-wrapper">
|
|
47
|
-
<span class="tip">Tip</span> Adjust the width of the canvas with the
|
|
48
|
-
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
|
49
|
-
<g fill="none" fillRule="evenodd">
|
|
50
|
-
<path
|
|
51
|
-
d="M1.5 5.2h4.8c.3 0 .5.2.5.4v5.1c-.1.2-.3.3-.4.3H1.4a.5.5 0 01-.5-.4V5.7c0-.3.2-.5.5-.5zm0-2.1h6.9c.3 0 .5.2.5.4v7a.5.5 0 01-1 0V4H1.5a.5.5 0 010-1zm0-2.1h9c.3 0 .5.2.5.4v9.1a.5.5 0 01-1 0V2H1.5a.5.5 0 010-1zm4.3 5.2H2V10h3.8V6.2z"
|
|
52
|
-
id="a"
|
|
53
|
-
fill="#999"
|
|
54
|
-
/>
|
|
55
|
-
</g>
|
|
56
|
-
</svg>
|
|
57
|
-
Viewports addon in the toolbar
|
|
58
|
-
</div>
|
|
59
|
-
</section>
|
|
60
|
-
</article>`,
|
|
61
|
-
styleUrls: ['./page.css'],
|
|
62
|
-
})
|
|
63
|
-
export default class PageComponent {
|
|
64
|
-
user: User | null = null;
|
|
65
|
-
|
|
66
|
-
doLogout() {
|
|
67
|
-
this.user = null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
doLogin() {
|
|
71
|
-
this.user = { name: 'Jane Doe' };
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
doCreateAccount() {
|
|
75
|
-
this.user = { name: 'Jane Doe' };
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { linkTo } from '@storybook/addon-links';
|
|
3
|
-
|
|
4
|
-
import Button from './button';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Button',
|
|
8
|
-
component: Button,
|
|
9
|
-
argTypes: {
|
|
10
|
-
label: { control: 'text' },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const Template = (args) => ({
|
|
15
|
-
component: Button,
|
|
16
|
-
props: args,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export const Text = Template.bind({});
|
|
20
|
-
Text.args = {
|
|
21
|
-
label: 'Button',
|
|
22
|
-
onClick: action('onClick'),
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Emoji = Template.bind({});
|
|
26
|
-
Emoji.args = {
|
|
27
|
-
label: '😀 😎 👍 💯',
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const TextWithAction = () => ({
|
|
31
|
-
component: Button,
|
|
32
|
-
props: {
|
|
33
|
-
label: 'Trigger Action',
|
|
34
|
-
onClick: () => action('This was clicked')(),
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
TextWithAction.storyName = 'With an action';
|
|
39
|
-
TextWithAction.parameters = { notes: 'My notes on a button with emojis' };
|
|
40
|
-
|
|
41
|
-
export const ButtonWithLinkToAnotherStory = () => ({
|
|
42
|
-
component: Button,
|
|
43
|
-
props: {
|
|
44
|
-
label: 'Go to Welcome Story',
|
|
45
|
-
onClick: linkTo('example-introduction--page'),
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
ButtonWithLinkToAnotherStory.storyName = 'button with link to another story';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { customElement, bindable } from 'aurelia';
|
|
2
|
-
|
|
3
|
-
@customElement({
|
|
4
|
-
name: 'storybook-button-component',
|
|
5
|
-
template: `
|
|
6
|
-
<template>
|
|
7
|
-
<button click.delegate="onClick($event)">\${label}</button>
|
|
8
|
-
<style>
|
|
9
|
-
button {
|
|
10
|
-
border: 1px solid #eee;
|
|
11
|
-
border-radius: 3px;
|
|
12
|
-
background-color: #ffffff;
|
|
13
|
-
cursor: pointer;
|
|
14
|
-
font-size: 15px;
|
|
15
|
-
padding: 3px 10px;
|
|
16
|
-
margin: 10px;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
</template>
|
|
20
|
-
`,
|
|
21
|
-
})
|
|
22
|
-
export default class Button {
|
|
23
|
-
@bindable()
|
|
24
|
-
label = '';
|
|
25
|
-
|
|
26
|
-
@bindable()
|
|
27
|
-
onClick: MouseEvent;
|
|
28
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { hbs } from 'ember-cli-htmlbars';
|
|
2
|
-
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { linkTo } from '@storybook/addon-links';
|
|
4
|
-
|
|
5
|
-
// More on default export: https://storybook.js.org/docs/ember/writing-stories/introduction#default-export
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Button',
|
|
8
|
-
// More on argTypes: https://storybook.js.org/docs/ember/api/argtypes
|
|
9
|
-
argTypes: {
|
|
10
|
-
label: { control: 'text' },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// More on component templates: https://storybook.js.org/docs/ember/writing-stories/introduction#using-args
|
|
15
|
-
const Template = (args) => ({
|
|
16
|
-
template: hbs`<button {{action onClick}}>{{label}}</button>`,
|
|
17
|
-
context: args,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export const Text = Template.bind({});
|
|
21
|
-
// More on args: https://storybook.js.org/docs/ember/writing-stories/args
|
|
22
|
-
Text.args = {
|
|
23
|
-
label: 'Button',
|
|
24
|
-
onClick: action('onClick'),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Emoji = Template.bind({});
|
|
28
|
-
Emoji.args = {
|
|
29
|
-
label: '😀 😎 👍 💯',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const TextWithAction = () => ({
|
|
33
|
-
template: hbs`
|
|
34
|
-
<button {{action onClick}}>
|
|
35
|
-
Trigger Action
|
|
36
|
-
</button>
|
|
37
|
-
`,
|
|
38
|
-
context: {
|
|
39
|
-
onClick: () => action('This was clicked')(),
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
TextWithAction.storyName = 'With an action';
|
|
44
|
-
TextWithAction.parameters = { notes: 'My notes on a button with emojis' };
|
|
45
|
-
|
|
46
|
-
export const ButtonWithLinkToAnotherStory = () => ({
|
|
47
|
-
template: hbs`
|
|
48
|
-
<button {{action onClick}}>
|
|
49
|
-
Go to Welcome Story
|
|
50
|
-
</button>
|
|
51
|
-
`,
|
|
52
|
-
context: {
|
|
53
|
-
onClick: linkTo('example-introduction--page'),
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
ButtonWithLinkToAnotherStory.storyName = 'button with link to another story';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import './button.css';
|
|
2
|
-
|
|
3
|
-
export const createButton = ({
|
|
4
|
-
primary = false,
|
|
5
|
-
size = 'medium',
|
|
6
|
-
backgroundColor,
|
|
7
|
-
label,
|
|
8
|
-
onClick,
|
|
9
|
-
}) => {
|
|
10
|
-
const btn = document.createElement('button');
|
|
11
|
-
btn.type = 'button';
|
|
12
|
-
btn.innerText = label;
|
|
13
|
-
btn.addEventListener('click', onClick);
|
|
14
|
-
|
|
15
|
-
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
16
|
-
btn.className = ['storybook-button', `storybook-button--${size}`, mode].join(' ');
|
|
17
|
-
|
|
18
|
-
btn.style.backgroundColor = backgroundColor;
|
|
19
|
-
|
|
20
|
-
return btn;
|
|
21
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createButton } from './Button';
|
|
2
|
-
|
|
3
|
-
// More on default export: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Example/Button',
|
|
6
|
-
// More on argTypes: https://storybook.js.org/docs/html/api/argtypes
|
|
7
|
-
argTypes: {
|
|
8
|
-
backgroundColor: { control: 'color' },
|
|
9
|
-
label: { control: 'text' },
|
|
10
|
-
onClick: { action: 'onClick' },
|
|
11
|
-
primary: { control: 'boolean' },
|
|
12
|
-
size: {
|
|
13
|
-
control: { type: 'select' },
|
|
14
|
-
options: ['small', 'medium', 'large'],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// More on component templates: https://storybook.js.org/docs/html/writing-stories/introduction#using-args
|
|
20
|
-
const Template = ({ label, ...args }) => {
|
|
21
|
-
// You can either use a function to create DOM elements or use a plain html string!
|
|
22
|
-
// return `<div>${label}</div>`;
|
|
23
|
-
return createButton({ label, ...args });
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Primary = Template.bind({});
|
|
27
|
-
// More on args: https://storybook.js.org/docs/html/writing-stories/args
|
|
28
|
-
Primary.args = {
|
|
29
|
-
primary: true,
|
|
30
|
-
label: 'Button',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Secondary = Template.bind({});
|
|
34
|
-
Secondary.args = {
|
|
35
|
-
label: 'Button',
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Large = Template.bind({});
|
|
39
|
-
Large.args = {
|
|
40
|
-
size: 'large',
|
|
41
|
-
label: 'Button',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const Small = Template.bind({});
|
|
45
|
-
Small.args = {
|
|
46
|
-
size: 'small',
|
|
47
|
-
label: 'Button',
|
|
48
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import './header.css';
|
|
2
|
-
import { createButton } from './Button';
|
|
3
|
-
|
|
4
|
-
export const createHeader = ({ user, onLogout, onLogin, onCreateAccount }) => {
|
|
5
|
-
const header = document.createElement('header');
|
|
6
|
-
|
|
7
|
-
const wrapper = document.createElement('div');
|
|
8
|
-
wrapper.className = 'wrapper';
|
|
9
|
-
|
|
10
|
-
const logo = `<div>
|
|
11
|
-
<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
|
|
12
|
-
<g fill="none" fillRule="evenodd">
|
|
13
|
-
<path
|
|
14
|
-
d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
|
|
15
|
-
fill="#FFF" />
|
|
16
|
-
<path
|
|
17
|
-
d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
|
|
18
|
-
fill="#555AB9" />
|
|
19
|
-
<path d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z" fill="#91BAF8" />
|
|
20
|
-
</g>
|
|
21
|
-
</svg>
|
|
22
|
-
<h1>Acme</h1>
|
|
23
|
-
</div>`;
|
|
24
|
-
|
|
25
|
-
wrapper.insertAdjacentHTML('afterbegin', logo);
|
|
26
|
-
|
|
27
|
-
const account = document.createElement('div');
|
|
28
|
-
if (user) {
|
|
29
|
-
const welcomeMessage = `<span class="welcome">Welcome, <b>${user.name}</b>!</span>`;
|
|
30
|
-
account.innerHTML = welcomeMessage;
|
|
31
|
-
account.appendChild(createButton({ size: 'small', label: 'Log out', onClick: onLogout }));
|
|
32
|
-
} else {
|
|
33
|
-
account.appendChild(createButton({ size: 'small', label: 'Log in', onClick: onLogin }));
|
|
34
|
-
account.appendChild(
|
|
35
|
-
createButton({
|
|
36
|
-
size: 'small',
|
|
37
|
-
label: 'Sign up',
|
|
38
|
-
onClick: onCreateAccount,
|
|
39
|
-
primary: true,
|
|
40
|
-
})
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
wrapper.appendChild(account);
|
|
44
|
-
header.appendChild(wrapper);
|
|
45
|
-
|
|
46
|
-
return header;
|
|
47
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createHeader } from './Header';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Example/Header',
|
|
5
|
-
parameters: {
|
|
6
|
-
// More on Story layout: https://storybook.js.org/docs/html/configure/story-layout
|
|
7
|
-
layout: 'fullscreen',
|
|
8
|
-
},
|
|
9
|
-
// More on argTypes: https://storybook.js.org/docs/html/api/argtypes
|
|
10
|
-
argTypes: {
|
|
11
|
-
onLogin: { action: 'onLogin' },
|
|
12
|
-
onLogout: { action: 'onLogout' },
|
|
13
|
-
onCreateAccount: { action: 'onCreateAccount' },
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const Template = (args) => createHeader(args);
|
|
18
|
-
|
|
19
|
-
export const LoggedIn = Template.bind({});
|
|
20
|
-
LoggedIn.args = {
|
|
21
|
-
user: {
|
|
22
|
-
name: 'Jane Doe',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const LoggedOut = Template.bind({});
|
|
27
|
-
LoggedOut.args = {};
|