@cencomalls/cencob2b-storybook 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/.github/workflows/chromatic.yml +28 -0
  2. package/.github/workflows/publish.yml +22 -0
  3. package/.github/workflows/release.yml +29 -0
  4. package/.storybook/main.js +25 -0
  5. package/.storybook/preview.js +13 -0
  6. package/.yarn/install-state.gz +0 -0
  7. package/.yarn/releases/yarn-4.1.1.cjs +893 -0
  8. package/.yarnrc.yml +3 -0
  9. package/package.json +13 -59
  10. package/stories/Button.jsx +50 -0
  11. package/stories/Button.stories.js +48 -0
  12. package/stories/Configure.mdx +364 -0
  13. package/stories/Header.jsx +59 -0
  14. package/stories/Header.stories.js +28 -0
  15. package/stories/Page.jsx +69 -0
  16. package/stories/Page.stories.js +28 -0
  17. package/stories/assets/accessibility.png +0 -0
  18. package/stories/assets/accessibility.svg +5 -0
  19. package/stories/assets/addon-library.png +0 -0
  20. package/stories/assets/assets.png +0 -0
  21. package/stories/assets/avif-test-image.avif +0 -0
  22. package/stories/assets/context.png +0 -0
  23. package/stories/assets/discord.svg +15 -0
  24. package/stories/assets/docs.png +0 -0
  25. package/stories/assets/figma-plugin.png +0 -0
  26. package/stories/assets/github.svg +3 -0
  27. package/stories/assets/share.png +0 -0
  28. package/stories/assets/styling.png +0 -0
  29. package/stories/assets/testing.png +0 -0
  30. package/stories/assets/theming.png +0 -0
  31. package/stories/assets/tutorials.svg +12 -0
  32. package/stories/assets/youtube.svg +4 -0
  33. package/stories/button.css +30 -0
  34. package/stories/header.css +32 -0
  35. package/stories/page.css +69 -0
  36. package/storybook-static/assets/Button-B7GXpXHZ.js +203 -0
  37. package/storybook-static/assets/Button-BfyGbg8N.css +1 -0
  38. package/storybook-static/assets/Button.stories-Cz4ZTIw_.js +20 -0
  39. package/storybook-static/assets/Color-RQJUDNI5-r4zJMVcU.js +1 -0
  40. package/storybook-static/assets/Configure-CZVeek8t.js +173 -0
  41. package/storybook-static/assets/DocsRenderer-K4EAMTCU-Do6HWQxO.js +7 -0
  42. package/storybook-static/assets/Header-Be6lOWYO.js +1 -0
  43. package/storybook-static/assets/Header-BjLH3naM.css +1 -0
  44. package/storybook-static/assets/Header.stories-D9E6awjx.js +7 -0
  45. package/storybook-static/assets/Page-B9ntr4df.css +1 -0
  46. package/storybook-static/assets/Page.stories-DTRxRE07.js +17 -0
  47. package/storybook-static/assets/WithTooltip-Y7J54OF7-U9kDFlyj.js +1 -0
  48. package/storybook-static/assets/accessibility-W_h2acOZ.png +0 -0
  49. package/storybook-static/assets/addon-library-BWUCAmyN.png +0 -0
  50. package/storybook-static/assets/context-C0qIqeS4.png +0 -0
  51. package/storybook-static/assets/docs---vsFbMi.png +0 -0
  52. package/storybook-static/assets/entry-preview-docs-1v-OicRc.js +54 -0
  53. package/storybook-static/assets/entry-preview-kGuIN3g4.js +1 -0
  54. package/storybook-static/assets/figma-plugin-CH2hELiO.png +0 -0
  55. package/storybook-static/assets/formatter-B5HCVTEV-IqGtHqtT.js +58 -0
  56. package/storybook-static/assets/iframe-Da46mUfp.js +7 -0
  57. package/storybook-static/assets/index-BBkUAzwr.js +9 -0
  58. package/storybook-static/assets/index-BjkNUVMH.js +505 -0
  59. package/storybook-static/assets/index-Bw8VTzHM.js +1 -0
  60. package/storybook-static/assets/index-DboEQVPH.js +3 -0
  61. package/storybook-static/assets/index-DrFu-skq.js +6 -0
  62. package/storybook-static/assets/index-PqR-_bA4.js +24 -0
  63. package/storybook-static/assets/index-YMbfICiA.js +1 -0
  64. package/storybook-static/assets/index-z5U8iC57.js +1 -0
  65. package/storybook-static/assets/preview-B4GcaC1c.js +1 -0
  66. package/storybook-static/assets/preview-BAz7FMXc.js +396 -0
  67. package/storybook-static/assets/preview-BQoJvzIs.js +7 -0
  68. package/storybook-static/assets/preview-B_0crF9I.js +1 -0
  69. package/storybook-static/assets/preview-BjivwLRH.js +203 -0
  70. package/storybook-static/assets/preview-CIRcjyVj.js +1 -0
  71. package/storybook-static/assets/preview-Cv3rAi2i.js +7 -0
  72. package/storybook-static/assets/preview-CwqMn10d.js +20 -0
  73. package/storybook-static/assets/preview-Db4Idchh.js +1 -0
  74. package/storybook-static/assets/preview-DbT1mggi.js +1 -0
  75. package/storybook-static/assets/react-18-B-OKcmzb.js +1 -0
  76. package/storybook-static/assets/share-DGA-UcQf.png +0 -0
  77. package/storybook-static/assets/styling-Bk6zjRzU.png +0 -0
  78. package/storybook-static/assets/syntaxhighlighter-JOJW2KGS-Cy7bkou7.js +1 -0
  79. package/storybook-static/assets/testing-cbzR9l9r.png +0 -0
  80. package/storybook-static/assets/theming-D6WJLNoW.png +0 -0
  81. package/storybook-static/favicon.svg +7 -0
  82. package/storybook-static/iframe.html +492 -0
  83. package/storybook-static/index.html +167 -0
  84. package/storybook-static/index.json +1 -0
  85. package/storybook-static/project.json +1 -0
  86. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +323 -0
  87. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +40 -0
  88. package/storybook-static/sb-addons/essentials-actions-4/manager-bundle.js +3 -0
  89. package/storybook-static/sb-addons/essentials-actions-4/manager-bundle.js.LEGAL.txt +0 -0
  90. package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js +12 -0
  91. package/storybook-static/sb-addons/essentials-backgrounds-5/manager-bundle.js.LEGAL.txt +0 -0
  92. package/storybook-static/sb-addons/essentials-controls-3/manager-bundle.js +79 -0
  93. package/storybook-static/sb-addons/essentials-controls-3/manager-bundle.js.LEGAL.txt +28 -0
  94. package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js +3 -0
  95. package/storybook-static/sb-addons/essentials-measure-8/manager-bundle.js.LEGAL.txt +0 -0
  96. package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js +3 -0
  97. package/storybook-static/sb-addons/essentials-outline-9/manager-bundle.js.LEGAL.txt +0 -0
  98. package/storybook-static/sb-addons/essentials-toolbars-7/manager-bundle.js +3 -0
  99. package/storybook-static/sb-addons/essentials-toolbars-7/manager-bundle.js.LEGAL.txt +0 -0
  100. package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js +3 -0
  101. package/storybook-static/sb-addons/essentials-viewport-6/manager-bundle.js.LEGAL.txt +0 -0
  102. package/storybook-static/sb-addons/interactions-11/manager-bundle.js +12 -0
  103. package/storybook-static/sb-addons/interactions-11/manager-bundle.js.LEGAL.txt +0 -0
  104. package/storybook-static/sb-addons/links-2/manager-bundle.js +3 -0
  105. package/storybook-static/sb-addons/links-2/manager-bundle.js.LEGAL.txt +0 -0
  106. package/storybook-static/sb-addons/onboarding-1/manager-bundle.js +502 -0
  107. package/storybook-static/sb-addons/onboarding-1/manager-bundle.js.LEGAL.txt +0 -0
  108. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +3 -0
  109. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
  110. package/storybook-static/sb-common-assets/fonts.css +31 -0
  111. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  112. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  113. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  114. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  115. package/storybook-static/sb-manager/WithTooltip-Y7J54OF7-KHQOWZXS.js +1 -0
  116. package/storybook-static/sb-manager/chunk-3F3RRPB3.js +347 -0
  117. package/storybook-static/sb-manager/chunk-62YMTM65.js +6 -0
  118. package/storybook-static/sb-manager/chunk-AQBE2B7B.js +183 -0
  119. package/storybook-static/sb-manager/chunk-Q3RBXCN3.js +231 -0
  120. package/storybook-static/sb-manager/chunk-XP3HGWTR.js +1 -0
  121. package/storybook-static/sb-manager/chunk-YME6VNXZ.js +9 -0
  122. package/storybook-static/sb-manager/formatter-B5HCVTEV-7DCBOGO6.js +58 -0
  123. package/storybook-static/sb-manager/globals-module-info.js +1 -0
  124. package/storybook-static/sb-manager/globals-runtime.js +1 -0
  125. package/storybook-static/sb-manager/globals.js +1 -0
  126. package/storybook-static/sb-manager/index.js +1 -0
  127. package/storybook-static/sb-manager/runtime.js +1 -0
  128. package/storybook-static/sb-manager/syntaxhighlighter-JOJW2KGS-WAFIMSO6.js +1 -0
  129. package/storybook-static/sb-preview/globals.js +1 -0
  130. package/storybook-static/sb-preview/runtime.js +128 -0
  131. package/LICENSE +0 -21
  132. package/README.md +0 -90
  133. package/dist/cjs/index.js +0 -81
  134. package/dist/cjs/index.js.map +0 -1
  135. package/dist/esm/index.js +0 -81
  136. package/dist/esm/index.js.map +0 -1
