mirror of
https://github.com/steedos/steedos-platform
synced 2024-11-22 17:06:42 +00:00
修正 react storybook
This commit is contained in:
parent
9802dc1faa
commit
3784b3eef8
@ -1 +1 @@
|
||||
REACT_APP_API_BASE_URL=127.0.0.1:5000
|
||||
REACT_APP_API_BASE_URL=http://127.0.0.1:5000
|
3
packages/react/.storybook/addons.js
Normal file
3
packages/react/.storybook/addons.js
Normal file
@ -0,0 +1,3 @@
|
||||
import '@storybook/addon-actions/register';
|
||||
import '@storybook/addon-links/register';
|
||||
import '@storybook/addon-cssresources/register';
|
23
packages/react/.storybook/config.js
Normal file
23
packages/react/.storybook/config.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { configure, addDecorator, addParameters } from '@storybook/react';
|
||||
import { withCssResources } from '@storybook/addon-cssresources';
|
||||
|
||||
const REACT_APP_API_BASE_URL = process.env.REACT_APP_API_BASE_URL;
|
||||
addDecorator(withCssResources)
|
||||
addParameters({
|
||||
cssresources: [{
|
||||
id: `bootstrap`,
|
||||
code: `<link rel="stylesheet" type="text/css" href="/assets/styles/bootstrap.css"></link>`,
|
||||
picked: true,
|
||||
}, {
|
||||
id: `sfds`,
|
||||
code: `<link rel="stylesheet" type="text/css" href="` + REACT_APP_API_BASE_URL + `/assets/styles/salesforce-lightning-design-system.min.css"></link>`,
|
||||
picked: true,
|
||||
}, {
|
||||
id: `style`,
|
||||
code: `<style>html,body{background: #fff;height:100%;}#root{height: 100%;}</style>`,
|
||||
picked: true,
|
||||
}],
|
||||
});
|
||||
|
||||
// automatically import all files ending in *.stories.js
|
||||
configure(require.context('../src/stories', true, /\.stories\.js$/), module);
|
3
packages/react/.storybook/presets.js
Normal file
3
packages/react/.storybook/presets.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = [
|
||||
'@storybook/addon-storysource/preset'
|
||||
];
|
@ -1,3 +1,17 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDom from 'react-dom';
|
||||
import * as Redux from 'redux';
|
||||
import * as ReactRedux from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import * as ReactDesignSystem from '@salesforce/design-system-react';
|
||||
import styled from 'styled-components';
|
||||
import * as ReduxThunk from 'redux-thunk';
|
||||
import * as Immer from 'immer';
|
||||
import * as TSODataClient from 'ts-odata-client';
|
||||
import * as NodeFetch from 'node-fetch';
|
||||
import * as SteedosFilters from '@steedos/filters';
|
||||
|
||||
import * as ReactSteedos from '../export';
|
||||
import store from "../stores/configureStore";
|
||||
import { receivePluginInstance, receivePluginComponent } from '../actions';
|
||||
import { ObjectHomeIFrame, generateIFrame } from "../components/object_home_iframe";
|
||||
@ -14,6 +28,25 @@ export const registerPlugin = ( pluginName, pluginInstance ) => {
|
||||
pluginInstance.initialize(registry, store);
|
||||
}
|
||||
|
||||
|
||||
export const registerWindowLibraries = () => {
|
||||
window["React"] = React;
|
||||
window["PropTypes"] = PropTypes;
|
||||
window["ReactDom"] = ReactDom;
|
||||
window["Redux"] = Redux;
|
||||
window["ReactRedux"] = ReactRedux;
|
||||
window["ReactDesignSystem"] = ReactDesignSystem;
|
||||
window["ReactSteedos"] = ReactSteedos;
|
||||
window["StyledComponents"] = styled;
|
||||
window["ReduxThunk"] = ReduxThunk;
|
||||
window["Immer"] = Immer;
|
||||
window["TSODataClient"] = TSODataClient;
|
||||
window["NodeFetch"] = NodeFetch;
|
||||
window["SteedosFilters"] = SteedosFilters;
|
||||
|
||||
window["registerPlugin"] = registerPlugin;
|
||||
}
|
||||
|
||||
function dispatchPluginComponentAction(name: string, pluginId: string, component: any, id: string = "") {
|
||||
if(!id){
|
||||
id = generateId();
|
||||
|
Loading…
Reference in New Issue
Block a user