-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(): update logic in generator (#2)
* wip * add storybooks * add react and react-dom for dev * add jazzicon story * yarn add --dev @storybook/addon-knobs/register * add knobs addon * update jazzicon story file * wip * add jsNumberForAddress * update readme * fixes * update stories * bump version to 0.0.2 * bump version to 0.1.0
- Loading branch information
1 parent
d0d94a8
commit 4721938
Showing
9 changed files
with
4,911 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-knobs/register'; | ||
import '@storybook/addon-links/register'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
// automatically import all files ending in *.stories.js | ||
const req = require.context('../stories', true, /.stories.js$/); | ||
function loadStories() { | ||
req.keys().forEach(filename => req(filename)); | ||
} | ||
|
||
configure(loadStories, module); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import Jazzicon from './Jazzicon'; | ||
import jsNumberForAddress from './jsNumberForAddress'; | ||
|
||
export default Jazzicon; | ||
export { jsNumberForAddress }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default function jsNumberForAddress (address) { | ||
const addr = address.slice(2, 10); | ||
const seed = parseInt(addr, 16); | ||
|
||
return seed; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
|
||
import { storiesOf } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { withKnobs, text, boolean, number } from '@storybook/addon-knobs'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
|
||
import Jazzicon, { jsNumberForAddress } from '../src'; | ||
|
||
const stories = storiesOf('Jazzicon', module); | ||
|
||
// Add the `withKnobs` decorator to add knobs support to your stories. | ||
// You can also configure `withKnobs` as a global decorator. | ||
stories.addDecorator(withKnobs); | ||
|
||
// Knobs for React props | ||
stories.add('default', () => ( | ||
<Jazzicon diameter={100} seed={text('seed', jsNumberForAddress('0x1111111111111111111111111111111111111111'))} /> | ||
)); |
Oops, something went wrong.