-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathpreview.tsx
81 lines (78 loc) · 2.52 KB
/
preview.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { Title } from "@storybook/blocks";
import type { Preview } from "@storybook/react";
import React from "react";
import "../packages/jokul/src/components/card/styles/_index.scss";
import { PropDocs } from "./docs/props/PropDocs.js";
import "./global.scss";
import { themeDecorator, themeGlobal, themes } from "./theme.js";
const preview: Preview = {
globalTypes: {
theme: themeGlobal,
},
initialGlobals: {
theme: themes[0],
backgrounds: { value: "page" },
},
decorators: [themeDecorator],
parameters: {
backgrounds: {
options: {
page: {
name: "Page",
value: "var(--jkl-color-background-page)",
},
pageVariant: {
name: "Page variant",
value: "var(--jkl-color-background-page-variant)",
},
container: {
name: "Container",
value: "var(--jkl-color-background-container)",
},
containerLow: {
name: "Container low",
value: "var(--jkl-color-background-container-low)",
},
containerHigh: {
name: "Container high",
value: "var(--jkl-color-background-container-high)",
},
},
},
options: {
storySort: (a, b) => {
let compareBy = "name";
if (a.type === "docs" && b.type === "story") {
return -1;
} else if (a.type === "story" && b.type === "docs") {
return 1;
} else if (a.type === "docs" && b.type === "docs") {
compareBy = "id";
}
return a[compareBy] === b[compareBy]
? 0
: a[compareBy].localeCompare(b[compareBy], undefined, {
numeric: true,
});
},
},
layout: "centered",
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
docs: {
page: () => (
<>
<Title />
<PropDocs />
{/* For comparison with default ArgTypes table */}
{/* <ArgTypes /> */}
</>
),
},
},
};
export default preview;