@universal-tennis/ui-shared 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/.eslintrc.js +80 -0
  2. package/.storybook/main.js +16 -0
  3. package/.storybook/preview.js +9 -0
  4. package/README.md +15 -0
  5. package/dist/App.d.ts +2 -0
  6. package/dist/App.js +11 -0
  7. package/dist/App.js.map +1 -0
  8. package/dist/components.d.ts +0 -0
  9. package/dist/components.js +2 -0
  10. package/dist/components.js.map +1 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +13 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/items.d.ts +2 -0
  15. package/dist/items.js +2 -0
  16. package/dist/items.js.map +1 -0
  17. package/dist/stories/Button.d.ts +27 -0
  18. package/dist/stories/Button.js +51 -0
  19. package/dist/stories/Button.js.map +1 -0
  20. package/dist/stories/Button.stories.d.ts +15 -0
  21. package/dist/stories/Button.stories.js +34 -0
  22. package/dist/stories/Button.stories.js.map +1 -0
  23. package/dist/stories/Header.d.ts +19 -0
  24. package/dist/stories/Header.js +31 -0
  25. package/dist/stories/Header.js.map +1 -0
  26. package/dist/stories/Header.stories.d.ts +11 -0
  27. package/dist/stories/Header.stories.js +20 -0
  28. package/dist/stories/Header.stories.js.map +1 -0
  29. package/dist/stories/Page.d.ts +1 -0
  30. package/dist/stories/Page.js +38 -0
  31. package/dist/stories/Page.js.map +1 -0
  32. package/dist/stories/Page.stories.d.ts +11 -0
  33. package/dist/stories/Page.stories.js +30 -0
  34. package/dist/stories/Page.stories.js.map +1 -0
  35. package/dist/stories/assets/code-brackets.svg +1 -0
  36. package/dist/stories/assets/colors.svg +1 -0
  37. package/dist/stories/assets/comments.svg +1 -0
  38. package/dist/stories/assets/direction.svg +1 -0
  39. package/dist/stories/assets/flow.svg +1 -0
  40. package/dist/stories/assets/plugin.svg +1 -0
  41. package/dist/stories/assets/repo.svg +1 -0
  42. package/dist/stories/assets/stackalt.svg +1 -0
  43. package/package.json +78 -0
  44. package/public/favicon.ico +0 -0
  45. package/public/index.html +43 -0
  46. package/public/logo192.png +0 -0
  47. package/public/logo512.png +0 -0
  48. package/public/manifest.json +25 -0
  49. package/public/robots.txt +3 -0
  50. package/src/App.js +22 -0
  51. package/src/components.jsx +1 -0
  52. package/src/custom.d.ts +13 -0
  53. package/src/index.js +17 -0
  54. package/src/items.jsx +1 -0
  55. package/src/stories/Button.jsx +50 -0
  56. package/src/stories/Button.stories.jsx +40 -0
  57. package/src/stories/Header.jsx +57 -0
  58. package/src/stories/Header.stories.jsx +24 -0
  59. package/src/stories/Introduction.stories.mdx +211 -0
  60. package/src/stories/Page.jsx +69 -0
  61. package/src/stories/Page.stories.jsx +25 -0
  62. package/src/stories/assets/code-brackets.svg +1 -0
  63. package/src/stories/assets/colors.svg +1 -0
  64. package/src/stories/assets/comments.svg +1 -0
  65. package/src/stories/assets/direction.svg +1 -0
  66. package/src/stories/assets/flow.svg +1 -0
  67. package/src/stories/assets/plugin.svg +1 -0
  68. package/src/stories/assets/repo.svg +1 -0
  69. package/src/stories/assets/stackalt.svg +1 -0
  70. package/src/stories/button.css +30 -0
  71. package/src/stories/header.css +32 -0
  72. package/src/stories/page.css +69 -0
  73. package/tsconfig.json +24 -0
  74. package/workflows/package-release.yml +22 -0
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@universal-tennis/ui-shared",
3
+ "version": "0.0.1",
4
+ "main": "dist/items.js",
5
+ "license": "MIT",
6
+ "homepage": "https://universaltennis.com",
7
+ "dependencies": {
8
+ "@testing-library/jest-dom": "^5.16.5",
9
+ "@testing-library/react": "^13.4.0",
10
+ "@testing-library/user-event": "^13.5.0",
11
+ "copyfiles": "^2.4.1",
12
+ "cross-env": "^7.0.3",
13
+ "react": "^18.2.0",
14
+ "react-dom": "^18.2.0",
15
+ "react-scripts": "5.0.1",
16
+ "web-vitals": "^2.1.4"
17
+ },
18
+ "scripts": {
19
+ "start": "react-scripts start",
20
+ "build": "react-scripts build",
21
+ "test": "react-scripts test",
22
+ "eject": "react-scripts eject",
23
+ "storybook": "start-storybook -p 6006 -s public",
24
+ "build-storybook": "build-storybook -s public",
25
+ "publish:npm": "tsc && yarn copy-files",
26
+ "copy-files": "copyfiles -u 1 src/stories/assets/*.svg src/stories/assets/*.png src/stories/assets/*.gif src/stories/assets/css/*.css dist/",
27
+ "eslint": "npx eslint --ext .jsx,.js src --fix"
28
+ },
29
+ "eslintConfig": {
30
+ "extends": [
31
+ "react-app",
32
+ "react-app/jest"
33
+ ],
34
+ "overrides": [
35
+ {
36
+ "files": [
37
+ "**/*.stories.*"
38
+ ],
39
+ "rules": {
40
+ "import/no-anonymous-default-export": "off"
41
+ }
42
+ }
43
+ ]
44
+ },
45
+ "browserslist": {
46
+ "production": [
47
+ ">0.2%",
48
+ "not dead",
49
+ "not op_mini all"
50
+ ],
51
+ "development": [
52
+ "last 1 chrome version",
53
+ "last 1 firefox version",
54
+ "last 1 safari version"
55
+ ]
56
+ },
57
+ "devDependencies": {
58
+ "@storybook/addon-actions": "^6.5.13",
59
+ "@storybook/addon-essentials": "^6.5.13",
60
+ "@storybook/addon-interactions": "^6.5.13",
61
+ "@storybook/addon-links": "^6.5.13",
62
+ "@storybook/builder-webpack5": "^6.5.13",
63
+ "@storybook/manager-webpack5": "^6.5.13",
64
+ "@storybook/node-logger": "^6.5.13",
65
+ "@storybook/preset-create-react-app": "^4.1.2",
66
+ "@storybook/react": "^6.5.13",
67
+ "@storybook/testing-library": "^0.0.13",
68
+ "babel-plugin-named-exports-order": "^0.0.2",
69
+ "prop-types": "^15.8.1",
70
+ "webpack": "^5.75.0"
71
+ },
72
+ "description": "Shared UI components for UT",
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "git+https://bitbucket.org/universaltennis/ui-shared.git"
76
+ },
77
+ "author": "universal-tennis"
78
+ }
Binary file
@@ -0,0 +1,43 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>React App</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
Binary file
Binary file
@@ -0,0 +1,25 @@
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
@@ -0,0 +1,3 @@
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
package/src/App.js ADDED
@@ -0,0 +1,22 @@
1
+
2
+ function App() {
3
+ return (
4
+ <div className="App">
5
+ <header className="App-header">
6
+ <p>
7
+ Edit <code>src/App.js</code> and save to reload.
8
+ </p>
9
+ <a
10
+ className="App-link"
11
+ href="https://reactjs.org"
12
+ target="_blank"
13
+ rel="noopener noreferrer"
14
+ >
15
+ Learn React
16
+ </a>
17
+ </header>
18
+ </div>
19
+ );
20
+ }
21
+
22
+ export default App;
@@ -0,0 +1 @@
1
+ // add components here
@@ -0,0 +1,13 @@
1
+ declare module '*.jpg';
2
+ declare module '*.png';
3
+ declare module '*.woff2';
4
+ declare module '*.woff';
5
+ declare module '*.ttf';
6
+
7
+ declare module '*.svg' {
8
+ import React = require('react');
9
+
10
+ export const ReactComponent: React.SFC<React.SVGProps<SVGSVGElement>>;
11
+ const src: string;
12
+ export default src;
13
+ }
package/src/index.js ADDED
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import './index.css';
4
+ import App from './App';
5
+ import reportWebVitals from './reportWebVitals';
6
+
7
+ const root = ReactDOM.createRoot(document.getElementById('root'));
8
+ root.render(
9
+ <React.StrictMode>
10
+ <App />
11
+ </React.StrictMode>
12
+ );
13
+
14
+ // If you want to start measuring performance in your app, pass a function
15
+ // to log results (for example: reportWebVitals(console.log))
16
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17
+ reportWebVitals();
package/src/items.jsx ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./components');
@@ -0,0 +1,50 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import './button.css';
4
+
5
+ /**
6
+ * Primary UI component for user interaction
7
+ */
8
+ export const Button = ({ primary, backgroundColor, size, label, ...props }) => {
9
+ const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
10
+ return (
11
+ <button
12
+ type="button"
13
+ className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
14
+ style={backgroundColor && { backgroundColor }}
15
+ {...props}
16
+ >
17
+ {label}
18
+ </button>
19
+ );
20
+ };
21
+
22
+ Button.propTypes = {
23
+ /**
24
+ * Is this the principal call to action on the page?
25
+ */
26
+ primary: PropTypes.bool,
27
+ /**
28
+ * What background color to use
29
+ */
30
+ backgroundColor: PropTypes.string,
31
+ /**
32
+ * How large should the button be?
33
+ */
34
+ size: PropTypes.oneOf(['small', 'medium', 'large']),
35
+ /**
36
+ * Button contents
37
+ */
38
+ label: PropTypes.string.isRequired,
39
+ /**
40
+ * Optional click handler
41
+ */
42
+ onClick: PropTypes.func,
43
+ };
44
+
45
+ Button.defaultProps = {
46
+ backgroundColor: null,
47
+ primary: false,
48
+ size: 'medium',
49
+ onClick: undefined,
50
+ };
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+
3
+ import { Button } from './Button';
4
+
5
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
6
+ export default {
7
+ title: 'Example/Button',
8
+ component: Button,
9
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
10
+ argTypes: {
11
+ backgroundColor: { control: 'color' },
12
+ },
13
+ };
14
+
15
+ // More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
16
+ const Template = (args) => <Button {...args} />;
17
+
18
+ export const Primary = Template.bind({});
19
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
20
+ Primary.args = {
21
+ primary: true,
22
+ label: 'Button',
23
+ };
24
+
25
+ export const Secondary = Template.bind({});
26
+ Secondary.args = {
27
+ label: 'Button',
28
+ };
29
+
30
+ export const Large = Template.bind({});
31
+ Large.args = {
32
+ size: 'large',
33
+ label: 'Button',
34
+ };
35
+
36
+ export const Small = Template.bind({});
37
+ Small.args = {
38
+ size: 'small',
39
+ label: 'Button',
40
+ };
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import { Button } from './Button';
5
+ import './header.css';
6
+
7
+ export const Header = ({ user, onLogin, onLogout, onCreateAccount }) => (
8
+ <header>
9
+ <div className="wrapper">
10
+ <div>
11
+ <svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
12
+ <g fill="none" fillRule="evenodd">
13
+ <path
14
+ d="M10 0h12a10 10 0 0110 10v12a10 10 0 01-10 10H10A10 10 0 010 22V10A10 10 0 0110 0z"
15
+ fill="#FFF"
16
+ />
17
+ <path
18
+ d="M5.3 10.6l10.4 6v11.1l-10.4-6v-11zm11.4-6.2l9.7 5.5-9.7 5.6V4.4z"
19
+ fill="#555AB9"
20
+ />
21
+ <path
22
+ d="M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z"
23
+ fill="#91BAF8"
24
+ />
25
+ </g>
26
+ </svg>
27
+ <h1>Acme</h1>
28
+ </div>
29
+ <div>
30
+ {user ? (
31
+ <>
32
+ <span className="welcome">
33
+ Welcome, <b>{user.name}</b>!
34
+ </span>
35
+ <Button size="small" onClick={onLogout} label="Log out" />
36
+ </>
37
+ ) : (
38
+ <>
39
+ <Button size="small" onClick={onLogin} label="Log in" />
40
+ <Button primary size="small" onClick={onCreateAccount} label="Sign up" />
41
+ </>
42
+ )}
43
+ </div>
44
+ </div>
45
+ </header>
46
+ );
47
+
48
+ Header.propTypes = {
49
+ user: PropTypes.shape({}),
50
+ onLogin: PropTypes.func.isRequired,
51
+ onLogout: PropTypes.func.isRequired,
52
+ onCreateAccount: PropTypes.func.isRequired,
53
+ };
54
+
55
+ Header.defaultProps = {
56
+ user: null,
57
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+
3
+ import { Header } from './Header';
4
+
5
+ export default {
6
+ title: 'Example/Header',
7
+ component: Header,
8
+ parameters: {
9
+ // More on Story layout: https://storybook.js.org/docs/react/configure/story-layout
10
+ layout: 'fullscreen',
11
+ },
12
+ };
13
+
14
+ const Template = (args) => <Header {...args} />;
15
+
16
+ export const LoggedIn = Template.bind({});
17
+ LoggedIn.args = {
18
+ user: {
19
+ name: 'Jane Doe',
20
+ },
21
+ };
22
+
23
+ export const LoggedOut = Template.bind({});
24
+ LoggedOut.args = {};
@@ -0,0 +1,211 @@
1
+ import { Meta } from '@storybook/addon-docs';
2
+ import Code from './assets/code-brackets.svg';
3
+ import Colors from './assets/colors.svg';
4
+ import Comments from './assets/comments.svg';
5
+ import Direction from './assets/direction.svg';
6
+ import Flow from './assets/flow.svg';
7
+ import Plugin from './assets/plugin.svg';
8
+ import Repo from './assets/repo.svg';
9
+ import StackAlt from './assets/stackalt.svg';
10
+
11
+ <Meta title="Example/Introduction" />
12
+
13
+ <style>
14
+ {`
15
+ .subheading {
16
+ --mediumdark: '#999999';
17
+ font-weight: 900;
18
+ font-size: 13px;
19
+ color: #999;
20
+ letter-spacing: 6px;
21
+ line-height: 24px;
22
+ text-transform: uppercase;
23
+ margin-bottom: 12px;
24
+ margin-top: 40px;
25
+ }
26
+
27
+ .link-list {
28
+ display: grid;
29
+ grid-template-columns: 1fr;
30
+ grid-template-rows: 1fr 1fr;
31
+ row-gap: 10px;
32
+ }
33
+
34
+ @media (min-width: 620px) {
35
+ .link-list {
36
+ row-gap: 20px;
37
+ column-gap: 20px;
38
+ grid-template-columns: 1fr 1fr;
39
+ }
40
+ }
41
+
42
+ @media all and (-ms-high-contrast:none) {
43
+ .link-list {
44
+ display: -ms-grid;
45
+ -ms-grid-columns: 1fr 1fr;
46
+ -ms-grid-rows: 1fr 1fr;
47
+ }
48
+ }
49
+
50
+ .link-item {
51
+ display: block;
52
+ padding: 20px 30px 20px 15px;
53
+ border: 1px solid #00000010;
54
+ border-radius: 5px;
55
+ transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
56
+ color: #333333;
57
+ display: flex;
58
+ align-items: flex-start;
59
+ }
60
+
61
+ .link-item:hover {
62
+ border-color: #1EA7FD50;
63
+ transform: translate3d(0, -3px, 0);
64
+ box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
65
+ }
66
+
67
+ .link-item:active {
68
+ border-color: #1EA7FD;
69
+ transform: translate3d(0, 0, 0);
70
+ }
71
+
72
+ .link-item strong {
73
+ font-weight: 700;
74
+ display: block;
75
+ margin-bottom: 2px;
76
+ }
77
+
78
+ .link-item img {
79
+ height: 40px;
80
+ width: 40px;
81
+ margin-right: 15px;
82
+ flex: none;
83
+ }
84
+
85
+ .link-item span {
86
+ font-size: 14px;
87
+ line-height: 20px;
88
+ }
89
+
90
+ .tip {
91
+ display: inline-block;
92
+ border-radius: 1em;
93
+ font-size: 11px;
94
+ line-height: 12px;
95
+ font-weight: 700;
96
+ background: #E7FDD8;
97
+ color: #66BF3C;
98
+ padding: 4px 12px;
99
+ margin-right: 10px;
100
+ vertical-align: top;
101
+ }
102
+
103
+ .tip-wrapper {
104
+ font-size: 13px;
105
+ line-height: 20px;
106
+ margin-top: 40px;
107
+ margin-bottom: 40px;
108
+ }
109
+
110
+ .tip-wrapper code {
111
+ font-size: 12px;
112
+ display: inline-block;
113
+ }
114
+ `}
115
+ </style>
116
+
117
+ # Welcome to Storybook
118
+
119
+ Storybook helps you build UI components in isolation from your app's business logic, data, and context.
120
+ That makes it easy to develop hard-to-reach states. Save these UI states as **stories** to revisit during development, testing, or QA.
121
+
122
+ Browse example stories now by navigating to them in the sidebar.
123
+ View their code in the `stories` directory to learn how they work.
124
+ We recommend building UIs with a [**component-driven**](https://componentdriven.org) process starting with atomic components and ending with pages.
125
+
126
+ <div className="subheading">Configure</div>
127
+
128
+ <div className="link-list">
129
+ <a
130
+ className="link-item"
131
+ href="https://storybook.js.org/docs/react/addons/addon-types"
132
+ target="_blank"
133
+ >
134
+ <img src={Plugin} alt="plugin" />
135
+ <span>
136
+ <strong>Presets for popular tools</strong>
137
+ Easy setup for TypeScript, SCSS and more.
138
+ </span>
139
+ </a>
140
+ <a
141
+ className="link-item"
142
+ href="https://storybook.js.org/docs/react/configure/webpack"
143
+ target="_blank"
144
+ >
145
+ <img src={StackAlt} alt="Build" />
146
+ <span>
147
+ <strong>Build configuration</strong>
148
+ How to customize webpack and Babel
149
+ </span>
150
+ </a>
151
+ <a
152
+ className="link-item"
153
+ href="https://storybook.js.org/docs/react/configure/styling-and-css"
154
+ target="_blank"
155
+ >
156
+ <img src={Colors} alt="colors" />
157
+ <span>
158
+ <strong>Styling</strong>
159
+ How to load and configure CSS libraries
160
+ </span>
161
+ </a>
162
+ <a
163
+ className="link-item"
164
+ href="https://storybook.js.org/docs/react/get-started/setup#configure-storybook-for-your-stack"
165
+ target="_blank"
166
+ >
167
+ <img src={Flow} alt="flow" />
168
+ <span>
169
+ <strong>Data</strong>
170
+ Providers and mocking for data libraries
171
+ </span>
172
+ </a>
173
+ </div>
174
+
175
+ <div className="subheading">Learn</div>
176
+
177
+ <div className="link-list">
178
+ <a className="link-item" href="https://storybook.js.org/docs" target="_blank">
179
+ <img src={Repo} alt="repo" />
180
+ <span>
181
+ <strong>Storybook documentation</strong>
182
+ Configure, customize, and extend
183
+ </span>
184
+ </a>
185
+ <a className="link-item" href="https://storybook.js.org/tutorials/" target="_blank">
186
+ <img src={Direction} alt="direction" />
187
+ <span>
188
+ <strong>In-depth guides</strong>
189
+ Best practices from leading teams
190
+ </span>
191
+ </a>
192
+ <a className="link-item" href="https://github.com/storybookjs/storybook" target="_blank">
193
+ <img src={Code} alt="code" />
194
+ <span>
195
+ <strong>GitHub project</strong>
196
+ View the source and add issues
197
+ </span>
198
+ </a>
199
+ <a className="link-item" href="https://discord.gg/storybook" target="_blank">
200
+ <img src={Comments} alt="comments" />
201
+ <span>
202
+ <strong>Discord chat</strong>
203
+ Chat with maintainers and the community
204
+ </span>
205
+ </a>
206
+ </div>
207
+
208
+ <div className="tip-wrapper">
209
+ <span className="tip">Tip</span>Edit the Markdown in{' '}
210
+ <code>stories/Introduction.stories.mdx</code>
211
+ </div>
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+
3
+ import { Header } from './Header';
4
+ import './page.css';
5
+
6
+ export const Page = () => {
7
+ const [user, setUser] = React.useState();
8
+
9
+ return (
10
+ <article>
11
+ <Header
12
+ user={user}
13
+ onLogin={() => setUser({ name: 'Jane Doe' })}
14
+ onLogout={() => setUser(undefined)}
15
+ onCreateAccount={() => setUser({ name: 'Jane Doe' })}
16
+ />
17
+
18
+ <section>
19
+ <h2>Pages in Storybook</h2>
20
+ <p>
21
+ We recommend building UIs with a{' '}
22
+ <a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
23
+ <strong>component-driven</strong>
24
+ </a>{' '}
25
+ process starting with atomic components and ending with pages.
26
+ </p>
27
+ <p>
28
+ Render pages with mock data. This makes it easy to build and review page states without
29
+ needing to navigate to them in your app. Here are some handy patterns for managing page
30
+ data in Storybook:
31
+ </p>
32
+ <ul>
33
+ <li>
34
+ Use a higher-level connected component. Storybook helps you compose such data from the
35
+ "args" of child component stories
36
+ </li>
37
+ <li>
38
+ Assemble data in the page component from your services. You can mock these services out
39
+ using Storybook.
40
+ </li>
41
+ </ul>
42
+ <p>
43
+ Get a guided tutorial on component-driven development at{' '}
44
+ <a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
45
+ Storybook tutorials
46
+ </a>
47
+ . Read more in the{' '}
48
+ <a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
49
+ docs
50
+ </a>
51
+ .
52
+ </p>
53
+ <div className="tip-wrapper">
54
+ <span className="tip">Tip</span> Adjust the width of the canvas with the{' '}
55
+ <svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
56
+ <g fill="none" fillRule="evenodd">
57
+ <path
58
+ 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"
59
+ id="a"
60
+ fill="#999"
61
+ />
62
+ </g>
63
+ </svg>
64
+ Viewports addon in the toolbar
65
+ </div>
66
+ </section>
67
+ </article>
68
+ );
69
+ };