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
import React from 'react' | |
import { connect } from 'react-redux' | |
export default (isActive, loaded = () => true, componentLoadingMap = {}) => | |
({ component = (props) => <div {...props} />, loading = () => null, ...props }) => { | |
const Component = component | |
const Loading = loading | |
if (componentLoadingMap.component) { | |
props.component = componentLoadingMap.component | |
props[componentLoadingMap.component] = undefined |
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
import React, { Component } from 'react' | |
import Toggle from './Toggle' | |
import Message from './Message' | |
export default class Inbox extends Component { | |
render() { | |
return ( | |
<div> | |
<h2>Inbox</h2> | |
<Toggle loaded={state => state.inbox && state.inbox.messages[state.inbox.selectedMessage]} |
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
import { DragDropContext } from 'react-dnd' | |
import HTML5Backend from 'react-dnd-test-backend' | |
import React, { Component } from 'react' | |
import { Provider, connect } from 'react-redux' | |
import { createStore, applyMiddleware } from 'redux' | |
import teaspoon from 'teaspoon' |
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
function renderComponent(ComponentClass, props = {}) { | |
return teaspoon( | |
<ComponentClass {...props} /> | |
).render() | |
} | |
export { renderComponent } |
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
import reducers from '../src/reducers' | |
function renderComponent(ComponentClass, props = {}, state = {}) { | |
const store = createStore(reducers, state) | |
return teaspoon( | |
<Provider store={store}> | |
<ComponentClass {...props} /> | |
</Provider> | |
).render() | |
} |
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
import React, { Component, PropTypes } from 'react' | |
class MyComponent extends Component { | |
static propTypes = { | |
title: PropTypes.string.isRequired, | |
fancy: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), | |
list: PropTypes.array.isRequired, | |
} | |
render() { |
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
import reducers from '../src/reducers' | |
function renderComponent(ComponentClass, props = {}, state = {}) { | |
const store = createStore(reducers, state) | |
class Tester extends Component { | |
constructor(props) { | |
super(props) | |
this.state = props | |
} |
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
import reducers from '../src/reducers' | |
function renderComponent(ComponentClass, props = {}, state = {}, returnStore = false) { | |
const store = createStore(reducers, state) | |
const log = [] | |
const logger = store => next => action => { | |
log.push(action) | |
return next(action) | |
} | |
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
import React, { Component, PropTypes } from 'react' | |
class MyComponent extends Component { | |
static propTypes = { | |
title: PropTypes.string.isRequired, | |
fancy: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), | |
list: PropTypes.array.isRequired, | |
doSomething: PropTypes.func.isRequired, | |
} |
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
module.exports = function(wallaby) { | |
const next = require('postcss-cssnext') | |
const modules = require('postcss-modules') | |
const postcss = require('postcss') | |
const processCss = function(file, done) { | |
postcss([ | |
next, | |
modules({ | |
getJSON: function(filename, json) { |