This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/packages/website/stories/Page.js

70 lines
2.4 KiB
JavaScript
Raw Permalink Normal View History

2021-04-02 18:45:38 +00:00
import React from "react";
import PropTypes from "prop-types";
2021-03-23 12:07:19 +00:00
2021-04-02 18:45:38 +00:00
import { Header } from "./Header";
import "./page.css";
2021-03-23 12:07:19 +00:00
export const Page = ({ user, onLogin, onLogout, onCreateAccount }) => (
<article>
<Header user={user} onLogin={onLogin} onLogout={onLogout} onCreateAccount={onCreateAccount} />
<section>
<h2>Pages in Storybook</h2>
<p>
2021-04-02 18:45:38 +00:00
We recommend building UIs with a{" "}
2021-03-23 12:07:19 +00:00
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
<strong>component-driven</strong>
2021-04-02 18:45:38 +00:00
</a>{" "}
2021-03-23 12:07:19 +00:00
process starting with atomic components and ending with pages.
</p>
<p>
2021-04-02 18:45:38 +00:00
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:
2021-03-23 12:07:19 +00:00
</p>
<ul>
<li>
2021-04-02 18:45:38 +00:00
Use a higher-level connected component. Storybook helps you compose such data from the "args" of child
component stories
2021-03-23 12:07:19 +00:00
</li>
<li>
2021-04-02 18:45:38 +00:00
Assemble data in the page component from your services. You can mock these services out using Storybook.
2021-03-23 12:07:19 +00:00
</li>
</ul>
<p>
2021-04-02 18:45:38 +00:00
Get a guided tutorial on component-driven development at{" "}
2021-03-23 12:07:19 +00:00
<a href="https://www.learnstorybook.com" target="_blank" rel="noopener noreferrer">
Learn Storybook
</a>
2021-04-02 18:45:38 +00:00
. Read more in the{" "}
2021-03-23 12:07:19 +00:00
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
docs
</a>
.
</p>
<div className="tip-wrapper">
2021-04-02 18:45:38 +00:00
<span className="tip">Tip</span> Adjust the width of the canvas with the{" "}
2021-03-23 12:07:19 +00:00
<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>
);
Page.propTypes = {
user: PropTypes.shape({}),
onLogin: PropTypes.func.isRequired,
onLogout: PropTypes.func.isRequired,
onCreateAccount: PropTypes.func.isRequired,
};
Page.defaultProps = {
user: null,
};