Skip to content

Commit bc8425b

Browse files
feat(Rebranding / Storybook): add version in toolbar (#1924)
1 parent 6194eb1 commit bc8425b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

packages/blade/.storybook/react/preview.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ export const parameters = {
7272
}
7373
return bladeTheme;
7474
};
75+
76+
if (context.store.globals.globals.version === '10' && window.top) {
77+
window.top.location.href =
78+
'https://v10--61c19ee8d3d282003ac1d81c.chromatic.com' +
79+
window.top.location.pathname +
80+
window.top.location.search;
81+
}
7582
return (
7683
<DocsContainer context={context}>
7784
<BladeProvider
@@ -146,6 +153,13 @@ export const decorators = [
146153
return bladeTheme;
147154
};
148155

156+
if (context.globals.version === '10' && window.top) {
157+
window.top.location.href =
158+
'https://v10--61c19ee8d3d282003ac1d81c.chromatic.com' +
159+
window.top.location.pathname +
160+
window.top.location.search;
161+
}
162+
149163
return (
150164
<ErrorBoundary>
151165
<GlobalStyle />
@@ -164,6 +178,23 @@ export const decorators = [
164178
];
165179

166180
export const globalTypes = {
181+
version: {
182+
name: 'Blade Documentation Version',
183+
description: 'Version of the Blade',
184+
defaultValue: '11',
185+
toolbar: {
186+
icon: 'time',
187+
title: ' v11 - Rebranded',
188+
// Array of plain string values or MenuItem shape (see below)
189+
items: [
190+
{ value: '10', title: ' v10 - Old' },
191+
{ value: '11', title: ' v11 - Rebranded', default: true },
192+
],
193+
dynamicTitle: true,
194+
// Property that specifies if the name of the item will be displayed
195+
showName: false,
196+
},
197+
},
167198
colorScheme: {
168199
name: 'Color Scheme',
169200
description: 'Color Scheme for Blade',

0 commit comments

Comments
 (0)