open-nomad/ui/.storybook/preview.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-10-06 20:56:05 +00:00
import { addDecorator, addParameters } from '@storybook/ember';
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
import theme from './theme.js';
addParameters({
viewport: { viewports: INITIAL_VIEWPORTS },
options: {
showPanel: true,
theme,
},
});
2021-12-28 14:45:20 +00:00
addDecorator((storyFn) => {
2021-10-06 20:56:05 +00:00
let { template, context } = storyFn();
let wrapperElementStyle = {
margin: '20px',
};
let applicationWrapperElement = document.createElement('div');
Object.assign(applicationWrapperElement.style, wrapperElementStyle);
let storybookElement = document.createElement('div');
storybookElement.setAttribute('id', 'storybook');
let wormhole = document.createElement('div');
wormhole.setAttribute('id', 'ember-basic-dropdown-wormhole');
storybookElement.appendChild(wormhole);
applicationWrapperElement.appendChild(storybookElement);
storybookElement.appendTo = function appendTo(el) {
el.appendChild(applicationWrapperElement);
};
return {
template,
context,
element: storybookElement,
};
});