Skip to content

Commit

Permalink
storybook stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance committed Jan 27, 2020
1 parent 515f535 commit 5b8784a
Show file tree
Hide file tree
Showing 34 changed files with 79 additions and 38 deletions.
16 changes: 13 additions & 3 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,25 @@ module.exports = {
addons: [
"@storybook/addon-actions/register",
"@storybook/addon-docs/register",
"@storybook/addon-info/register",
"@storybook/addon-links/register"
],
webpackFinal: async config => {
config.module.rules = [
...config.module.rules,
{
test: /\.(ts|tsx)?$/,
loader: "awesome-typescript-loader"
use: [
{
loader: "awesome-typescript-loader",
options: {
transpileOnly: true
}
},
{
loader: "react-docgen-typescript-loader",
options: {}
}
]
}
];
config.resolve = {
Expand All @@ -36,7 +46,7 @@ module.exports = {
...(config.resolve.alias || {}),
...alias
},
extensions: [".ts", ".tsx", ".js"],
extensions: [...(config.resolve.extensions || []), ".ts", ".tsx"],
plugins: [new TsConfigPathsPlugin({})]
};
config.plugins = [
Expand Down
5 changes: 4 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { configure } from "@storybook/react";
import { addDecorator, configure } from "@storybook/react";
import { withInfo } from "@storybook/addon-info";
import "pepjs";
import "./styles.css";

Expand Down Expand Up @@ -31,3 +32,5 @@ configure(() => {
return [...prev, allExports[cur]];
}, []);
}, module);

addDecorator(withInfo);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"changes": "dotenv lerna-changelog",
"clean": "git clean -e '!/.env' -e '!/website-deploy-key' -e '!/website-deploy-key.pub' -fdX .",
"lint": "eslint .",
"doc": "react-docgen packages/*/src/* --out www/docs/source.json --resolver findAllComponentDefinitions --pretty",
"postinstall": "patch-package"
},
"dependencies": {
Expand Down Expand Up @@ -73,7 +72,9 @@
"pretty-quick": "2.0.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-docgen-typescript-loader": "^3.6.0",
"react-dom": "^16.12.0",
"react-is": "^16.12.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-spring": "^8.0.27",
Expand Down
2 changes: 1 addition & 1 deletion packages/alert-dialog/examples/basic-ts.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Alert Dialog" };
export default { title: "AlertDialog" };
2 changes: 1 addition & 1 deletion packages/alert-dialog/examples/basic.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Alert Dialog" };
export default { title: "AlertDialog" };
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Component Component" };
export default { title: "ComponentComponent" };
2 changes: 1 addition & 1 deletion packages/component-component/examples/state.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Component Component" };
export default { title: "ComponentComponent" };
2 changes: 1 addition & 1 deletion packages/component-component/examples/todo-list.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Component Component" };
export default { title: "ComponentComponent" };
1 change: 1 addition & 0 deletions packages/component-component/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class Component extends React.Component {
}

if (__DEV__) {
Component.displayName = "ComponentComponent";
Component.propTypes = {
initialState: PropTypes.object,
getInitialState: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/basic-strict-mode.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/basic.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/basic.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/conditional-items.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/corners.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/custom-wrapper.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/custom-wrapper.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/focus-on-select.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/long-text.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/non-menu-children.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };

////////////////////////////////////////////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/render-prop.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
2 changes: 1 addition & 1 deletion packages/menu-button/examples/styled.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/styled.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/with-links.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };

////////////////////////////////////////////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/with-tooltip.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Menu Button" };
export default { title: "MenuButton" };
4 changes: 2 additions & 2 deletions packages/rect/examples/use-rect.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useRef } from "react";
import { useRect } from "@reach/rect";

let name = "useRect";
let name = "Basic";

