This file contains hidden or 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 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, |
This file contains hidden or 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 PropTypes from 'prop-types' | |
class EditableCell extends React.Component { | |
constructor (props, context) { | |
super(props, context) | |
this.state = { | |
changedValue: null, | |
editing: false | |
} |
This file contains hidden or 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 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) => { |
This file contains hidden or 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 connect from 'react-setstate-connect' | |
import { initialState, reducer, createActions } from './editable-cell-logic' | |
const withEditableCellLogic = view => connect(view, reducer, createActions, initialState) | |
export default withEditableCellLogic |
This file contains hidden or 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 PropTypes from 'prop-types' | |
import withEditableCellLogic from './with-editable-cell-logic' | |
const EditableCellView = ({ | |
value, | |
modifyValue, | |
editing, | |
changedValue, |
This file contains hidden or 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' | |
const Button = ({title, onClick}) => ( | |
<button className='Button' onClick={onClick}> | |
{title} | |
{/*language=CSS*/} | |
<style jsx>{` | |
.Button { | |
background-color: #007dff; |
This file contains hidden or 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 { 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')} />) |
This file contains hidden or 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 initStoryshots from '@storybook/addon-storyshots' | |
initStoryshots() |
This file contains hidden or 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' | |
const Button = ({title, onClick}) => ( | |
<button className='Button' onClick={onClick}> | |
{title} | |
{/*language=CSS*/} | |
<style jsx>{` | |
.Button { | |
background-color: red; |
This file contains hidden or 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' | |
const isUrgent = title => { | |
if (title[0] === '!') { | |
return true | |
} | |
if (title[title.length - 1] === '!') { | |
return true | |
} |