Skip to content

Commit

Permalink
Resolve packages names to example imports (#300)
Browse files Browse the repository at this point in the history
* add packages names in examples import

* storybook/add webpack configurations
  • Loading branch information
Ahmad Atallah authored and Chance Strickland committed Oct 14, 2019
1 parent 1cd033a commit 7f9fde3
Show file tree
Hide file tree
Showing 49 changed files with 101 additions and 54 deletions.
35 changes: 35 additions & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const path = require("path");

module.exports = ({ config }) => {
const packagesPath = path.resolve(__dirname, "../packages");
config.resolve = {
...config.resolve,
alias: {
"@reach/alert": path.join(packagesPath, "/alert/src/"),
"@reach/alert-dailog": path.join(packagesPath, "/alert-dailog/src/"),
"@reach/auto-id": path.join(packagesPath, "/auto-id/src/"),
"@reach/combobox": path.join(packagesPath, "/combobox/src/"),
"@reach/component-component": path.join(
packagesPath,
"/component-component/src/"
),
"@reach/dailog": path.join(packagesPath, "/dailog/src/"),
"@reach/menu-button": path.join(packagesPath, "/menu-button/src/"),
"@reach/popover": path.join(packagesPath, "/popover/src/"),
"@reach/portal": path.join(packagesPath, "/portal/src/"),
"@reach/rect": path.join(packagesPath, "/rect/src/"),
"@reach/skip-nav": path.join(packagesPath, "/skip-nav/src/"),
"@reach/slider": path.join(packagesPath, "/slider/src/"),
"@reach/tabs": path.join(packagesPath, "/tabs/src/"),
"@reach/tooltip": path.join(packagesPath, "/tooltip/src/"),
"@reach/utils": path.join(packagesPath, "/utils/src/"),
"@reach/visually-hidden": path.join(
packagesPath,
"/visually-hidden/src/"
),
"@reach/window-size": path.join(packagesPath, "/window-size/src/")
},
extensions: [".js"]
};
return config;
};
6 changes: 3 additions & 3 deletions packages/alert/examples/basic.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Alert from "../src/index";
import Component from "../../component-component/src";
import VisuallyHidden from "../../visually-hidden/src";
import Alert from "@reach/alert";
import Component from "@reach/component-component";
import VisuallyHidden from "@reach/visually-hidden";

export let name = "Basic";

Expand Down
2 changes: 1 addition & 1 deletion packages/combobox/examples/basic.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ComboboxList,
ComboboxOption,
ComboboxPopover
} from "../src/index";
} from "@reach/combobox";
import matchSorter from "match-sorter";
import { useThrottle } from "use-throttle";
import cities from "./cities";
Expand Down
2 changes: 1 addition & 1 deletion packages/combobox/examples/controlled.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ComboboxList,
ComboboxOption,
ComboboxPopover
} from "../src/index";
} from "@reach/combobox";
import matchSorter from "match-sorter";
import { useThrottle } from "use-throttle";
import cities from "./cities";
Expand Down
2 changes: 1 addition & 1 deletion packages/combobox/examples/lots-of-elements.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ComboboxList,
ComboboxOption,
ComboboxPopover
} from "../src/index";
} from "@reach/combobox";
import matchSorter from "match-sorter";
import { useThrottle } from "use-throttle";
import cities from "./cities";
Expand Down
2 changes: 1 addition & 1 deletion packages/combobox/examples/no-popover.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ComboboxList,
ComboboxPopover,
ComboboxOption
} from "../src/index";
} from "@reach/combobox";
import matchSorter from "match-sorter";
import { useThrottle } from "use-throttle";
import cities from "./cities";
Expand Down
2 changes: 1 addition & 1 deletion packages/combobox/examples/with-button.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ComboboxPopover,
ComboboxOption,
ComboboxButton
} from "../src/index";
} from "@reach/combobox";
import matchSorter from "match-sorter";
import { useThrottle } from "use-throttle";
import cities from "./cities";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Component from "../src/index";
import Component from "@reach/component-component";

export let name = "Lifecycles and Refs";

Expand Down
2 changes: 1 addition & 1 deletion packages/component-component/examples/state.example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Component from "../src/index";
import Component from "@reach/component-component";

export let name = "Basic State";

Expand Down
2 changes: 1 addition & 1 deletion packages/component-component/examples/todo-list.example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment } from "react";
import Component from "../src/index";
import Component from "@reach/component-component";

export let name = "Kitchen Sink Todo List";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/aria-hides-content.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Aria Hides Content";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/autofocus.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Autofocus";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/basic.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Basic";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/change-styles.example.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { useTransition, animated, config } from "react-spring/web.cjs";
import { DialogOverlay, DialogContent } from "../src/index";
import { DialogOverlay, DialogContent } from "@reach/dialog";
import "../styles.css";

export let name = "Change Styles";
Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/destroy-trigger.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Destroy Trigger";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/dismiss.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Dismiss";

Expand Down
4 changes: 2 additions & 2 deletions packages/dialog/examples/dropdown.example.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import Component from "@reach/component-component";
import { Menu, MenuButton, MenuList, MenuItem } from "../../menu-button";
import { Menu, MenuButton, MenuList, MenuItem } from "@reach/menu-button";
import "../styles.css";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Dropdown";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/long-content.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Long Content";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/nested.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "Nested";

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/examples/no-tabbables.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import Component from "@reach/component-component";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Dialog } from "../src/index";
import { Dialog } from "@reach/dialog";

