Skip to content

Commit

Permalink
Refactor register command
Browse files Browse the repository at this point in the history
  • Loading branch information
Hichem chaabene authored and Hichem chaabene committed Jun 3, 2019
1 parent 9c3762b commit 7cf7f6a
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 56 deletions.
4 changes: 1 addition & 3 deletions .storybook/addons.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { register } from '../dist/';

register();
import "../register";
43 changes: 12 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
"type": "git",
"url": "git+https://github.com/HichemBenChaaben/storybook-addon-linguijs.git"
},
"keywords": [ "storybook", "storybook-addon", "react-lingui", "i18n", "l10n" ],
"keywords": [
"storybook",
"storybook-addon",
"react-lingui",
"i18n",
"l10n"
],
"license": "MIT",
"author": "Hichem benchaaben",
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require("./dist").register();
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { withLingui, setLinguiConfig } from './preview';
export { register } from './register';
export { withLingui, setLinguiConfig } from "./preview";
export { register } from "./manager";
19 changes: 19 additions & 0 deletions src/manager/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import addons from "@storybook/addons";
import { ADDON_ID, PANEL_ID } from "../shared";
import LocalePanel from "../manager/containers/LocalePanel/index";

export function register() {
addons.register(ADDON_ID, () => {
addons.addPanel(PANEL_ID, {
title: "Locales",
render: props => (
<LocalePanel
key={(props && typeof props === "object" && props.key) || undefined}
active={!props || props.active}
channel={addons.getChannel()}
/>
)
});
});
}
19 changes: 0 additions & 19 deletions src/register/index.js

This file was deleted.

0 comments on commit 7cf7f6a

Please sign in to comment.