-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f5488a
commit dcb038c
Showing
21 changed files
with
379 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,52 @@ | ||
import type { Meta, StoryFn } from '@storybook/angular'; | ||
import type { Meta, StoryObj } from '@storybook/angular'; | ||
import Button from './button.component'; | ||
|
||
// More on default export: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export | ||
export default { | ||
// More on how to set up stories at: https://storybook.js.org/docs/angular/writing-stories/introduction#default-export | ||
const meta: Meta<Button> = { | ||
title: 'Example/Button', | ||
component: Button, | ||
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args | ||
render: (args: Button) => ({ | ||
props: { | ||
backgroundColor: null, | ||
...args, | ||
}, | ||
}), | ||
// More on argTypes: https://storybook.js.org/docs/angular/api/argtypes | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
backgroundColor: { | ||
control: 'color', | ||
}, | ||
}, | ||
} as Meta; | ||
|
||
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args | ||
const Template: StoryFn<Button> = (args: Button) => { | ||
return { | ||
props: { backgroundColor: null, ...args }, | ||
}; | ||
}; | ||
|
||
export const Primary = Template.bind({}); | ||
// More on args: https://storybook.js.org/docs/angular/writing-stories/args | ||
Primary.args = { | ||
primary: true, | ||
label: 'Button', | ||
export default meta; | ||
type Story = StoryObj<Button>; | ||
|
||
// More on component templates: https://storybook.js.org/docs/angular/writing-stories/introduction#using-args | ||
export const Primary: Story = { | ||
args: { | ||
primary: true, | ||
label: 'Button', | ||
}, | ||
}; | ||
|
||
export const Secondary = Template.bind({}); | ||
Secondary.args = { | ||
label: 'Button', | ||
export const Secondary: Story = { | ||
args: { | ||
label: 'Button', | ||
}, | ||
}; | ||
|
||
export const Large = Template.bind({}); | ||
Large.args = { | ||
size: 'large', | ||
label: 'Button', | ||
export const Large: Story = { | ||
args: { | ||
size: 'large', | ||
label: 'Button', | ||
}, | ||
}; | ||
|
||
export const Small = Template.bind({}); | ||
Small.args = { | ||
size: 'small', | ||
label: 'Button', | ||
export const Small: Story = { | ||
args: { | ||
size: 'small', | ||
label: 'Button', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { Button } from './Button'; | ||
|
||
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export | ||
const meta: Meta<typeof Button> = { | ||
title: 'Example/Button', | ||
component: Button, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
argTypes: { | ||
backgroundColor: { | ||
control: 'color', | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Button>; | ||
|
||
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args | ||
export const Primary: Story = { | ||
args: { | ||
primary: true, | ||
label: 'Button', | ||
}, | ||
}; | ||
|
||
export const Secondary: Story = { | ||
args: { | ||
label: 'Button', | ||
}, | ||
}; | ||
|
||
export const Large: Story = { | ||
args: { | ||
size: 'large', | ||
label: 'Button', | ||
}, | ||
}; | ||
|
||
export const Small: Story = { | ||
args: { | ||
size: 'small', | ||
label: 'Button', | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Header } from './Header'; | ||
|
||
const meta: Meta<typeof Header> = { | ||
title: 'Example/Header', | ||
component: Header, | ||
parameters: { | ||
// More on Story layout: https://storybook.js.org/docs/react/configure/story-layout | ||
layout: 'fullscreen', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Header>; | ||
|
||
export const LoggedIn: Story = { | ||
args: { | ||
user: { | ||
name: 'Jane Doe', | ||
}, | ||
}, | ||
}; | ||
|
||
export const LoggedOut: Story = {}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { within, userEvent } from '@storybook/testing-library'; | ||
|
||
import { Page } from './Page'; | ||
|
||
const meta: Meta<typeof Page> = { | ||
title: 'Example/Page', | ||
component: Page, | ||
parameters: { | ||
// More on Story layout: https://storybook.js.org/docs/react/configure/story-layout | ||
layout: 'fullscreen', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Page>; | ||
|
||
export const LoggedOut: Story = {}; | ||
|
||
// More on interaction testing: https://storybook.js.org/docs/react/writing-tests/interaction-testing | ||
export const LoggedIn: Story = { | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
const loginButton = await canvas.getByRole('button', { | ||
name: /Log in/i, | ||
}); | ||
await userEvent.click(loginButton); | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.