2023-05-17 08:46:18 +03:00
|
|
|
import React from 'react';
|
|
|
|
|
2023-11-08 15:33:18 +03:00
|
|
|
import '../styles.css';
|
|
|
|
import './storybook.css';
|
|
|
|
|
2023-05-17 08:46:18 +03:00
|
|
|
import type { Preview } from "@storybook/react";
|
2023-11-08 15:33:18 +03:00
|
|
|
import DesignSystemProvider from '../src/providers/DesignSystemProvider';
|
2023-10-09 18:04:01 +03:00
|
|
|
import adminxTheme from './adminx-theme';
|
2023-05-17 08:46:18 +03:00
|
|
|
|
2023-11-22 18:53:23 +03:00
|
|
|
// import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport';
|
|
|
|
|
|
|
|
const customViewports = {
|
|
|
|
sm: {
|
|
|
|
name: 'sm',
|
|
|
|
styles: {
|
|
|
|
width: '480px',
|
|
|
|
height: '801px',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
md: {
|
|
|
|
name: 'md',
|
|
|
|
styles: {
|
|
|
|
width: '640px',
|
|
|
|
height: '801px',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
lg: {
|
|
|
|
name: 'lg',
|
|
|
|
styles: {
|
|
|
|
width: '1024px',
|
|
|
|
height: '801px',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
xl: {
|
|
|
|
name: 'xl',
|
|
|
|
styles: {
|
|
|
|
width: '1320px',
|
|
|
|
height: '801px',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tablet: {
|
|
|
|
name: 'tablet',
|
|
|
|
styles: {
|
|
|
|
width: '860px',
|
|
|
|
height: '801px',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-05-17 08:46:18 +03:00
|
|
|
const preview: Preview = {
|
|
|
|
parameters: {
|
|
|
|
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
|
|
controls: {
|
|
|
|
matchers: {
|
|
|
|
color: /(background|color)$/i,
|
|
|
|
date: /Date$/,
|
|
|
|
},
|
|
|
|
},
|
2023-05-17 20:01:01 +03:00
|
|
|
options: {
|
|
|
|
storySort: {
|
2023-11-21 09:49:41 +03:00
|
|
|
method: 'alphabetical',
|
2023-11-23 18:18:59 +03:00
|
|
|
order: ['Welcome', 'Foundations', ['Style Guide', 'Colors', 'Icons', 'ErrorHandling'], 'Global', ['Form', 'Chrome', 'Modal', 'Layout', ['View Container', 'Page Header', 'Page'], 'List', 'Table', '*'], 'Settings', ['Setting Section', 'Setting Group', '*'], 'Experimental'],
|
2023-05-17 20:01:01 +03:00
|
|
|
},
|
|
|
|
},
|
2023-10-09 18:04:01 +03:00
|
|
|
docs: {
|
|
|
|
theme: adminxTheme,
|
|
|
|
},
|
2023-11-22 18:53:23 +03:00
|
|
|
viewport: {
|
|
|
|
viewports: {
|
|
|
|
...customViewports,
|
|
|
|
},
|
|
|
|
},
|
2023-05-17 08:46:18 +03:00
|
|
|
},
|
|
|
|
decorators: [
|
2023-09-08 21:53:41 +03:00
|
|
|
(Story, context) => {
|
|
|
|
let {scheme} = context.globals;
|
|
|
|
|
|
|
|
return (
|
2023-11-08 18:10:43 +03:00
|
|
|
<div className={`admin-x-design-system admin-x-base ${scheme === 'dark' ? 'dark' : ''}`} style={{
|
2023-11-21 09:49:41 +03:00
|
|
|
// padding: '24px',
|
|
|
|
// width: 'unset',
|
|
|
|
height: 'unset',
|
|
|
|
// overflow: 'unset',
|
2023-09-08 21:53:41 +03:00
|
|
|
background: (scheme === 'dark' ? '#131416' : '')
|
|
|
|
}}>
|
2023-05-17 08:46:18 +03:00
|
|
|
{/* 👇 Decorators in Storybook also accept a function. Replace <Story/> with Story() to enable it */}
|
2023-11-08 15:33:18 +03:00
|
|
|
<DesignSystemProvider fetchKoenigLexical={async () => {}}>
|
2023-09-25 15:22:10 +03:00
|
|
|
<Story />
|
|
|
|
</DesignSystemProvider>
|
2023-09-08 21:53:41 +03:00
|
|
|
</div>);
|
|
|
|
},
|
2023-05-17 08:46:18 +03:00
|
|
|
],
|
2023-09-08 21:53:41 +03:00
|
|
|
globalTypes: {
|
|
|
|
scheme: {
|
|
|
|
name: "Scheme",
|
|
|
|
description: "Select light or dark mode",
|
|
|
|
defaultValue: "light",
|
|
|
|
toolbar: {
|
|
|
|
icon: "mirror",
|
|
|
|
items: ["light", "dark"],
|
|
|
|
dynamicTitle: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-05-17 08:46:18 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export default preview;
|