/
desktop.stories.tsx
71 lines (63 loc) · 2.07 KB
/
desktop.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
import React, { Fragment } from 'react';
import { DecoratorFn } from '@storybook/react';
import isChromatic from 'chromatic/isChromatic';
import { Desktop, DesktopProps } from './desktop';
import { store } from './persist';
import { mockProps, realProps, MockPage } from './app.mockdata';
export default {
title: 'UI/Layout/Desktop',
component: Desktop,
parameters: { passArgsFirst: false },
decorators: [
((StoryFn, c) => {
const mocked = true;
const height = 900;
const width = 1200;
if (isChromatic) {
store.local.set(`storybook-layout`, {});
}
const props = {
height,
width,
...(mocked ? mockProps : realProps),
};
return (
<div style={{ minHeight: 900, minWidth: 1200 }}>
<StoryFn props={props} {...c} />;
</div>
);
}) as DecoratorFn,
],
};
export const Default = ({ props }: { props: DesktopProps }) => <Desktop {...props} />;
export const NoAddons = ({ props }: { props: DesktopProps }) => (
<Desktop {...props} panelCount={0} />
);
export const NoSidebar = ({ props }: { props: DesktopProps }) => (
<Desktop {...props} options={{ ...props.options, showNav: false }} />
);
export const NoPanel = ({ props }: { props: DesktopProps }) => (
<Desktop {...props} options={{ ...props.options, showPanel: false }} />
);
export const BottomPanel = ({ props }: { props: DesktopProps }) => (
<Desktop {...props} options={{ ...props.options, panelPosition: 'bottom' }} />
);
export const Fullscreen = ({ props }: { props: DesktopProps }) => (
<Desktop {...props} options={{ ...props.options, isFullscreen: true }} />
);
export const NoPanelNoSidebar = ({ props }: { props: DesktopProps }) => (
<Desktop {...props} options={{ ...props.options, showPanel: false, showNav: false }} />
);
export const Page = ({ props }: { props: DesktopProps }) => (
<Desktop
{...props}
pages={[
{
key: 'settings',
route: ({ children }) => <Fragment>{children}</Fragment>,
render: () => <MockPage />,
},
]}
viewMode="settings"
/>
);