@storybook/experimental-nextjs-vite 0.0.0-pr-28768-sha-4bf04455
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +10 -0
- package/dist/chunk-4N4PSHX6.mjs +3 -0
- package/dist/chunk-DWCMLBIB.mjs +20 -0
- package/dist/chunk-GKRSUUNG.mjs +6 -0
- package/dist/export-mocks/cache/index.d.ts +14 -0
- package/dist/export-mocks/cache/index.js +1 -0
- package/dist/export-mocks/cache/index.mjs +6 -0
- package/dist/export-mocks/headers/index.d.ts +36 -0
- package/dist/export-mocks/headers/index.js +1 -0
- package/dist/export-mocks/headers/index.mjs +10 -0
- package/dist/export-mocks/navigation/index.d.ts +42 -0
- package/dist/export-mocks/navigation/index.js +1 -0
- package/dist/export-mocks/navigation/index.mjs +11 -0
- package/dist/export-mocks/router/index.d.ts +46 -0
- package/dist/export-mocks/router/index.js +1 -0
- package/dist/export-mocks/router/index.mjs +10 -0
- package/dist/images/decorator.d.ts +6 -0
- package/dist/images/decorator.js +1 -0
- package/dist/images/decorator.mjs +2 -0
- package/dist/index.d-5a935e77.d.ts +266 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +10 -0
- package/dist/preset.d.ts +8 -0
- package/dist/preset.js +1 -0
- package/dist/preview.d.ts +18 -0
- package/dist/preview.js +1 -0
- package/dist/preview.mjs +3 -0
- package/dist/react-18-E7XCW3XF.mjs +7 -0
- package/package.json +143 -0
- package/preset.js +1 -0
- package/template/cli/.eslintrc.json +7 -0
- package/template/cli/js/Button.jsx +56 -0
- package/template/cli/js/Button.stories.js +49 -0
- package/template/cli/js/Configure.mdx +446 -0
- package/template/cli/js/Header.jsx +60 -0
- package/template/cli/js/Header.stories.js +30 -0
- package/template/cli/js/Page.jsx +68 -0
- package/template/cli/js/Page.stories.js +28 -0
- package/template/cli/ts-3-8/Button.stories.ts +53 -0
- package/template/cli/ts-3-8/Button.tsx +53 -0
- package/template/cli/ts-3-8/Configure.mdx +446 -0
- package/template/cli/ts-3-8/Header.stories.ts +33 -0
- package/template/cli/ts-3-8/Header.tsx +56 -0
- package/template/cli/ts-3-8/Page.stories.ts +32 -0
- package/template/cli/ts-3-8/Page.tsx +73 -0
- package/template/cli/ts-4-9/Button.stories.ts +53 -0
- package/template/cli/ts-4-9/Button.tsx +53 -0
- package/template/cli/ts-4-9/Configure.mdx +446 -0
- package/template/cli/ts-4-9/Header.stories.ts +33 -0
- package/template/cli/ts-4-9/Header.tsx +56 -0
- package/template/cli/ts-4-9/Page.stories.ts +32 -0
- package/template/cli/ts-4-9/Page.tsx +73 -0
- package/template/next-env.d.ts +7 -0
- package/template/typings.d.ts +14 -0
@@ -0,0 +1,68 @@
|
|
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
|
+
<section className="storybook-page">
|
18
|
+
<h2>Pages in Storybook</h2>
|
19
|
+
<p>
|
20
|
+
We recommend building UIs with a{' '}
|
21
|
+
<a href="https://componentdriven.org" target="_blank" rel="noopener noreferrer">
|
22
|
+
<strong>component-driven</strong>
|
23
|
+
</a>{' '}
|
24
|
+
process starting with atomic components and ending with pages.
|
25
|
+
</p>
|
26
|
+
<p>
|
27
|
+
Render pages with mock data. This makes it easy to build and review page states without
|
28
|
+
needing to navigate to them in your app. Here are some handy patterns for managing page
|
29
|
+
data in Storybook:
|
30
|
+
</p>
|
31
|
+
<ul>
|
32
|
+
<li>
|
33
|
+
Use a higher-level connected component. Storybook helps you compose such data from the
|
34
|
+
"args" of child component stories
|
35
|
+
</li>
|
36
|
+
<li>
|
37
|
+
Assemble data in the page component from your services. You can mock these services out
|
38
|
+
using Storybook.
|
39
|
+
</li>
|
40
|
+
</ul>
|
41
|
+
<p>
|
42
|
+
Get a guided tutorial on component-driven development at{' '}
|
43
|
+
<a href="https://storybook.js.org/tutorials/" target="_blank" rel="noopener noreferrer">
|
44
|
+
Storybook tutorials
|
45
|
+
</a>
|
46
|
+
. Read more in the{' '}
|
47
|
+
<a href="https://storybook.js.org/docs" target="_blank" rel="noopener noreferrer">
|
48
|
+
docs
|
49
|
+
</a>
|
50
|
+
.
|
51
|
+
</p>
|
52
|
+
<div className="tip-wrapper">
|
53
|
+
<span className="tip">Tip</span> Adjust the width of the canvas with the{' '}
|
54
|
+
<svg width="10" height="10" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg">
|
55
|
+
<g fill="none" fillRule="evenodd">
|
56
|
+
<path
|
57
|
+
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"
|
58
|
+
id="a"
|
59
|
+
fill="#999"
|
60
|
+
/>
|
61
|
+
</g>
|
62
|
+
</svg>
|
63
|
+
Viewports addon in the toolbar
|
64
|
+
</div>
|
65
|
+
</section>
|
66
|
+
</article>
|
67
|
+
);
|
68
|
+
};
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { expect, userEvent, within } from '@storybook/test';
|
2
|
+
|
3
|
+
import { Page } from './Page';
|
4
|
+
|
5
|
+
export default {
|
6
|
+
title: 'Example/Page',
|
7
|
+
component: Page,
|
8
|
+
parameters: {
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
10
|
+
layout: 'fullscreen',
|
11
|
+
},
|
12
|
+
};
|
13
|
+
|
14
|
+
export const LoggedOut = {};
|
15
|
+
|
16
|
+
// More on interaction testing: https://storybook.js.org/docs/writing-tests/interaction-testing
|
17
|
+
export const LoggedIn = {
|
18
|
+
play: async ({ canvasElement }) => {
|
19
|
+
const canvas = within(canvasElement);
|
20
|
+
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
21
|
+
await expect(loginButton).toBeInTheDocument();
|
22
|
+
await userEvent.click(loginButton);
|
23
|
+
await expect(loginButton).not.toBeInTheDocument();
|
24
|
+
|
25
|
+
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
26
|
+
await expect(logoutButton).toBeInTheDocument();
|
27
|
+
},
|
28
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import { fn } from '@storybook/test';
|
3
|
+
|
4
|
+
import { Button } from './Button';
|
5
|
+
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
7
|
+
const meta: Meta<typeof Button> = {
|
8
|
+
title: 'Example/Button',
|
9
|
+
component: Button,
|
10
|
+
parameters: {
|
11
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
12
|
+
layout: 'centered',
|
13
|
+
},
|
14
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
15
|
+
tags: ['autodocs'],
|
16
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
17
|
+
argTypes: {
|
18
|
+
backgroundColor: { control: 'color' },
|
19
|
+
},
|
20
|
+
// 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
|
21
|
+
args: { onClick: fn() },
|
22
|
+
};
|
23
|
+
|
24
|
+
export default meta;
|
25
|
+
type Story = StoryObj<typeof Button>;
|
26
|
+
|
27
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
28
|
+
export const Primary: Story = {
|
29
|
+
args: {
|
30
|
+
primary: true,
|
31
|
+
label: 'Button',
|
32
|
+
},
|
33
|
+
};
|
34
|
+
|
35
|
+
export const Secondary: Story = {
|
36
|
+
args: {
|
37
|
+
label: 'Button',
|
38
|
+
},
|
39
|
+
};
|
40
|
+
|
41
|
+
export const Large: Story = {
|
42
|
+
args: {
|
43
|
+
size: 'large',
|
44
|
+
label: 'Button',
|
45
|
+
},
|
46
|
+
};
|
47
|
+
|
48
|
+
export const Small: Story = {
|
49
|
+
args: {
|
50
|
+
size: 'small',
|
51
|
+
label: 'Button',
|
52
|
+
},
|
53
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
import './button.css';
|
4
|
+
|
5
|
+
export interface ButtonProps {
|
6
|
+
/**
|
7
|
+
* Is this the principal call to action on the page?
|
8
|
+
*/
|
9
|
+
primary?: boolean;
|
10
|
+
/**
|
11
|
+
* What background color to use
|
12
|
+
*/
|
13
|
+
backgroundColor?: string;
|
14
|
+
/**
|
15
|
+
* How large should the button be?
|
16
|
+
*/
|
17
|
+
size?: 'small' | 'medium' | 'large';
|
18
|
+
/**
|
19
|
+
* Button contents
|
20
|
+
*/
|
21
|
+
label: string;
|
22
|
+
/**
|
23
|
+
* Optional click handler
|
24
|
+
*/
|
25
|
+
onClick?: () => void;
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Primary UI component for user interaction
|
30
|
+
*/
|
31
|
+
export const Button = ({
|
32
|
+
primary = false,
|
33
|
+
size = 'medium',
|
34
|
+
backgroundColor,
|
35
|
+
label,
|
36
|
+
...props
|
37
|
+
}: ButtonProps) => {
|
38
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
39
|
+
return (
|
40
|
+
<button
|
41
|
+
type="button"
|
42
|
+
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
43
|
+
{...props}
|
44
|
+
>
|
45
|
+
{label}
|
46
|
+
<style jsx>{`
|
47
|
+
button {
|
48
|
+
background-color: ${backgroundColor};
|
49
|
+
}
|
50
|
+
`}</style>
|
51
|
+
</button>
|
52
|
+
);
|
53
|
+
};
|
@@ -0,0 +1,446 @@
|
|
1
|
+
import { Meta } from "@storybook/blocks";
|
2
|
+
import Image from "next/image";
|
3
|
+
|
4
|
+
import Github from "./assets/github.svg";
|
5
|
+
import Discord from "./assets/discord.svg";
|
6
|
+
import Youtube from "./assets/youtube.svg";
|
7
|
+
import Tutorials from "./assets/tutorials.svg";
|
8
|
+
import Styling from "./assets/styling.png";
|
9
|
+
import Context from "./assets/context.png";
|
10
|
+
import Assets from "./assets/assets.png";
|
11
|
+
import Docs from "./assets/docs.png";
|
12
|
+
import Share from "./assets/share.png";
|
13
|
+
import FigmaPlugin from "./assets/figma-plugin.png";
|
14
|
+
import Testing from "./assets/testing.png";
|
15
|
+
import Accessibility from "./assets/accessibility.png";
|
16
|
+
import Theming from "./assets/theming.png";
|
17
|
+
import AddonLibrary from "./assets/addon-library.png";
|
18
|
+
|
19
|
+
export const RightArrow = () => <svg
|
20
|
+
viewBox="0 0 14 14"
|
21
|
+
width="8px"
|
22
|
+
height="14px"
|
23
|
+
style={{
|
24
|
+
marginLeft: '4px',
|
25
|
+
display: 'inline-block',
|
26
|
+
shapeRendering: 'inherit',
|
27
|
+
verticalAlign: 'middle',
|
28
|
+
fill: 'currentColor',
|
29
|
+
'path fill': 'currentColor'
|
30
|
+
}}
|
31
|
+
>
|
32
|
+
<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" />
|
33
|
+
</svg>
|
34
|
+
|
35
|
+
<Meta title="Configure your project" />
|
36
|
+
|
37
|
+
<div className="sb-container">
|
38
|
+
<div className='sb-section-title'>
|
39
|
+
# Configure your project
|
40
|
+
|
41
|
+
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.
|
42
|
+
</div>
|
43
|
+
<div className="sb-section">
|
44
|
+
<div className="sb-section-item">
|
45
|
+
<Image
|
46
|
+
src={Styling}
|
47
|
+
alt="A wall of logos representing different styling technologies"
|
48
|
+
width={0}
|
49
|
+
height={0}
|
50
|
+
style={{ width: '100%', height: 'auto' }}
|
51
|
+
/>
|
52
|
+
<h4 className="sb-section-item-heading">Add styling and CSS</h4>
|
53
|
+
<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>
|
54
|
+
<a
|
55
|
+
href="https://storybook.js.org/docs/configure/styling-and-css/?renderer=react"
|
56
|
+
target="_blank"
|
57
|
+
>Learn more<RightArrow /></a>
|
58
|
+
</div>
|
59
|
+
<div className="sb-section-item">
|
60
|
+
<Image
|
61
|
+
width={0}
|
62
|
+
height={0}
|
63
|
+
style={{ width: '100%', height: 'auto' }}
|
64
|
+
src={Context}
|
65
|
+
alt="An abstraction representing the composition of data for a component"
|
66
|
+
/>
|
67
|
+
<h4 className="sb-section-item-heading">Provide context and mocking</h4>
|
68
|
+
<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>
|
69
|
+
<a
|
70
|
+
href="https://storybook.js.org/docs/writing-stories/decorators/?renderer=react#context-for-mocking"
|
71
|
+
target="_blank"
|
72
|
+
>Learn more<RightArrow /></a>
|
73
|
+
</div>
|
74
|
+
<div className="sb-section-item">
|
75
|
+
<Image
|
76
|
+
width={0}
|
77
|
+
height={0}
|
78
|
+
style={{ width: '100%', height: 'auto' }}
|
79
|
+
src={Assets}
|
80
|
+
alt="A representation of typography and image assets"
|
81
|
+
/>
|
82
|
+
<div>
|
83
|
+
<h4 className="sb-section-item-heading">Load assets and resources</h4>
|
84
|
+
<p className="sb-section-item-paragraph">To link static files (like fonts) to your projects and stories, use the
|
85
|
+
`staticDirs` configuration option to specify folders to load when
|
86
|
+
starting Storybook.</p>
|
87
|
+
<a
|
88
|
+
href="https://storybook.js.org/docs/configure/images-and-assets/?renderer=react"
|
89
|
+
target="_blank"
|
90
|
+
>Learn more<RightArrow /></a>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div className="sb-container">
|
96
|
+
<div className='sb-section-title'>
|
97
|
+
# Do more with Storybook
|
98
|
+
|
99
|
+
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.
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<div className="sb-section">
|
103
|
+
<div className="sb-features-grid">
|
104
|
+
<div className="sb-grid-item">
|
105
|
+
<Image
|
106
|
+
width={0}
|
107
|
+
height={0}
|
108
|
+
style={{ width: '100%', height: 'auto' }}
|
109
|
+
src={Docs}
|
110
|
+
alt="A screenshot showing the autodocs tag being set, pointing a docs page being generated"
|
111
|
+
/>
|
112
|
+
<h4 className="sb-section-item-heading">Autodocs</h4>
|
113
|
+
<p className="sb-section-item-paragraph">Auto-generate living,
|
114
|
+
interactive reference documentation from your components and stories.</p>
|
115
|
+
<a
|
116
|
+
href="https://storybook.js.org/docs/writing-docs/autodocs/?renderer=react"
|
117
|
+
target="_blank"
|
118
|
+
>Learn more<RightArrow /></a>
|
119
|
+
</div>
|
120
|
+
<div className="sb-grid-item">
|
121
|
+
<Image
|
122
|
+
width={0}
|
123
|
+
height={0}
|
124
|
+
style={{ width: '100%', height: 'auto' }}
|
125
|
+
src={Share}
|
126
|
+
alt="A browser window showing a Storybook being published to a chromatic.com URL"
|
127
|
+
/>
|
128
|
+
<h4 className="sb-section-item-heading">Publish to Chromatic</h4>
|
129
|
+
<p className="sb-section-item-paragraph">Publish your Storybook to review and collaborate with your entire team.</p>
|
130
|
+
<a
|
131
|
+
href="https://storybook.js.org/docs/sharing/publish-storybook/?renderer=react#publish-storybook-with-chromatic"
|
132
|
+
target="_blank"
|
133
|
+
>Learn more<RightArrow /></a>
|
134
|
+
</div>
|
135
|
+
<div className="sb-grid-item">
|
136
|
+
<Image
|
137
|
+
width={0}
|
138
|
+
height={0}
|
139
|
+
style={{ width: '100%', height: 'auto' }}
|
140
|
+
src={FigmaPlugin}
|
141
|
+
alt="Windows showing the Storybook plugin in Figma"
|
142
|
+
/>
|
143
|
+
<h4 className="sb-section-item-heading">Figma Plugin</h4>
|
144
|
+
<p className="sb-section-item-paragraph">Embed your stories into Figma to cross-reference the design and live
|
145
|
+
implementation in one place.</p>
|
146
|
+
<a
|
147
|
+
href="https://storybook.js.org/docs/sharing/design-integrations/?renderer=react#embed-storybook-in-figma-with-the-plugin"
|
148
|
+
target="_blank"
|
149
|
+
>Learn more<RightArrow /></a>
|
150
|
+
</div>
|
151
|
+
<div className="sb-grid-item">
|
152
|
+
<Image
|
153
|
+
width={0}
|
154
|
+
height={0}
|
155
|
+
style={{ width: '100%', height: 'auto' }}
|
156
|
+
src={Testing}
|
157
|
+
alt="Screenshot of tests passing and failing"
|
158
|
+
/>
|
159
|
+
<h4 className="sb-section-item-heading">Testing</h4>
|
160
|
+
<p className="sb-section-item-paragraph">Use stories to test a component in all its variations, no matter how
|
161
|
+
complex.</p>
|
162
|
+
<a
|
163
|
+
href="https://storybook.js.org/docs/writing-tests/?renderer=react"
|
164
|
+
target="_blank"
|
165
|
+
>Learn more<RightArrow /></a>
|
166
|
+
</div>
|
167
|
+
<div className="sb-grid-item">
|
168
|
+
<Image
|
169
|
+
width={0}
|
170
|
+
height={0}
|
171
|
+
style={{ width: '100%', height: 'auto' }}
|
172
|
+
src={Accessibility}
|
173
|
+
alt="Screenshot of accessibility tests passing and failing"
|
174
|
+
/>
|
175
|
+
<h4 className="sb-section-item-heading">Accessibility</h4>
|
176
|
+
<p className="sb-section-item-paragraph">Automatically test your components for a11y issues as you develop.</p>
|
177
|
+
<a
|
178
|
+
href="https://storybook.js.org/docs/writing-tests/accessibility-testing/?renderer=react"
|
179
|
+
target="_blank"
|
180
|
+
>Learn more<RightArrow /></a>
|
181
|
+
</div>
|
182
|
+
<div className="sb-grid-item">
|
183
|
+
<Image
|
184
|
+
width={0}
|
185
|
+
height={0}
|
186
|
+
style={{ width: '100%', height: 'auto' }}
|
187
|
+
src={Theming}
|
188
|
+
alt="Screenshot of Storybook in light and dark mode"
|
189
|
+
/>
|
190
|
+
<h4 className="sb-section-item-heading">Theming</h4>
|
191
|
+
<p className="sb-section-item-paragraph">Theme Storybook's UI to personalize it to your project.</p>
|
192
|
+
<a
|
193
|
+
href="https://storybook.js.org/docs/configure/theming/?renderer=react"
|
194
|
+
target="_blank"
|
195
|
+
>Learn more<RightArrow /></a>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
<div className='sb-addon'>
|
201
|
+
<div className='sb-addon-text'>
|
202
|
+
<h4>Addons</h4>
|
203
|
+
<p className="sb-section-item-paragraph">Integrate your tools with Storybook to connect workflows.</p>
|
204
|
+
<a
|
205
|
+
href="https://storybook.js.org/addons/"
|
206
|
+
target="_blank"
|
207
|
+
>Discover all addons<RightArrow /></a>
|
208
|
+
</div>
|
209
|
+
<div className='sb-addon-img'>
|
210
|
+
<Image
|
211
|
+
width={650}
|
212
|
+
height={347}
|
213
|
+
src={AddonLibrary}
|
214
|
+
alt="Integrate your tools with Storybook to connect workflows."
|
215
|
+
/>
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div className="sb-section sb-socials">
|
220
|
+
<div className="sb-section-item">
|
221
|
+
<Image
|
222
|
+
width={32}
|
223
|
+
height={32}
|
224
|
+
layout="fixed"
|
225
|
+
src={Github}
|
226
|
+
alt="Github logo"
|
227
|
+
className="sb-explore-image"
|
228
|
+
/>
|
229
|
+
Join our contributors building the future of UI development.
|
230
|
+
|
231
|
+
<a
|
232
|
+
href="https://github.com/storybookjs/storybook"
|
233
|
+
target="_blank"
|
234
|
+
>Star on GitHub<RightArrow /></a>
|
235
|
+
</div>
|
236
|
+
<div className="sb-section-item">
|
237
|
+
<Image
|
238
|
+
width={33}
|
239
|
+
height={32}
|
240
|
+
layout="fixed"
|
241
|
+
src={Discord}
|
242
|
+
alt="Discord logo"
|
243
|
+
className="sb-explore-image"
|
244
|
+
/>
|
245
|
+
<div>
|
246
|
+
Get support and chat with frontend developers.
|
247
|
+
|
248
|
+
<a
|
249
|
+
href="https://discord.gg/storybook"
|
250
|
+
target="_blank"
|
251
|
+
>Join Discord server<RightArrow /></a>
|
252
|
+
</div>
|
253
|
+
</div>
|
254
|
+
<div className="sb-section-item">
|
255
|
+
<Image
|
256
|
+
width={32}
|
257
|
+
height={32}
|
258
|
+
layout="fixed"
|
259
|
+
src={Youtube}
|
260
|
+
alt="Youtube logo"
|
261
|
+
className="sb-explore-image"
|
262
|
+
/>
|
263
|
+
<div>
|
264
|
+
Watch tutorials, feature previews and interviews.
|
265
|
+
|
266
|
+
<a
|
267
|
+
href="https://www.youtube.com/@chromaticui"
|
268
|
+
target="_blank"
|
269
|
+
>Watch on YouTube<RightArrow /></a>
|
270
|
+
</div>
|
271
|
+
</div>
|
272
|
+
<div className="sb-section-item">
|
273
|
+
<Image
|
274
|
+
width={33}
|
275
|
+
height={32}
|
276
|
+
layout="fixed"
|
277
|
+
src={Tutorials}
|
278
|
+
alt="A book"
|
279
|
+
className="sb-explore-image"
|
280
|
+
/>
|
281
|
+
<p>Follow guided walkthroughs on for key workflows.</p>
|
282
|
+
|
283
|
+
<a
|
284
|
+
href="https://storybook.js.org/tutorials/"
|
285
|
+
target="_blank"
|
286
|
+
>Discover tutorials<RightArrow /></a>
|
287
|
+
</div>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
<style>
|
291
|
+
{`
|
292
|
+
.sb-container {
|
293
|
+
margin-bottom: 48px;
|
294
|
+
}
|
295
|
+
|
296
|
+
.sb-section {
|
297
|
+
width: 100%;
|
298
|
+
display: flex;
|
299
|
+
flex-direction: row;
|
300
|
+
gap: 20px;
|
301
|
+
}
|
302
|
+
|
303
|
+
img {
|
304
|
+
object-fit: cover;
|
305
|
+
}
|
306
|
+
|
307
|
+
.sb-section-title {
|
308
|
+
margin-bottom: 32px;
|
309
|
+
}
|
310
|
+
|
311
|
+
.sb-section a:not(h1 a, h2 a, h3 a) {
|
312
|
+
font-size: 14px;
|
313
|
+
}
|
314
|
+
|
315
|
+
.sb-section-item, .sb-grid-item {
|
316
|
+
flex: 1;
|
317
|
+
display: flex;
|
318
|
+
flex-direction: column;
|
319
|
+
}
|
320
|
+
|
321
|
+
.sb-section-item-heading {
|
322
|
+
padding-top: 20px !important;
|
323
|
+
padding-bottom: 5px !important;
|
324
|
+
margin: 0 !important;
|
325
|
+
}
|
326
|
+
.sb-section-item-paragraph {
|
327
|
+
margin: 0;
|
328
|
+
padding-bottom: 10px;
|
329
|
+
}
|
330
|
+
|
331
|
+
.sb-chevron {
|
332
|
+
margin-left: 5px;
|
333
|
+
}
|
334
|
+
|
335
|
+
.sb-features-grid {
|
336
|
+
display: grid;
|
337
|
+
grid-template-columns: repeat(2, 1fr);
|
338
|
+
grid-gap: 32px 20px;
|
339
|
+
}
|
340
|
+
|
341
|
+
.sb-socials {
|
342
|
+
display: grid;
|
343
|
+
grid-template-columns: repeat(4, 1fr);
|
344
|
+
}
|
345
|
+
|
346
|
+
.sb-socials p {
|
347
|
+
margin-bottom: 10px;
|
348
|
+
}
|
349
|
+
|
350
|
+
.sb-explore-image {
|
351
|
+
max-height: 32px;
|
352
|
+
align-self: flex-start;
|
353
|
+
}
|
354
|
+
|
355
|
+
.sb-addon {
|
356
|
+
width: 100%;
|
357
|
+
display: flex;
|
358
|
+
align-items: center;
|
359
|
+
position: relative;
|
360
|
+
background-color: #EEF3F8;
|
361
|
+
border-radius: 5px;
|
362
|
+
border: 1px solid rgba(0, 0, 0, 0.05);
|
363
|
+
background: #EEF3F8;
|
364
|
+
height: 180px;
|
365
|
+
margin-bottom: 48px;
|
366
|
+
overflow: hidden;
|
367
|
+
}
|
368
|
+
|
369
|
+
.sb-addon-text {
|
370
|
+
padding-left: 48px;
|
371
|
+
max-width: 240px;
|
372
|
+
}
|
373
|
+
|
374
|
+
.sb-addon-text h4 {
|
375
|
+
padding-top: 0px;
|
376
|
+
}
|
377
|
+
|
378
|
+
.sb-addon-img {
|
379
|
+
position: absolute;
|
380
|
+
left: 345px;
|
381
|
+
top: 0;
|
382
|
+
height: 100%;
|
383
|
+
width: 200%;
|
384
|
+
overflow: hidden;
|
385
|
+
}
|
386
|
+
|
387
|
+
.sb-addon-img img {
|
388
|
+
width: 650px;
|
389
|
+
transform: rotate(-15deg);
|
390
|
+
margin-left: 40px;
|
391
|
+
margin-top: -72px;
|
392
|
+
box-shadow: 0 0 1px rgba(255, 255, 255, 0);
|
393
|
+
backface-visibility: hidden;
|
394
|
+
}
|
395
|
+
|
396
|
+
@media screen and (max-width: 800px) {
|
397
|
+
.sb-addon-img {
|
398
|
+
left: 300px;
|
399
|
+
}
|
400
|
+
}
|
401
|
+
|
402
|
+
@media screen and (max-width: 600px) {
|
403
|
+
.sb-section {
|
404
|
+
flex-direction: column;
|
405
|
+
}
|
406
|
+
|
407
|
+
.sb-features-grid {
|
408
|
+
grid-template-columns: repeat(1, 1fr);
|
409
|
+
}
|
410
|
+
|
411
|
+
.sb-socials {
|
412
|
+
grid-template-columns: repeat(2, 1fr);
|
413
|
+
}
|
414
|
+
|
415
|
+
.sb-addon {
|
416
|
+
height: 280px;
|
417
|
+
align-items: flex-start;
|
418
|
+
padding-top: 32px;
|
419
|
+
overflow: hidden;
|
420
|
+
}
|
421
|
+
|
422
|
+
.sb-addon-text {
|
423
|
+
padding-left: 24px;
|
424
|
+
}
|
425
|
+
|
426
|
+
.sb-addon-img {
|
427
|
+
right: 0;
|
428
|
+
left: 0;
|
429
|
+
top: 130px;
|
430
|
+
bottom: 0;
|
431
|
+
overflow: hidden;
|
432
|
+
height: auto;
|
433
|
+
width: 124%;
|
434
|
+
}
|
435
|
+
|
436
|
+
.sb-addon-img img {
|
437
|
+
width: 1200px;
|
438
|
+
transform: rotate(-12deg);
|
439
|
+
margin-left: 0;
|
440
|
+
margin-top: 48px;
|
441
|
+
margin-bottom: -40px;
|
442
|
+
margin-left: -24px;
|
443
|
+
}
|
444
|
+
}
|
445
|
+
`}
|
446
|
+
</style>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
2
|
+
import { fn } from '@storybook/test';
|
3
|
+
|
4
|
+
import { Header } from './Header';
|
5
|
+
|
6
|
+
const meta: Meta<typeof Header> = {
|
7
|
+
title: 'Example/Header',
|
8
|
+
component: Header,
|
9
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
10
|
+
tags: ['autodocs'],
|
11
|
+
parameters: {
|
12
|
+
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
13
|
+
layout: 'fullscreen',
|
14
|
+
},
|
15
|
+
args: {
|
16
|
+
onLogin: fn(),
|
17
|
+
onLogout: fn(),
|
18
|
+
onCreateAccount: fn(),
|
19
|
+
},
|
20
|
+
};
|
21
|
+
|
22
|
+
export default meta;
|
23
|
+
type Story = StoryObj<typeof Header>;
|
24
|
+
|
25
|
+
export const LoggedIn: Story = {
|
26
|
+
args: {
|
27
|
+
user: {
|
28
|
+
name: 'Jane Doe',
|
29
|
+
},
|
30
|
+
},
|
31
|
+
};
|
32
|
+
|
33
|
+
export const LoggedOut: Story = {};
|