Skip to content

Instantly share code, notes, and snippets.

View ernestofreyreg's full-sized avatar
🚢
Just ship it

Ernesto Freyre ernestofreyreg

🚢
Just ship it
View GitHub Profile
import React from 'react'
import PropTypes from 'prop-types'
import connect from 'react-setstate-connect'
const CHANGE_VALUE = 'CHANGE_VALUE'
const STOP_CHANGING = 'STOP_CHANGING'
const START_CHANGING = 'START_CHANGING'
const initialState = {
editing: false,
import React from 'react'
import PropTypes from 'prop-types'
class EditableCell extends React.Component {
constructor (props, context) {
super(props, context)
this.state = {
changedValue: null,
editing: false
}
const CHANGE_VALUE = 'CHANGE_VALUE'
const STOP_CHANGING = 'STOP_CHANGING'
const START_CHANGING = 'START_CHANGING'
export const initialState = {
editing: false,
changedValue: null
}
export const reducer = (state, action) => {
import connect from 'react-setstate-connect'
import { initialState, reducer, createActions } from './editable-cell-logic'
const withEditableCellLogic = view => connect(view, reducer, createActions, initialState)
export default withEditableCellLogic
import React from 'react'
import PropTypes from 'prop-types'
import withEditableCellLogic from './with-editable-cell-logic'
const EditableCellView = ({
value,
modifyValue,
editing,
changedValue,
import React from 'react'
const Button = ({title, onClick}) => (
<button className='Button' onClick={onClick}>
{title}
{/*language=CSS*/}
<style jsx>{`
.Button {
background-color: #007dff;
import React from 'react'
import { storiesOf } from '@storybook/react'
import { action } from '@storybook/addon-actions'
import { linkTo } from '@storybook/addon-links'
import {Button} from '../src/index'
storiesOf('Button', module)
.add('simple text', () => <Button title='Hello Button' onClick={action('clicked Hello Button')} />)
import initStoryshots from '@storybook/addon-storyshots'
initStoryshots()
import React from 'react'
const Button = ({title, onClick}) => (
<button className='Button' onClick={onClick}>
{title}
{/*language=CSS*/}
<style jsx>{`
.Button {
background-color: red;
import React from 'react'
const isUrgent = title => {
if (title[0] === '!') {
return true
}
if (title[title.length - 1] === '!') {
return true
}