mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 00:11:49 +03:00
c4773b946b
refs. https://github.com/TryGhost/Product/issues/3349 - We've added a keyboard shortcut '/' to focus in on the searchfield in AdminX. However this didn't handle the case when the focus is already in a textfield and when tried to enter e.g. "https://", then at the '/' character it focused on the searchfield. --------- Co-authored-by: Ronald Langeveld <hi@ronaldlangeveld.com>
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
import '../src/styles/demo.css';
|
|
import type { Preview } from "@storybook/react";
|
|
import '../src/admin-x-ds/providers/DesignSystemProvider';
|
|
import DesignSystemProvider from '../src/admin-x-ds/providers/DesignSystemProvider';
|
|
|
|
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 */}
|
|
<DesignSystemProvider>
|
|
<Story />
|
|
</DesignSystemProvider>
|
|
</div>);
|
|
},
|
|
],
|
|
globalTypes: {
|
|
scheme: {
|
|
name: "Scheme",
|
|
description: "Select light or dark mode",
|
|
defaultValue: "light",
|
|
toolbar: {
|
|
icon: "mirror",
|
|
items: ["light", "dark"],
|
|
dynamicTitle: true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
export default preview;
|