export let name = "No Tabbables";

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/basic.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuButton, MenuItem } from "../src/index";
import { Menu, MenuList, MenuButton, MenuItem } from "@reach/menu-button";

export let name = "Basic";

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/conditional-items.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuButton, MenuItem } from "../src/index";
import { Menu, MenuList, MenuButton, MenuItem } from "@reach/menu-button";

export let name = "Conditional Items";

Expand Down
8 changes: 7 additions & 1 deletion packages/menu-button/examples/long-text.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuLink, MenuButton, MenuItem } from "../src/index";
import {
Menu,
MenuList,
MenuLink,
MenuButton,
MenuItem
} from "@reach/menu-button";

export let name = "Long Text";

Expand Down
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
@@ -1,7 +1,7 @@
import React from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuButton, MenuItem } from "../src/index";
import { Menu, MenuList, MenuButton, MenuItem } from "@reach/menu-button";

export let name = "Non Menu Children";

Expand Down
2 changes: 1 addition & 1 deletion packages/menu-button/examples/render-callback.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuButton, MenuItem } from "../src/index";
import { Menu, MenuList, MenuButton, MenuItem } from "@reach/menu-button";

export let name = "Render Callback";

Expand Down
8 changes: 7 additions & 1 deletion packages/menu-button/examples/with-links.example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuButton, MenuLink, MenuItem } from "../src/index";
import {
Menu,
MenuList,
MenuButton,
MenuLink,
MenuItem
} from "@reach/menu-button";
import {
Router,
Link,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuButton, MenuItem } from "../src/index";
import { Menu, MenuList, MenuButton, MenuItem } from "@reach/menu-button";

export let name = "With Other Tabbables";

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 @@ -3,7 +3,7 @@
import React from "react";
import "../styles.css";
import { action } from "@storybook/addon-actions";
import { Menu, MenuList, MenuButton, MenuItem } from "../src/index";
import { Menu, MenuList, MenuButton, MenuItem } from "@reach/menu-button";
import Tooltip from "../../tooltip";

export let name = "With Tooltip";
Expand Down
2 changes: 1 addition & 1 deletion packages/popover/examples/basic.example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef, useState } from "react";
import Popover, { positionDefault, positionMatchWidth } from "../src/index";
import Popover, { positionDefault, positionMatchWidth } from "@reach/popover";

export let name = "Basic";

Expand Down
2 changes: 1 addition & 1 deletion packages/portal/examples/basic.example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Portal from "../src/index";
import Portal from "@reach/portal";

export let name = "Basic";

Expand Down
2 changes: 1 addition & 1 deletion packages/rect/examples/basic.example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Rect from "../src/index";
import Rect from "@reach/rect";

export let name = "Basic";

Expand Down
2 changes: 1 addition & 1 deletion packages/rect/examples/pin.example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Rect from "../src/index";
import Rect from "@reach/rect";

export let name = "Pin element to another";

Expand Down
2 changes: 1 addition & 1 deletion packages/rect/examples/use-rect.example.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef } from "react";
import { useRect } from "../src/index";
import { useRect } from "@reach/rect";

export const name = "useRect";

Expand Down
2 changes: 1 addition & 1 deletion packages/slider/examples/basic.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SliderTrack,
SliderTrackHighlight,
SliderMarker
} from "../src";
} from "@reach/slider";

export const name = "Basic";

Expand Down
2 changes: 1 addition & 1 deletion packages/slider/examples/contained-handle.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SliderHandle,
SliderTrack,
SliderTrackHighlight
} from "../src";
} from "@reach/slider";

export const name = "Contained Handle";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
SliderHandle,
SliderTrack,
SliderTrackHighlight
} from "../src";
} from "@reach/slider";
import { useAudio, timeToMs, msToTime } from "./utils";

export const name = "Audio Progress";
Expand Down
2 changes: 1 addition & 1 deletion packages/slider/examples/controlled.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SliderMarker,
SliderTrack,
SliderTrackHighlight
} from "../src";
} from "@reach/slider";

export const name = "Controlled";

Expand Down
2 changes: 1 addition & 1 deletion packages/slider/examples/vertical.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SliderMarker,
SliderTrack,
SliderTrackHighlight
} from "../src";
} from "@reach/slider";

export const name = "Vertical";

Expand Down
2 changes: 1 addition & 1 deletion packages/slider/examples/with-steps.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SliderMarker,
SliderTrack,
SliderTrackHighlight
} from "../src";
} from "@reach/slider";

export const name = "With Steps";

Expand Down
6 changes: 3 additions & 3 deletions packages/slider/examples/with-tooltip.example.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from "react";
import { useTooltip, TooltipPopup } from "../../tooltip/src";
import { wrapEvent } from "../../utils/src";
import { useTooltip, TooltipPopup } from "@reach/tooltip";
import { wrapEvent } from "@reach/utils";
import "../styles.css";
import {
Slider,
SliderHandle,
SliderTrack,
SliderTrackHighlight
} from "../src";
} from "@reach/slider";

export const name = "With Tooltip";

Expand Down
Loading

0 comments on commit 7f9fde3

Please sign in to comment.