Skip to content

Commit d4bed28

Browse files
committed
fix to include preview.js in .storybook
1 parent f744436 commit d4bed28

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

.storybook/preview-head.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,4 @@
1313
html {
1414
background: #fff;
1515
}
16-
.content-wrapper {
17-
padding: 16px;
18-
}
19-
.content-wrapper > div > div:nth-child(2) {
20-
padding: 16px;
21-
}
2216
</style>

.storybook/preview.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import 'core-js/stable';
2+
import { withScreenshot } from 'storycap';
3+
import wrapSLDS from './wrapSLDS';
4+
5+
let assetRoot;
6+
if (typeof location !== 'undefined' && location.hostname === 'mashmatrix.github.io') {
7+
assetRoot = '//mashmatrix.github.io/react-lightning-design-system/assets';
8+
}
9+
10+
const withSLDS = wrapSLDS({ assetRoot });
11+
12+
export const decorators = [
13+
withScreenshot,
14+
withSLDS,
15+
];
16+
17+
export const parameters = {
18+
// Global parameter is optional.
19+
screenshot: {
20+
// Put global screenshot parameters(e.g. viewport)
21+
},
22+
};
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React from 'react';
2-
import classnames from 'classnames';
32
import { ComponentSettings } from '../src/scripts';
43

5-
export default function wrapContent(options) {
4+
export default function wrapSLDS(options) {
65
return story => (
76
<ComponentSettings assetRoot={ options.assetRoot } portalClassName='slds'>
8-
<div className={ classnames('content-wrapper', options.className) }>{ story() }</div>
7+
{story()}
98
</ComponentSettings>
109
);
1110
}

0 commit comments

Comments
 (0)