Skip to content

Commit 906f1a5

Browse files
authored
fix up storybook (#214)
* Fix storybook up a bit * Fix build
1 parent eb06922 commit 906f1a5

23 files changed

+2462
-58
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { STORY_RENDERED } from "@storybook/core-events";
2+
import { addons } from "@storybook/addons";
3+
4+
let hasExpanded = false;
5+
6+
addons.register("expand-all", api => {
7+
const emitter = addons.getChannel();
8+
9+
emitter.on(STORY_RENDERED, () => {
10+
if (!hasExpanded) {
11+
setTimeout(api.expandAll); // Calling on the next tick after storyRendered seems to work reliably.
12+
hasExpanded = true;
13+
}
14+
});
15+
});

.storybook/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const path = require("path");
22

33
module.exports = {
44
stories: ["../**/*.stories.tsx"],
5-
addons: ["@storybook/addon-links", "@storybook/addon-controls"],
5+
addons: ["@storybook/addon-links", "@storybook/addon-controls", "./addons/expand-all/register.js"],
66
devtool: "source-map",
77
webpackFinal: async (config, { configType }) => {
88
config.module.rules.push({

.storybook/manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ addons.setConfig({
2020
initialActive: "sidebar",
2121
sidebar: {
2222
showRoots: true,
23-
collapsedRoots: ["Subcomponents"],
23+
collapsedRoots: ["Subcomponents", "TestCases"],
2424
},
2525
toolbar: {
2626
title: { hidden: false },

.storybook/preview.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import { addParameters } from "@storybook/react";
33
addParameters({
44
options: {
55
showRoots: true,
6-
storySort: (a, b) => a[1].id.localeCompare(b[1].id, undefined, { numeric: true }),
6+
storySort: (a, b) => {
7+
return a[1].name.localeCompare(b[1].name, undefined, { numeric: true });
8+
},
79
},
810
});
911

1012
export const parameters = {
11-
layout: 'fullscreen',
12-
};
13+
layout: "fullscreen",
14+
};

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Data Grid is agnostic about the way you load/store/generate/mutate your data. Wh
115115

116116
**Does it do sorting, searching, and filtering?**
117117

118-
Search is included. You provide the trigger, we do the search. [Example](https://glideapps.github.io/glide-data-grid/?path=/story/dataeditor--built-in-search) in our storybook.
118+
Search is included. You provide the trigger, we do the search. [Example](https://glideapps.github.io/glide-data-grid/?path=/story/glide-data-grid-docs--search) in our storybook.
119119

120120
Filtering and sorting are something you would have to implement with your data source. There are hooks for adding column header menus if you want that.
121121

@@ -127,7 +127,7 @@ Yes!
127127

128128
**Can I render my own cells?**
129129

130-
Yes, but the renderer has to use HTML Canvas. [Simple example](https://glideapps.github.io/glide-data-grid/?path=/story/dataeditor--draw-custom-cells) in our Storybook.
130+
Yes, but the renderer has to use HTML Canvas. [Simple example](https://glideapps.github.io/glide-data-grid/?path=/story/glide-data-grid-dataeditor-demos--draw-custom-cells) in our Storybook.
131131

132132
**Why does Data Grid use HTML Canvas?**
133133

packages/cells/src/cell.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const SimpleThemeWrapper: React.FC = p => {
3434
};
3535

3636
export default {
37-
title: "Extra Cells",
37+
title: "Extra Packages/Cells",
3838

3939
decorators: [
4040
(Story: React.ComponentType) => (

packages/core/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Data Grid is agnostic about the way you load/store/generate/mutate your data. Wh
115115

116116
**Does it do sorting, searching, and filtering?**
117117

118-
Search is included. You provide the trigger, we do the search. [Example](https://glideapps.github.io/glide-data-grid/?path=/story/dataeditor--built-in-search) in our storybook.
118+
Search is included. You provide the trigger, we do the search. [Example](https://glideapps.github.io/glide-data-grid/?path=/story/glide-data-grid-docs--search) in our storybook.
119119

120120
Filtering and sorting are something you would have to implement with your data source. There are hooks for adding column header menus if you want that.
121121

@@ -127,7 +127,7 @@ Yes!
127127

128128
**Can I render my own cells?**
129129

130-
Yes, but the renderer has to use HTML Canvas. [Simple example](https://glideapps.github.io/glide-data-grid/?path=/story/dataeditor--draw-custom-cells) in our Storybook.
130+
Yes, but the renderer has to use HTML Canvas. [Simple example](https://glideapps.github.io/glide-data-grid/?path=/story/glide-data-grid-dataeditor-demos--draw-custom-cells) in our Storybook.
131131

132132
**Why does Data Grid use HTML Canvas?**
133133

packages/core/src/data-editor/data-editor-beautiful.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function lossyCopyData<T extends EditableGridCell>(source: EditableGridCell, tar
101101
}
102102

103103
export default {
104-
title: "DataEditor",
104+
title: "Glide-Data-Grid/DataEditor Demos",
105105

106106
decorators: [
107107
(Story: React.ComponentType) => (

packages/core/src/data-editor/data-editor-repros.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import DataEditorContainer from "../data-editor-container/data-grid-container";
1010
import styled from "styled-components";
1111

1212
export default {
13-
title: "DataEditor/TestCases/Bugs",
13+
title: "Tests/TestCases/Bugs",
1414

1515
decorators: [
1616
(fn: StoryFn<React.ReactElement | null>, context: StoryContext) => (

packages/core/src/data-editor/data-editor.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { DataEditor } from "./data-editor";
1717
import DataEditorContainer from "../data-editor-container/data-grid-container";
1818

1919
export default {
20-
title: "DataEditor/TestCases",
20+
title: "Tests/TestCases",
2121

2222
decorators: [
2323
(fn: StoryFn<React.ReactElement | null>, context: StoryContext) => (

0 commit comments

Comments
 (0)