function Example() {
const ref = useRef();
Expand Down Expand Up @@ -30,4 +30,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Rect" };
export default { title: "useRect" };
2 changes: 1 addition & 1 deletion packages/visually-hidden/examples/basic.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Visually Hidden" };
export default { title: "VisuallyHidden" };
2 changes: 1 addition & 1 deletion packages/visually-hidden/examples/basic.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Visually Hidden" };
export default { title: "VisuallyHidden" };
2 changes: 1 addition & 1 deletion packages/window-size/examples/basic.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Window Size" };
export default { title: "WindowSize" };
2 changes: 1 addition & 1 deletion packages/window-size/examples/basic.example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Window Size" };
export default { title: "WindowSize" };
4 changes: 2 additions & 2 deletions packages/window-size/examples/hook.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { useWindowSize } from "@reach/window-size";

let name = "useWindowSize";
let name = "Basic";

function Example() {
const sizes = useWindowSize();
Expand All @@ -12,4 +12,4 @@ function Example() {

Example.story = { name };
export const Comp = Example;
export default { title: "Window Size" };
export default { title: "useWindowSize" };
30 changes: 28 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4238,6 +4238,18 @@
"@webassemblyjs/wast-parser" "1.8.5"
"@xtuc/long" "4.2.2"

"@webpack-contrib/schema-utils@^1.0.0-beta.0":
version "1.0.0-beta.0"
resolved "https://registry.yarnpkg.com/@webpack-contrib/schema-utils/-/schema-utils-1.0.0-beta.0.tgz#bf9638c9464d177b48209e84209e23bee2eb4f65"
integrity sha512-LonryJP+FxQQHsjGBi6W786TQB1Oym+agTpY0c+Kj8alnIw+DLUJb6SI8Y1GHGhLCH1yPRrucjObUmxNICQ1pg==
dependencies:
ajv "^6.1.0"
ajv-keywords "^3.1.0"
chalk "^2.3.2"
strip-ansi "^4.0.0"
text-table "^0.2.0"
webpack-log "^1.1.2"

"@xtuc/ieee754@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790"
Expand Down Expand Up @@ -5821,7 +5833,7 @@ center-align@^0.1.1:
align-text "^0.1.3"
lazy-cache "^1.0.3"

chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.4.1, chalk@^2.4.2:
chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.3.1, chalk@^2.3.2, chalk@^2.4.1, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
Expand Down Expand Up @@ -13768,6 +13780,20 @@ react-dev-utils@^9.0.0:
strip-ansi "5.2.0"
text-table "0.2.0"

react-docgen-typescript-loader@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/react-docgen-typescript-loader/-/react-docgen-typescript-loader-3.6.0.tgz#5515f03f869e66d49e287c5f1e7ec10f2084f7bb"
integrity sha512-+uEsM3VYCdlcBGxF3tBqI5XWL1phvrh8dkiIfdpciKlM1BDHW+d82kKJI9hX6zk9H8TL+3Th/j/JAEaKb5FFNw==
dependencies:
"@webpack-contrib/schema-utils" "^1.0.0-beta.0"
loader-utils "^1.2.3"
react-docgen-typescript "^1.15.0"

react-docgen-typescript@^1.15.0:
version "1.16.2"
resolved "https://registry.yarnpkg.com/react-docgen-typescript/-/react-docgen-typescript-1.16.2.tgz#d5f26ba6591ac4bc61628c514d492de461ae7c2c"
integrity sha512-nECrg2qih81AKp0smkxXebF72/2EjmEn7gXSlWLDHLbpGcbw2yIorol24fw1FWqvndIY82sfSd0x/SyfMKY1Jw==

react-docgen@^5.0.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-5.1.0.tgz#8e69f1d2e9153c535c20162ea1b85878b059b474"
Expand Down Expand Up @@ -16899,7 +16925,7 @@ webpack-hot-middleware@^2.25.0:
querystring "^0.2.0"
strip-ansi "^3.0.0"

webpack-log@^1.2.0:
webpack-log@^1.1.2, webpack-log@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-1.2.0.tgz#a4b34cda6b22b518dbb0ab32e567962d5c72a43d"
integrity sha512-U9AnICnu50HXtiqiDxuli5gLB5PGBo7VvcHx36jRZHwK4vzOYLbImqT4lwWwoMHdQWwEKw736fCHEekokTEKHA==
Expand Down

0 comments on commit 5b8784a

Please sign in to comment.