-
Notifications
You must be signed in to change notification settings - Fork 2
/
SubNav.stories.tsx
185 lines (170 loc) · 4.5 KB
/
SubNav.stories.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import React from 'react';
import { Icon } from '@storybook/design-system';
import {
SubNav,
SubNavDivider,
SubNavBreadcrumb,
SubNavCTA,
SubNavRight,
SubNavMenus,
} from './SubNav';
import { SubNavLinkList, SubNavLinkItem } from './SubNavLinkList';
import { SubNavTabs } from './SubNavTabs';
import { Menu } from '../Menu';
import { Grouped } from '../Menu/Menu.stories';
export default {
title: 'SubNav/SubNav',
component: SubNav,
parameters: {
chromatic: { viewports: [320, 440, 600, 900] },
layout: 'fullscreen',
},
};
const docsItems = [
{ key: '1', label: 'Get started', href: '/activity' },
{ key: '2', label: 'Guides', href: '/components', isActive: true },
{ key: '3', label: 'Tutorials', href: '/changes' },
{ key: '4', label: 'API', href: '/changes' },
];
const catalogItems = [
{ key: '1', label: 'Overview', href: '/overview' },
{ key: '2', label: 'Projects', href: '/projects' },
{ key: '3', label: 'Glossary', href: '/glossary' },
{ key: '4', label: 'About', href: '/about', isActive: true },
];
const supportItems: SubNavLinkItem[] = [
{
icon: 'github',
href: 'http://github.com/storybookjs',
label: 'Github',
},
{
icon: 'discord',
href: 'https://discord.gg/storybook',
label: 'Discord',
},
{
icon: 'youtube',
href: 'https://www.youtube.com/channel/UCr7Quur3eIyA_oe8FNYexfg',
label: 'Youtube',
},
];
const communityItems: SubNavLinkItem[] = [
...supportItems,
{
icon: 'twitter',
href: 'https://twitter.com/storybookjs/',
label: 'Twitter',
},
];
const rendererOptions = Grouped.args.items;
const versionOptions = [
{
label: 'stable',
items: [
{ label: '6.5', link: { url: '/6-5' } },
{ label: '6.4', link: { url: '/6-4' } },
{ label: '6.3', link: { url: '/6-3' } },
{ label: '6.2', link: { url: '/6-2' } },
{ label: '6.1', link: { url: '/6-1' } },
{ label: '6.0', link: { url: '/6-0' } },
],
},
{
label: 'pre-release',
items: [{ label: '7.0 (future)', link: { url: '/7-0' } }],
},
];
const RendererSelect = () => (
<Menu label={rendererOptions[0].items[0].label} items={rendererOptions} primary />
);
const VersionSelect = () => (
<Menu label={versionOptions[0].items[0].label} items={versionOptions} primary />
);
export const TabLinklist = () => (
<SubNav>
<SubNavTabs label="Docs nav" items={docsItems} />
<SubNavRight>
<SubNavLinkList label="Get support:" items={supportItems} />
</SubNavRight>
</SubNav>
);
export const TabCTA = () => (
<SubNav>
<SubNavTabs label="Addon catalog nav" items={catalogItems} />
<SubNavRight>
<SubNavCTA href="/back">
<Icon icon="add" />
Add your project
</SubNavCTA>
</SubNavRight>
</SubNav>
);
export const TabMenusLinklist = () => (
<SubNav>
<SubNavTabs label="Docs nav" items={docsItems} />
<SubNavDivider />
<SubNavMenus>
<RendererSelect />
<VersionSelect />
</SubNavMenus>
<SubNavRight>
<SubNavLinkList label="Get support:" items={supportItems} />
</SubNavRight>
</SubNav>
);
export const BreadcrumbLinklist = () => (
<SubNav>
<SubNavBreadcrumb tertiary href="/back">
<Icon icon="arrowleft" />
Back to blog
</SubNavBreadcrumb>
<SubNavRight>
<SubNavLinkList label="Join the community:" items={communityItems} />
</SubNavRight>
</SubNav>
);
export const BreadcrumbLinklistInverse = () => (
<SubNav inverse>
<SubNavBreadcrumb tertiary href="/back" inverse>
<Icon icon="arrowleft" />
Back to blog
</SubNavBreadcrumb>
<SubNavRight>
<SubNavLinkList label="Join the community:" items={communityItems} inverse />
</SubNavRight>
</SubNav>
);
BreadcrumbLinklistInverse.parameters = {
backgrounds: { default: 'dark' },
};
export const BreadcrumbCTA = () => (
<SubNav>
<SubNavBreadcrumb tertiary href="/back">
<Icon icon="arrowleft" />
Back to integrations
</SubNavBreadcrumb>
<SubNavRight>
<SubNavCTA href="/back">
<Icon icon="add" />
Add your integration
</SubNavCTA>
</SubNavRight>
</SubNav>
);
export const BreadcrumbMenuLinklist = () => (
<SubNav>
<SubNavBreadcrumb tertiary href="/back">
<Icon icon="arrowleft" />
Back to Visual Testing Handbook
</SubNavBreadcrumb>
<SubNavDivider />
<SubNavMenus>
<RendererSelect />
<VersionSelect />
</SubNavMenus>
<SubNavRight>
<SubNavLinkList label="Get support:" items={supportItems} />
</SubNavRight>
</SubNav>
);