mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
7ebbf9d56e
refs. https://github.com/TryGhost/Product/issues/3349 - added basic support for dark mode
51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
|
|
import '../src/styles/demo.css';
|
|
import type { Preview } from "@storybook/react";
|
|
|
|
const preview: Preview = {
|
|
parameters: {
|
|
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/,
|
|
},
|
|
},
|
|
options: {
|
|
storySort: {
|
|
mathod: 'alphabetical',
|
|
order: ['Global', ['Chrome', 'Form', 'Modal', 'Layout', 'List', '*'], 'Settings', ['Setting Section', 'Setting Group', '*'], 'Experimental'],
|
|
},
|
|
},
|
|
},
|
|
decorators: [
|
|
(Story, context) => {
|
|
let {scheme} = context.globals;
|
|
|
|
return (
|
|
<div className={`admin-x-settings ${scheme === 'dark' ? 'dark' : ''}`} style={{
|
|
padding: '24px',
|
|
background: (scheme === 'dark' ? '#131416' : '')
|
|
}}>
|
|
{/* 👇 Decorators in Storybook also accept a function. Replace <Story/> with Story() to enable it */}
|
|
<Story />
|
|
</div>);
|
|
},
|
|
],
|
|
globalTypes: {
|
|
scheme: {
|
|
name: "Scheme",
|
|
description: "Select light or dark mode",
|
|
defaultValue: "light",
|
|
toolbar: {
|
|
icon: "mirror",
|
|
items: ["light", "dark"],
|
|
dynamicTitle: true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export default preview;
|