2023-05-17 08:46:18 +03:00
|
|
|
import React from 'react';
|
|
|
|
|
2023-05-17 12:53:55 +03:00
|
|
|
import '../src/styles/demo.css';
|
2023-05-17 08:46:18 +03:00
|
|
|
import type { Preview } from "@storybook/react";
|
2023-09-25 15:22:10 +03:00
|
|
|
import '../src/admin-x-ds/providers/DesignSystemProvider';
|
|
|
|
import DesignSystemProvider from '../src/admin-x-ds/providers/DesignSystemProvider';
|
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-06-14 09:35:05 +03:00
|
|
|
mathod: 'alphabetical',
|
2023-06-14 10:12:26 +03:00
|
|
|
order: ['Global', ['Chrome', 'Form', 'Modal', 'Layout', 'List', '*'], 'Settings', ['Setting Section', 'Setting Group', '*'], 'Experimental'],
|
2023-05-17 20:01:01 +03:00
|
|
|
},
|
|
|
|
},
|
2023-05-17 08:46:18 +03:00
|
|
|
},
|
|
|
|
decorators: [
|
2023-09-08 21:53:41 +03:00
|
|
|
(Story, context) => {
|
|
|
|
let {scheme} = context.globals;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={`admin-x-settings ${scheme === 'dark' ? 'dark' : ''}`} style={{
|
|
|
|
padding: '24px',
|
|
|
|
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-09-25 15:22:10 +03:00
|
|
|
<DesignSystemProvider>
|
|
|
|
<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;
|