123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- import 'focus-visible';
- import React from 'react';
- import {ThemeProvider} from 'emotion-theming';
- import {addParameters, addDecorator} from '@storybook/react';
- import theme, {darkTheme} from '../src/sentry/static/sentry/app/utils/theme';
- import GlobalStyles from '../src/sentry/static/sentry/app/styles/global';
- import '../docs-ui/index.js';
- const withTheme = (Story, context) => {
- const isDark = context.globals.theme === 'dark';
- const currentTheme = isDark ? darkTheme : theme;
-
- if (context.globals.theme) {
- context.globals.backgrounds = {value: currentTheme.bodyBackground};
- }
- return (
- <ThemeProvider theme={currentTheme}>
- <GlobalStyles isDark={isDark} theme={currentTheme} />
- <Story {...context} />
- </ThemeProvider>
- );
- };
- addDecorator(withTheme);
- addParameters({
- options: {
-
- isFullscreen: false,
-
- showNav: true,
-
- showPanel: true,
-
- panelPosition: 'bottom',
-
- hierarchySeparator: /\/|\./,
-
- hierarchyRootSeparator: /\|/,
-
- sidebarAnimations: true,
-
- enableShortcuts: true,
-
- isToolshown: true,
-
- storySort: {
- order: [
- 'Core',
- 'Forms',
- 'UI',
- 'Layouts',
- 'Charts',
- 'DataVisualization',
- 'Features',
- 'Utilities',
- 'Deprecated',
- ],
- },
- },
- });
- export const globalTypes = {
- theme: {
- name: 'Theme',
- description: 'Global theme for components',
- defaultValue: 'light',
- toolbar: {
- icon: 'circlehollow',
-
- items: [
- {value: 'light', icon: 'circlehollow', title: 'light'},
- {value: 'dark', icon: 'circle', title: 'dark'},
- ],
- },
- },
- };
- export const parameters = {
-
- backgrounds: {
- grid: {
- disable: true,
- },
- default: 'light',
- values: [
- {
- name: 'light',
- value: theme.background,
- },
- {
- name: 'dark',
- value: darkTheme.background,
- },
- ],
- },
- };
|