-
Notifications
You must be signed in to change notification settings - Fork 486
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): Make component reactive to external events. Api has changed
- Loading branch information
Showing
6 changed files
with
76 additions
and
5 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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import {createAction} from 'redux-actions' | ||
|
||
export const updateLane = createAction('UPDATE_LANE') | ||
export const addCard = createAction('ADD_CARD') | ||
export const removeCard = createAction('REMOVE_CARD') |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import {storiesOf} from '@kadira/storybook'; | ||
|
||
import {Board} from '../src'; | ||
|
||
const data = require('./data.json'); | ||
|
||
let publish = undefined | ||
|
||
let setHandle = (handle) => { | ||
publish = handle.publishHook | ||
} | ||
|
||
const completeMilkEvent = () => { | ||
publish({type: 'ADD_CARD', laneId: 'COMPLETED', card: {id: "Milk", title: "Buy Milk", label: "15 mins", description: "Use Headspace app"}}) | ||
publish({type: 'REMOVE_CARD', laneId: 'PLANNED', cardId: "Milk"}) | ||
} | ||
|
||
const addBlockedEvent = () => { | ||
publish({type: 'ADD_CARD', laneId: 'BLOCKED', card: {id: "Ec2Error", title: "EC2 Instance Down", label: "30 mins", description: "Main Ec2 instance down"}}) | ||
} | ||
|
||
storiesOf('react-trello', module) | ||
|
||
.addWithInfo('Realtime Events', | ||
'This is an illustration of external events that modify the cards in the board', | ||
() => ( | ||
<div> | ||
<button onClick={completeMilkEvent} style={{margin: 5}}>Complete Buy Milk</button> | ||
<button onClick={addBlockedEvent} style={{margin: 5}}>Add Blocked</button> | ||
<Board data={data} | ||
callbackHandle={setHandle}/> | ||
</div> | ||
)); |
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