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 reduce from 'universal-reduce' | |
const transduce = (put, initial) => (collection, ...xfs) => | |
reduce(collection, (accum, value, key) => | |
put( | |
accum, | |
key, | |
reduce(xfs, (result, xf) => xf(result), value) | |
), | |
initial |
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
const branchDispatch = (obj, table, defaultFn) => | |
Object.entries(obj) | |
.map(([key, value]) => | |
table[key] != null | |
? [key, table[key](value)] | |
: typeof defaultFn === 'function' | |
? [key, defaultFn(value)] | |
: [key, undefined] | |
) | |
.reduce((results, [key, value]) => { |
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 instyled, { flatKeyed } from 'instyled' | |
import cascade from 'cascade' | |
const CheckboxContainer = instyled(flatKeyed(cascade({ | |
display: 'flex', | |
width: 'fit-content', | |
padding: 10, | |
borderRadius: 7, | |
background: 'gray', |
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 Icon from 'react-fa' | |
import hoverable from 'lib/hocs/hoverable' | |
import instyled, { flatKeyed } from 'instyled' | |
import cascade from 'cascade' | |
export const EditButton = hoverable( | |
instyled( | |
flatKeyed( | |
cascade({ | |
position: 'absolute', |
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
export function makeConnector (store) { | |
return function connect(mapStateToProps, mapDispatchToProps, mergeProps, options = {}) { | |
// same stuff | |
return function wrapWithConnect(WrappedComponent) { | |
return class Connect extends Component { | |
// same stuff | |
constructor(props) { | |
super(props) | |
this.store = props.store || store | |
// same stuff |
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 hoverable (WrappedComponent, propName = 'hover') { | |
return class HoverableComponent extends Component { | |
constructor (props) { | |
super(props) | |
this.state = { hovered: false } | |
} | |
turnHoverOn () { | |
this.setState({ hovered: true }) |
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 { default as React, Component } from 'react'; | |
function makeElements () { | |
return [ | |
<h1>Hello</h1>, | |
<h1>World,</h1>, | |
<h1>How</h1>, | |
<h1>are</h1>, | |
<h1>you?</h1> | |
] |
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
class Foo extends Bar () { | |
constructor () { | |
super(); | |
this.bar = 'fubar'; | |
} | |
} | |
export function FooFactory (...args) { | |
return new Foo(...args); | |
} |
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
const path = require('path'); | |
module.exports = { | |
entry: './main.js', | |
output: { | |
publicPath: '/assets', | |
filename: 'bundle.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
import React from 'react'; | |
import { FlexContext, FlexBox } from 'flex'; | |
const { Component } = React; | |
class Container extends Component { | |
render () { | |
console.log('Rendering Container'); | |
return ( | |
<g> |