forked from steemit/condenser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9accc43
commit 461fe75
Showing
28 changed files
with
623 additions
and
12 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 @@ | ||
import '@storybook/addon-knobs/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,10 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
const req = require.context('../src/app/components', true, /story\.jsx$/); | ||
|
||
function loadStories() { | ||
req.keys().forEach(req); | ||
} | ||
|
||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require('babel-register'); | ||
module.exports = require('../webpack/storybook.config.js'); |
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 @@ | ||
#!/bin/bash | ||
|
||
declare -A components | ||
|
||
for file in $1/*.jsx | ||
do | ||
name=${file##*/} | ||
base=${name%.jsx} | ||
cd ./src | ||
count=$(grep -r -o "<$base" | wc -l) | ||
components+=([$base]=$count) | ||
cd ../ | ||
done | ||
|
||
for i in "${!components[@]}" | ||
do | ||
echo "$i: ${components[$i]}" | ||
done | | ||
sort -rn -k2 |
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
File renamed without changes.
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,22 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import Author from './Author'; | ||
import { Center } from './Tooltip.story'; | ||
import { IntlProvider } from 'react-intl'; | ||
|
||
const store = createStore(rootReducer); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('Author', () => ( | ||
<IntlProvider locale="en"> | ||
<Center> | ||
<Author author={'maitland'} /> | ||
</Center> | ||
</IntlProvider> | ||
)); |
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,17 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, select } from '@storybook/addon-knobs'; | ||
import Callout from './Callout'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const selectOptions = ['error', 'default']; | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.add('Callout', () => ( | ||
<Center> | ||
<Callout type={select('Callout style', selectOptions, 'default')}> | ||
<span> Callout, you can add an error style with the knob</span> | ||
</Callout> | ||
</Center> | ||
)); |
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,44 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, select } from '@storybook/addon-knobs'; | ||
import DropdownMenu from './DropdownMenu'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const selectOptions = ['transfer', 'transfer to savings', 'power up']; | ||
|
||
const mockMenu = [ | ||
{ | ||
value: 'transfer', | ||
link: '#', | ||
onClick: () => {}, | ||
}, | ||
{ | ||
value: 'transfer to savings', | ||
link: '#', | ||
onClick: () => {}, | ||
}, | ||
{ | ||
value: 'power up', | ||
link: '#', | ||
onClick: () => {}, | ||
}, | ||
]; | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.add('DropdownMenu', () => ( | ||
<Center> | ||
<h3>Dropdown Menu</h3> | ||
<DropdownMenu | ||
title={'Other actions'} | ||
key="_others" | ||
items={mockMenu} | ||
el={'div'} | ||
selected={select( | ||
'Currently Selected', | ||
selectOptions, | ||
'power up' | ||
)} | ||
/> | ||
</Center> | ||
)); |
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,26 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, boolean } from '@storybook/addon-knobs'; | ||
import FoundationDropdown from './FoundationDropdown'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.add('FoundationDropdown', () => ( | ||
<Center> | ||
<h3> Use the Knob to toggle the Foundation Dropdown </h3> | ||
<FoundationDropdown | ||
show={boolean('Is Open?', false)} | ||
onHide={() => | ||
alert( | ||
'You clicked someplace that triggered the onHide prop.' | ||
) | ||
} | ||
> | ||
<div className="Voting__adjust_weight"> | ||
<h3> Cool Stuff </h3> | ||
<p> Has a handler to detect outside clicks...</p> | ||
</div> | ||
</FoundationDropdown> | ||
</Center> | ||
)); |
46 changes: 46 additions & 0 deletions
46
src/app/components/elements/FoundationDropdownMenu.story.jsx
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,46 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, select } from '@storybook/addon-knobs'; | ||
import FoundationDropdownMenu from './FoundationDropdownMenu'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const positionOptions = ['bottom', 'top']; | ||
|
||
const alignmentOptions = ['left', 'right']; | ||
|
||
const mockMenu = [ | ||
{ | ||
value: 'transfer', | ||
link: '#', | ||
onClick: () => {}, | ||
}, | ||
{ | ||
value: 'transfer to savings', | ||
link: '#', | ||
onClick: () => {}, | ||
}, | ||
{ | ||
value: 'power up', | ||
link: '#', | ||
onClick: () => {}, | ||
}, | ||
]; | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.add('FoundationDropdownMenu', () => ( | ||
<Center> | ||
<h3> Foundation Dropdown Menu</h3> | ||
<FoundationDropdownMenu | ||
className="Wallet_dropdown" | ||
dropdownPosition={select('position', positionOptions, 'bottom')} | ||
dropdownAlignment={select( | ||
'alignment', | ||
alignmentOptions, | ||
'right' | ||
)} | ||
label={8 + ' Jahweh'} | ||
menu={mockMenu} | ||
/> | ||
</Center> | ||
)); |
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,6 +1,6 @@ | ||
import React from 'react'; | ||
|
||
const icons = [ | ||
export const icons = [ | ||
'user', | ||
'share', | ||
'chevron-up-circle', | ||
|
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,29 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, select } from '@storybook/addon-knobs'; | ||
import Icon from './Icon'; | ||
import { icons } from './Icon'; | ||
|
||
const styles = { | ||
textAlign: 'center', | ||
display: 'grid', | ||
gridTemplateColumns: 'repeat(3, 1fr)', | ||
gridAutoRows: 'minmax(80px, auto)', | ||
}; | ||
|
||
export const Grid = ({ children }) => <div style={styles}>{children}</div>; | ||
|
||
const options = ['1x', '1_5x', '2x', '3x', '4x', '5x', '10x']; | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.add('Icon', () => ( | ||
<Grid> | ||
{icons.map(icon => ( | ||
<div key={'icon_' + icon}> | ||
<Icon name={icon} size={select('size', options, '2x')} /> | ||
<p> {icon} </p> | ||
</div> | ||
))} | ||
</Grid> | ||
)); |
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,8 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import LoadingIndicator from './LoadingIndicator'; | ||
import styles from './LoadingIndicator.scss'; | ||
|
||
storiesOf('Elements', module).add('LoadingIndicator', () => ( | ||
<LoadingIndicator /> | ||
)); |
26 changes: 26 additions & 0 deletions
26
src/app/components/elements/MarkNotificationRead.story.jsx
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,26 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs } from '@storybook/addon-knobs'; | ||
import rootReducer from 'app/redux/RootReducer'; | ||
import { Provider } from 'react-redux'; | ||
import { createStore } from 'redux'; | ||
import MarkNotificationRead from './MarkNotificationRead'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const store = createStore(rootReducer); | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.addDecorator(getStory => <Provider store={store}>{getStory()}</Provider>) | ||
.add('MarkNotificationRead', () => ( | ||
<Center> | ||
<p> | ||
{' '} | ||
This is a curious component, that will always render null...{' '} | ||
</p> | ||
<MarkNotificationRead | ||
fields={'send,receive'} | ||
account={'maitland'} | ||
/> | ||
</Center> | ||
)); |
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,36 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, number } from '@storybook/addon-knobs'; | ||
import NotifiCounter from './NotifiCounter'; | ||
import { Center } from './Tooltip.story'; | ||
|
||
const options = { | ||
range: true, | ||
min: 0, | ||
max: 1001, | ||
step: 1, | ||
}; | ||
|
||
const mockStore = { | ||
dispatch: () => {}, | ||
value: 300, | ||
subscribe: () => {}, | ||
getState: () => ({ | ||
app: { | ||
get: () => { | ||
return { | ||
get: () => number('number of notifications', 10, options), | ||
}; | ||
}, | ||
}, | ||
}), | ||
}; | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.add('NotifCounter', () => ( | ||
<Center> | ||
<NotifiCounter store={mockStore} fields={'not relevant'} /> | ||
<span> Notifications</span> | ||
</Center> | ||
)); |
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,34 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, select } from '@storybook/addon-knobs'; | ||
import Orderbook from './Orderbook'; | ||
|
||
const selectOptions = ['error', 'default']; | ||
|
||
const mockOrder = { | ||
getSBDAmount: () => 999, | ||
getStringSBD: () => 'nine hundred and ninety nine', | ||
getStringSteem: () => 'two hundred steem', | ||
getStringPrice: () => '55', | ||
equals: () => 55, | ||
}; | ||
|
||
const mockOrder2 = { | ||
getSBDAmount: () => 111, | ||
getStringSBD: () => 'one hundred and eleven', | ||
getStringSteem: () => 'one steem', | ||
getStringPrice: () => '55', | ||
equals: () => 55, | ||
}; | ||
|
||
storiesOf('Elements', module) | ||
.addDecorator(withKnobs) | ||
.add('Orderbook', () => ( | ||
<Orderbook | ||
side={'bids'} | ||
orders={[mockOrder, mockOrder2]} | ||
onClick={price => { | ||
setFormPrice(price); | ||
}} | ||
/> | ||
)); |
Oops, something went wrong.