Skip to content

Commit bfae852

Browse files
authored
🎨 clean up devto styles n stories (#13)
* 🔥 turn off chromatic modes * ⬆️ update dependencies and fixtures
1 parent debf421 commit bfae852

19 files changed

+362
-206
lines changed

.storybook/modes.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,15 @@ export const allModes = {
6464
theme: 'light',
6565
viewport: 'small',
6666
},
67-
};
67+
};
68+
69+
export const basicModes = {
70+
dark: {
71+
backgrounds: 'dark',
72+
theme: 'dark',
73+
},
74+
light: {
75+
backgrounds: 'light',
76+
theme: 'light',
77+
},
78+
}

.storybook/preview.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@ import { setCustomElementsManifest } from '@storybook/web-components';
22
import customElements from '../custom-elements.json';
33
import { globalTypesPrimer, decoratorsPrimer } from './primer-preview';
44
import { viewports } from './viewports';
5-
import { defaultModes } from './modes';
65
import "./storybook.css";
76

87
setCustomElementsManifest(customElements);
98

109
export const globalTypes = globalTypesPrimer;
1110
export const decorators = decoratorsPrimer;
1211

12+
global.attrGen = (args) => Object.entries(args)
13+
.filter(([key, value]) => value)
14+
.map(([key, value]) => `\n ${key}="${value}"`)
15+
.join(' ');
16+
17+
global.stringify = (obj) => JSON.stringify(obj).replace(/"/g, """)
18+
1319
/** @type { import('@storybook/web-components').Preview } */
1420
const preview = {
1521
parameters: {
1622
actions: { argTypesRegex: "^on[A-Z].*" },
17-
chromatic: {
18-
modes: {
19-
...defaultModes,
20-
},
21-
},
2223
controls: {
2324
expanded: true,
2425
matchers: {
@@ -30,6 +31,13 @@ const preview = {
3031
viewport: {
3132
viewports,
3233
},
34+
docs: {
35+
source: {
36+
transform: (code) => {
37+
return code.replaceAll('&gt;', ">").replaceAll('&lt;', "<")
38+
}
39+
}
40+
}
3341
},
3442
};
3543

.storybook/viewports.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export const customViewports = {
2424
height: '100%',
2525
},
2626
},
27+
containerMin4: {
28+
name: 'ContainerMin4: 600px',
29+
styles: {
30+
width: '600px',
31+
height: '100%',
32+
},
33+
},
2734
};
2835

2936
export const viewports ={

0 commit comments

Comments
 (0)