package/.yarnrc.yml ADDED
@@ -0,0 +1,3 @@
1
+ nodeLinker: node-modules
2
+
3
+ yarnPath: .yarn/releases/yarn-4.1.1.cjs
package/package.json CHANGED
@@ -1,79 +1,33 @@
1
1
  {
2
2
  "name": "@cencomalls/cencob2b-storybook",
3
- "version": "0.1.0",
4
- "private": false,
5
- "main": "dist/cjs/index.js",
6
- "module": "dist/esm/index.js",
7
- "files": [
8
- "dist/**/*",
9
- "README.md"
10
- ],
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "repository": "git@github.com:shopping-cencosud/cencob2b-storybook.git",
6
+ "author": "Jonas <jbrionestecnico@gmail.com>",
11
7
  "license": "MIT",
12
- "scripts": {
13
- "build": "rollup -c --bundleConfigAsCjs",
14
- "watch": "rollup --watch -c --bundleConfigAsCjs",
15
- "clean": "rimraf ./dist",
16
- "prebuild": "yarn clean",
17
- "release": "yarn build && auto shipit",
18
- "test": "echo \"Error: no test specified\" && exit 1",
19
- "storybook": "storybook dev -p 6006",
20
- "build-storybook": "storybook build"
8
+ "dependencies": {
9
+ "react": "^18.2.0",
10
+ "react-dom": "^18.2.0"
21
11
  },
22
12
  "devDependencies": {
23
- "@babel/core": "^7.22.5",
24
- "@babel/preset-env": "^7.21.5",
25
- "@babel/preset-react": "^7.18.6",
26
- "@babel/preset-typescript": "^7.21.5",
27
13
  "@chromatic-com/storybook": "^1.2.18",
28
- "@emotion/babel-plugin": "^11.11.0",
29
- "@emotion/react": "^11.11.1",
30
- "@emotion/styled": "^11.11.0",
31
- "@rollup/plugin-babel": "^6.0.3",
32
- "@rollup/plugin-commonjs": "^24.1.0",
33
- "@rollup/plugin-node-resolve": "^15.0.2",
34
- "@rollup/plugin-terser": "^0.4.3",
35
14
  "@storybook/addon-essentials": "^8.0.0",
36
15
  "@storybook/addon-interactions": "^8.0.0",
37
16
  "@storybook/addon-links": "^8.0.0",
38
17
  "@storybook/addon-onboarding": "^8.0.0",
39
18
  "@storybook/blocks": "^8.0.0",
19
+ "@storybook/builder-vite": "^8.0.0",
40
20
  "@storybook/react": "^8.0.0",
41
21
  "@storybook/react-vite": "^8.0.0",
42
22
  "@storybook/test": "^8.0.0",
43
- "@vitejs/plugin-react": "^3.1.0",
44
- "auto": "^10.3.0",
45
- "boxen": "^5.0.1",
46
- "dedent": "^0.7.0",
47
- "npm-run-all": "^4.1.5",
48
- "polished": "^4.2.2",
49
- "prettier": "^2.8.8",
23
+ "chromatic": "^11.0.8",
50
24
  "prop-types": "^15.8.1",
51
- "react": "^18.0.0",
52
- "react-dom": "^18.0.0",
53
- "rimraf": "^3.0.2",
54
- "rollup": "^3.25.0",
55
- "rollup-plugin-dts": "^5.3.0",
56
- "rollup-plugin-peer-deps-external": "^2.2.4",
57
25
  "storybook": "^8.0.0",
58
- "vite": "^4.1.4",
59
- "zx": "^1.14.1"
60
- },
61
- "peerDependencies": {
62
- "@emotion/react": "^11.11.1",
63
- "@emotion/styled": "^11.11.0",
64
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
65
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
26
+ "vite": "^5.1.6"
66
27
  },
67
- "peerDependenciesMeta": {
68
- "react": {
69
- "optional": true
70
- },
71
- "react-dom": {
72
- "optional": true
73
- }
74
- },
75
- "resolutions": {
76
- "jackspeak": "2.1.1"
28
+ "scripts": {
29
+ "storybook": "storybook dev -p 6006",
30
+ "build-storybook": "storybook build"
77
31
  },
78
32
  "packageManager": "yarn@4.1.1"
79
33
  }
@@ -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,48 @@
1
+ import { fn } from '@storybook/test';
2
+ import { Button } from './Button';
3
+
4
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
5
+ export default {
6
+ title: 'Example/Button',
7
+ component: Button,
8
+ parameters: {
9
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
10
+ layout: 'centered',
11
+ },
12
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
13
+ tags: ['autodocs'],
14
+ // More on argTypes: https://storybook.js.org/docs/api/argtypes
15
+ argTypes: {
16
+ backgroundColor: { control: 'color' },
17
+ },
18
+ // Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
19
+ args: { onClick: fn() },
20
+ };
21
+
22
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
23
+ export const Primary = {
24
+ args: {
25
+ primary: true,
26
+ label: 'Button',
27
+ },
28
+ };
29
+
30
+ export const Secondary = {
31
+ args: {
32
+ label: 'Button',
33
+ },
34
+ };
35
+
36
+ export const Large = {
37
+ args: {
38
+ size: 'large',
39
+ label: 'Button',
40
+ },
41
+ };
42
+
43
+ export const Small = {
44
+ args: {
45
+ size: 'small',
46
+ label: 'Button',
47
+ },
48
+ };
@@ -0,0 +1,364 @@
1
+ import { Meta } from "@storybook/blocks";
2
+
3
+ import Github from "./assets/github.svg";
4
+ import Discord from "./assets/discord.svg";
5
+ import Youtube from "./assets/youtube.svg";
6
+ import Tutorials from "./assets/tutorials.svg";
7
+ import Styling from "./assets/styling.png";
8
+ import Context from "./assets/context.png";
9
+ import Assets from "./assets/assets.png";
10
+ import Docs from "./assets/docs.png";
11
+ import Share from "./assets/share.png";
12
+ import FigmaPlugin from "./assets/figma-plugin.png";
13
+ import Testing from "./assets/testing.png";
14
+ import Accessibility from "./assets/accessibility.png";
15
+ import Theming from "./assets/theming.png";
16
+ import AddonLibrary from "./assets/addon-library.png";
17
+
18
+ export const RightArrow = () => <svg
19
+ viewBox="0 0 14 14"
20
+ width="8px"
21
+ height="14px"
22
+ style={{
23
+ marginLeft: '4px',
24
+ display: 'inline-block',
25
+ shapeRendering: 'inherit',
26
+ verticalAlign: 'middle',
27
+ fill: 'currentColor',
28
+ 'path fill': 'currentColor'
29
+ }}
30
+ >
31
+ <path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
32
+ </svg>
33
+
34
+ <Meta title="Configure your project" />
35
+
36
+ <div className="sb-container">
37
+ <div className='sb-section-title'>
38
+ # Configure your project
39
+
40
+ Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community.
41
+ </div>
42
+ <div className="sb-section">
43
+ <div className="sb-section-item">
44
+ <img
45
+ src={Styling}
46
+ alt="A wall of logos representing different styling technologies"
47
+ />
48
+ <h4 className="sb-section-item-heading">Add styling and CSS</h4>
49
+ <p className="sb-section-item-paragraph">Like with web applications, there are many ways to include CSS within Storybook. Learn more about setting up styling within Storybook.</p>
50
+ <a
51
+ href="https://storybook.js.org/docs/react/configure/styling-and-css"
52
+ target="_blank"
53
+ >Learn more<RightArrow /></a>
54
+ </div>
55
+ <div className="sb-section-item">
56
+ <img
57
+ src={Context}
58
+ alt="An abstraction representing the composition of data for a component"
59
+ />
60
+ <h4 className="sb-section-item-heading">Provide context and mocking</h4>
61
+ <p className="sb-section-item-paragraph">Often when a story doesn't render, it's because your component is expecting a specific environment or context (like a theme provider) to be available.</p>
62
+ <a
63
+ href="https://storybook.js.org/docs/react/writing-stories/decorators#context-for-mocking"
64
+ target="_blank"
65
+ >Learn more<RightArrow /></a>
66
+ </div>
67
+ <div className="sb-section-item">
68
+ <img src={Assets} alt="A representation of typography and image assets" />
69
+ <div>
70
+ <h4 className="sb-section-item-heading">Load assets and resources</h4>
71
+ <p className="sb-section-item-paragraph">To link static files (like fonts) to your projects and stories, use the
72
+ `staticDirs` configuration option to specify folders to load when
73
+ starting Storybook.</p>
74
+ <a
75
+ href="https://storybook.js.org/docs/react/configure/images-and-assets"
76
+ target="_blank"
77
+ >Learn more<RightArrow /></a>
78
+ </div>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ <div className="sb-container">
83
+ <div className='sb-section-title'>
84
+ # Do more with Storybook
85
+
86
+ Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs.
87
+ </div>
88
+
89
+ <div className="sb-section">
90
+ <div className="sb-features-grid">
91
+ <div className="sb-grid-item">
92
+ <img src={Docs} alt="A screenshot showing the autodocs tag being set, pointing a docs page being generated" />
93
+ <h4 className="sb-section-item-heading">Autodocs</h4>
94
+ <p className="sb-section-item-paragraph">Auto-generate living,
95
+ interactive reference documentation from your components and stories.</p>
96
+ <a
97
+ href="https://storybook.js.org/docs/react/writing-docs/autodocs"
98
+ target="_blank"
99
+ >Learn more<RightArrow /></a>
100
+ </div>
101
+ <div className="sb-grid-item">
102
+ <img src={Share} alt="A browser window showing a Storybook being published to a chromatic.com URL" />
103
+ <h4 className="sb-section-item-heading">Publish to Chromatic</h4>
104
+ <p className="sb-section-item-paragraph">Publish your Storybook to review and collaborate with your entire team.</p>
105
+ <a
106
+ href="https://storybook.js.org/docs/react/sharing/publish-storybook#publish-storybook-with-chromatic"
107
+ target="_blank"
108
+ >Learn more<RightArrow /></a>
109
+ </div>
110
+ <div className="sb-grid-item">
111
+ <img src={FigmaPlugin} alt="Windows showing the Storybook plugin in Figma" />
112
+ <h4 className="sb-section-item-heading">Figma Plugin</h4>
113
+ <p className="sb-section-item-paragraph">Embed your stories into Figma to cross-reference the design and live
114
+ implementation in one place.</p>
115
+ <a
116
+ href="https://storybook.js.org/docs/react/sharing/design-integrations#embed-storybook-in-figma-with-the-plugin"
117
+ target="_blank"
118
+ >Learn more<RightArrow /></a>
119
+ </div>
120
+ <div className="sb-grid-item">
121
+ <img src={Testing} alt="Screenshot of tests passing and failing" />
122
+ <h4 className="sb-section-item-heading">Testing</h4>
123
+ <p className="sb-section-item-paragraph">Use stories to test a component in all its variations, no matter how
124
+ complex.</p>
125
+ <a
126
+ href="https://storybook.js.org/docs/react/writing-tests"
127
+ target="_blank"
128
+ >Learn more<RightArrow /></a>
129
+ </div>
130
+ <div className="sb-grid-item">
131
+ <img src={Accessibility} alt="Screenshot of accessibility tests passing and failing" />
132
+ <h4 className="sb-section-item-heading">Accessibility</h4>
133
+ <p className="sb-section-item-paragraph">Automatically test your components for a11y issues as you develop.</p>
134
+ <a
135
+ href="https://storybook.js.org/docs/react/writing-tests/accessibility-testing"
136
+ target="_blank"
137
+ >Learn more<RightArrow /></a>
138
+ </div>
139
+ <div className="sb-grid-item">
140
+ <img src={Theming} alt="Screenshot of Storybook in light and dark mode" />
141
+ <h4 className="sb-section-item-heading">Theming</h4>
142
+ <p className="sb-section-item-paragraph">Theme Storybook's UI to personalize it to your project.</p>
143
+ <a
144
+ href="https://storybook.js.org/docs/react/configure/theming"
145
+ target="_blank"
146
+ >Learn more<RightArrow /></a>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </div>
151
+ <div className='sb-addon'>
152
+ <div className='sb-addon-text'>
153
+ <h4>Addons</h4>
154
+ <p className="sb-section-item-paragraph">Integrate your tools with Storybook to connect workflows.</p>
155
+ <a
156
+ href="https://storybook.js.org/integrations/"
157
+ target="_blank"
158
+ >Discover all addons<RightArrow /></a>
159
+ </div>
160
+ <div className='sb-addon-img'>
161
+ <img src={AddonLibrary} alt="Integrate your tools with Storybook to connect workflows." />
162
+ </div>
163
+ </div>
164
+
165
+ <div className="sb-section sb-socials">
166
+ <div className="sb-section-item">
167
+ <img src={Github} alt="Github logo" className="sb-explore-image"/>
168
+ Join our contributors building the future of UI development.
169
+
170
+ <a
171
+ href="https://github.com/storybookjs/storybook"
172
+ target="_blank"
173
+ >Star on GitHub<RightArrow /></a>
174
+ </div>
175
+ <div className="sb-section-item">
176
+ <img src={Discord} alt="Discord logo" className="sb-explore-image"/>
177
+ <div>
178
+ Get support and chat with frontend developers.
179
+
180
+ <a
181
+ href="https://discord.gg/storybook"
182
+ target="_blank"
183
+ >Join Discord server<RightArrow /></a>
184
+ </div>
185
+ </div>
186
+ <div className="sb-section-item">
187
+ <img src={Youtube} alt="Youtube logo" className="sb-explore-image"/>
188
+ <div>
189
+ Watch tutorials, feature previews and interviews.
190
+
191
+ <a
192
+ href="https://www.youtube.com/@chromaticui"
193
+ target="_blank"
194
+ >Watch on YouTube<RightArrow /></a>
195
+ </div>
196
+ </div>
197
+ <div className="sb-section-item">
198
+ <img src={Tutorials} alt="A book" className="sb-explore-image"/>
199
+ <p>Follow guided walkthroughs on for key workflows.</p>
200
+
201
+ <a
202
+ href="https://storybook.js.org/tutorials/"
203
+ target="_blank"
204
+ >Discover tutorials<RightArrow /></a>
205
+ </div>
206
+ </div>
207
+
208
+ <style>
209
+ {`
210
+ .sb-container {
211
+ margin-bottom: 48px;
212
+ }
213
+
214
+ .sb-section {
215
+ width: 100%;
216
+ display: flex;
217
+ flex-direction: row;
218
+ gap: 20px;
219
+ }
220
+
221
+ img {
222
+ object-fit: cover;
223
+ }
224
+
225
+ .sb-section-title {
226
+ margin-bottom: 32px;
227
+ }
228
+
229
+ .sb-section a:not(h1 a, h2 a, h3 a) {
230
+ font-size: 14px;
231
+ }
232
+
233
+ .sb-section-item, .sb-grid-item {
234
+ flex: 1;
235
+ display: flex;
236
+ flex-direction: column;
237
+ }
238
+
239
+ .sb-section-item-heading {
240
+ padding-top: 20px !important;
241
+ padding-bottom: 5px !important;
242
+ margin: 0 !important;
243
+ }
244
+ .sb-section-item-paragraph {
245
+ margin: 0;
246
+ padding-bottom: 10px;
247
+ }
248
+
249
+ .sb-chevron {
250
+ margin-left: 5px;
251
+ }
252
+
253
+ .sb-features-grid {
254
+ display: grid;
255
+ grid-template-columns: repeat(2, 1fr);
256
+ grid-gap: 32px 20px;
257
+ }
258
+
259
+ .sb-socials {
260
+ display: grid;
261
+ grid-template-columns: repeat(4, 1fr);
262
+ }
263
+
264
+ .sb-socials p {
265
+ margin-bottom: 10px;
266
+ }
267
+
268
+ .sb-explore-image {
269
+ max-height: 32px;
270
+ align-self: flex-start;
271
+ }
272
+
273
+ .sb-addon {
274
+ width: 100%;
275
+ display: flex;
276
+ align-items: center;
277
+ position: relative;
278
+ background-color: #EEF3F8;
279
+ border-radius: 5px;
280
+ border: 1px solid rgba(0, 0, 0, 0.05);
281
+ background: #EEF3F8;
282
+ height: 180px;
283
+ margin-bottom: 48px;
284
+ overflow: hidden;
285
+ }
286
+
287
+ .sb-addon-text {
288
+ padding-left: 48px;
289
+ max-width: 240px;
290
+ }
291
+
292
+ .sb-addon-text h4 {
293
+ padding-top: 0px;
294
+ }
295
+
296
+ .sb-addon-img {
297
+ position: absolute;
298
+ left: 345px;
299
+ top: 0;
300
+ height: 100%;
301
+ width: 200%;
302
+ overflow: hidden;
303
+ }
304
+
305
+ .sb-addon-img img {
306
+ width: 650px;
307
+ transform: rotate(-15deg);
308
+ margin-left: 40px;
309
+ margin-top: -72px;
310
+ box-shadow: 0 0 1px rgba(255, 255, 255, 0);
311
+ backface-visibility: hidden;
312
+ }
313
+
314
+ @media screen and (max-width: 800px) {
315
+ .sb-addon-img {
316
+ left: 300px;
317
+ }
318
+ }
319
+
320
+ @media screen and (max-width: 600px) {
321
+ .sb-section {
322
+ flex-direction: column;
323
+ }
324
+
325
+ .sb-features-grid {
326
+ grid-template-columns: repeat(1, 1fr);
327
+ }
328
+
329
+ .sb-socials {
330
+ grid-template-columns: repeat(2, 1fr);
331
+ }
332
+
333
+ .sb-addon {
334
+ height: 280px;
335
+ align-items: flex-start;
336
+ padding-top: 32px;
337
+ overflow: hidden;
338
+ }
339
+
340
+ .sb-addon-text {
341
+ padding-left: 24px;
342
+ }
343
+
344
+ .sb-addon-img {
345
+ right: 0;
346
+ left: 0;
347
+ top: 130px;
348
+ bottom: 0;
349
+ overflow: hidden;
350
+ height: auto;
351
+ width: 124%;
352
+ }
353
+
354
+ .sb-addon-img img {
355
+ width: 1200px;
356
+ transform: rotate(-12deg);
357
+ margin-left: 0;
358
+ margin-top: 48px;
359
+ margin-bottom: -40px;
360
+ margin-left: -24px;
361
+ }
362
+ }
363
+ `}
364
+ </style>
@@ -0,0 +1,59 @@
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="storybook-header">
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
+ name: PropTypes.string.isRequired,
51
+ }),
52
+ onLogin: PropTypes.func.isRequired,
53
+ onLogout: PropTypes.func.isRequired,
54
+ onCreateAccount: PropTypes.func.isRequired,
55
+ };
56
+
57
+ Header.defaultProps = {
58
+ user: null,
59
+ };
@@ -0,0 +1,28 @@
1
+ import { Header } from './Header';
2
+ import { fn } from '@storybook/test';
3
+
4
+ export default {
5
+ title: 'Example/Header',
6
+ component: Header,
7
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
11
+ layout: 'fullscreen',
12
+ },
13
+ args: {
14
+ onLogin: fn(),
15
+ onLogout: fn(),
16
+ onCreateAccount: fn(),
17
+ },
18
+ };
19
+
20
+ export const LoggedIn = {
21
+ args: {
22
+ user: {
23
+ name: 'Jane Doe',
24
+ },
25
+ },
26
+ };
27
+
28
+ export const LoggedOut = {};