generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from storybookjs/update-stories [skip ci]
Update stories
- Loading branch information
Showing
13 changed files
with
138 additions
and
110 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
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
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 |
---|---|---|
|
@@ -24,3 +24,9 @@ h1 { | |
button + button { | ||
margin-left: 10px; | ||
} | ||
|
||
.welcome { | ||
color: #333; | ||
font-size: 14px; | ||
margin-right: 10px; | ||
} |
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,69 @@ | ||
import React from 'react'; | ||
|
||
import { Header } from '../molecules/Header'; | ||
import './page.css'; | ||
|
||
export const Page = () => { | ||
const [user, setUser] = React.useState(); | ||
|
||
return ( | ||
<article> | ||
<Header | ||
user={user} | ||
onLogin={() => setUser({ name: 'Jane Doe' })} | ||
onLogout={() => setUser(undefined)} | ||
onCreateAccount={() => setUser({ name: 'Jane Doe' })} | ||
/> | ||
|
||
<section> | ||
<h2>Pages in Storybook</h2> | ||
<p> | ||
We recommend building UIs with a{' '} | ||
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer"> | ||
<strong>component-driven</strong> | ||
</a>{' '} | ||
process starting with atomic components and ending with pages. | ||
</p> | ||
<p> | ||
Render pages with mock data. This makes it easy to build and review page states without | ||
needing to navigate to them in your app. Here are some handy patterns for managing page | ||
data in Storybook: | ||
</p> | ||
<ul> | ||
<li> | ||
Use a higher-level connected component. Storybook helps you compose such data from the | ||
"args" of child component stories | ||
</li> | ||
<li> | ||
Assemble data in the page component from your services. You can mock these services out | ||
using Storybook. | ||
</li> | ||
</ul> | ||
<p> | ||
Get a guided tutorial on component-driven development at{' '} | ||
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer"> | ||
Storybook tutorials | ||
</a> | ||
. Read more in the{' '} | ||
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer"> | ||
docs | ||
</a> | ||
. | ||
</p> | ||
<div className="tip-wrapper"> | ||
<span className="tip">Tip</span> Adjust the width of the canvas with the{' '} | ||
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg"> | ||
<g fill="none" fillRule="evenodd"> | ||
<path | ||
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" | ||
id="a" | ||
fill="#999" | ||
/> | ||
</g> | ||
</svg> | ||
Viewports addon in the toolbar | ||
</div> | ||
</section> | ||
</article> | ||
); | ||
}; |
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,23 @@ | ||
import React from 'react'; | ||
import { within, userEvent } from '@storybook/testing-library'; | ||
|
||
import { Page } from './Page'; | ||
|
||
export default { | ||
title: 'Pages/Page', | ||
component: Page, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
}; | ||
|
||
const Template = (args) => <Page {...args} />; | ||
|
||
export const LoggedOut = Template.bind({}); | ||
|
||
export const LoggedIn = Template.bind({}); | ||
LoggedIn.play = async ({ canvasElement }) => { | ||
const canvas = within(canvasElement); | ||
const loginButton = await canvas.getByRole('button', { name: /Log in/i }); | ||
await userEvent.click(loginButton); | ||
}; |
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