Skip to content

Instantly share code, notes, and snippets.

import styled from 'styled-components';
import Card from 'blocks/Card/card';
function withElements(props) {
const modifiers = Object.keys(props).filter(propName =>
propName.startsWith('_'),
)
return [props.className, ...modifiers].join(' ')
}
import { comp, into, map, filter } from 'transducers-js'
/* eslint-disable no-return-assign */
// setReducer :: (a -> {a}) -> ({b} -> {a})
// add reducers that are missing from the store
const setReducer = injectedReducers => ({key, reducer}) => injectedReducers[key] = reducer
/* eslint-enable */
// hasReducer :: (a -> {a}) -> ({b} -> bool)
// returns a boolean based if the reducer to inject exists already or not
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import hoistNonReactStatics from 'hoist-non-react-statics'
import isEmpty from 'lodash/isEmpty'
import { createUpdatedReducer } from '../store'
import { setupNewReducers } from './reducer-injector-helper.utility'
const getDisplayName = ({displayName, name}) => `withReducer(${displayName || name || 'component'})`
export function injectReducerFactory (store) {
@Nauthiz-Jera
Nauthiz-Jera / gist:28d959700b00269d769679339b4f7579
Last active October 30, 2018 15:39
Playing with Folktale
const Either = folktale.result;
const Maybe = folktale.maybe;
const {task} = folktale.concurrency;
const fetchResult = (value) => {
if (typeof value !== 'number'){
throw 'not a number!'
} else {
return value
}
@Nauthiz-Jera
Nauthiz-Jera / collapsableHoc.js
Last active October 30, 2018 15:42
Collapsable HOC
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Collapsable from './collaspable-hoc-styles';
const getDisplayName = ({displayHelpScreen, name}) => displayHelpScreen || name || 'Component';
export default function CollapsibleWrapper(defaultCollapseValue = true, displayToggle = true) {
return WrappedComponent =>
class CollapsibleComponent extends PureComponent {