Next.js template
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Page.jsx 2.4KB

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