No Description

Page.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import { Header } from './Header';
  4. import './page.css';
  5. export const Page = ({ user, onLogin, onLogout, onCreateAccount }) => (
  6. <article>
  7. <Header user={user} onLogin={onLogin} onLogout={onLogout} onCreateAccount={onCreateAccount} />
  8. <section>
  9. <h2>Pages in Storybook</h2>
  10. <p>
  11. We recommend building UIs with a{' '}
  12. <a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
  13. <strong>component-driven</strong>
  14. </a>{' '}
  15. process starting with atomic components and ending with pages.
  16. </p>
  17. <p>
  18. Render pages with mock data. This makes it easy to build and review page states without
  19. needing to navigate to them in your app. Here are some handy patterns for managing page data
  20. in Storybook:
  21. </p>
  22. <ul>
  23. <li>
  24. Use a higher-level connected component. Storybook helps you compose such data from the
  25. "args" of child component stories
  26. </li>
  27. <li>
  28. Assemble data in the page component from your services. You can mock these services out
  29. using Storybook.
  30. </li>
  31. </ul>
  32. <p>
  33. Get a guided tutorial on component-driven development at{' '}
  34. <a href="https://www.learnstorybook.com" target="_blank" rel="noopener noreferrer">
  35. Learn Storybook
  36. </a>
  37. . Read more in the{' '}
  38. <a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
  39. docs
  40. </a>
  41. .
  42. </p>
  43. <div className="tip-wrapper">
  44. <span className="tip">Tip</span> Adjust the width of the canvas with the{' '}
  45. <svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
  46. <g fill="none" fillRule="evenodd">
  47. <path
  48. 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"
  49. id="a"
  50. fill="#999"
  51. />
  52. </g>
  53. </svg>
  54. Viewports addon in the toolbar
  55. </div>
  56. </section>
  57. </article>
  58. );
  59. Page.propTypes = {
  60. user: PropTypes.shape({}),
  61. onLogin: PropTypes.func.isRequired,
  62. onLogout: PropTypes.func.isRequired,
  63. onCreateAccount: PropTypes.func.isRequired,
  64. };
  65. Page.defaultProps = {
  66. user: null,
  67. };