2020-07-22 13:21:25 -04:00
|
|
|
/**
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
import React from 'react';
|
|
|
|
import { addDecorator } from '@storybook/react';
|
|
|
|
import { jsxDecorator } from 'storybook-addon-jsx';
|
2020-08-21 01:41:25 -04:00
|
|
|
import { addParameters } from '@storybook/react';
|
2021-09-27 13:51:53 -04:00
|
|
|
import WithPaddings from 'storybook-addon-paddings';
|
2020-09-09 16:18:55 -04:00
|
|
|
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
|
2021-03-02 19:34:55 -05:00
|
|
|
import { combineReducers, createStore, applyMiddleware, compose } from 'redux';
|
|
|
|
import thunk from 'redux-thunk';
|
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import reducerIndex from 'spec/helpers/reducerIndex';
|
2023-01-16 12:48:22 -05:00
|
|
|
import { GlobalStyles } from '../src/GlobalStyles';
|
2020-07-22 13:21:25 -04:00
|
|
|
|
2021-03-02 19:34:55 -05:00
|
|
|
import 'src/theme.ts';
|
2020-08-21 01:41:25 -04:00
|
|
|
import './storybook.css';
|
2020-07-22 13:21:25 -04:00
|
|
|
|
2021-03-02 19:34:55 -05:00
|
|
|
const store = createStore(
|
|
|
|
combineReducers(reducerIndex),
|
|
|
|
{},
|
|
|
|
compose(applyMiddleware(thunk)),
|
|
|
|
);
|
|
|
|
|
2021-02-23 13:24:08 -05:00
|
|
|
const themeDecorator = Story => (
|
2023-01-16 12:48:22 -05:00
|
|
|
<ThemeProvider theme={supersetTheme}>
|
|
|
|
<>
|
|
|
|
<GlobalStyles />
|
|
|
|
<Story />
|
|
|
|
</>
|
|
|
|
</ThemeProvider>
|
2020-07-22 13:21:25 -04:00
|
|
|
);
|
|
|
|
|
2021-03-02 19:34:55 -05:00
|
|
|
const providerDecorator = Story => (
|
|
|
|
<Provider store={store}>
|
|
|
|
<Story />
|
|
|
|
</Provider>
|
|
|
|
);
|
|
|
|
|
2020-07-22 13:21:25 -04:00
|
|
|
addDecorator(jsxDecorator);
|
2020-08-02 17:32:17 -04:00
|
|
|
addDecorator(themeDecorator);
|
2021-03-02 19:34:55 -05:00
|
|
|
addDecorator(providerDecorator);
|
2021-09-27 13:51:53 -04:00
|
|
|
addDecorator(WithPaddings);
|
2020-08-21 01:41:25 -04:00
|
|
|
|
|
|
|
addParameters({
|
2021-09-27 13:51:53 -04:00
|
|
|
paddings: {
|
|
|
|
values: [
|
|
|
|
{ name: 'None', value: '0px' },
|
|
|
|
{ name: 'Small', value: '16px' },
|
|
|
|
{ name: 'Medium', value: '32px' },
|
|
|
|
{ name: 'Large', value: '64px' },
|
|
|
|
],
|
|
|
|
default: 'Medium',
|
|
|
|
},
|
2021-04-29 14:51:41 -04:00
|
|
|
options: {
|
|
|
|
storySort: {
|
2022-08-23 16:16:28 -04:00
|
|
|
order: [
|
|
|
|
'Superset Frontend',
|
|
|
|
['Controls', 'Display', 'Feedback', 'Input', '*'],
|
|
|
|
['Overview', 'Examples', '*'],
|
|
|
|
'Design System',
|
2022-11-09 17:33:27 -05:00
|
|
|
[
|
|
|
|
'Introduction',
|
|
|
|
'Foundations',
|
|
|
|
'Components',
|
|
|
|
['Overview', 'Examples', '*'],
|
|
|
|
'Patterns',
|
|
|
|
'*',
|
|
|
|
],
|
|
|
|
['Overview', 'Examples', '*'],
|
2022-08-23 16:16:28 -04:00
|
|
|
'*',
|
|
|
|
],
|
2021-04-29 14:51:41 -04:00
|
|
|
},
|
|
|
|
},
|
2022-08-17 13:39:44 -04:00
|
|
|
controls: { expanded: true },
|
2020-08-21 01:41:25 -04:00
|
|
|
});
|