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
| @connect(selector, { ...actionCreatorsEditBook, ...actionCreatorsSearch }) | |
| export default class BookViewingList extends React.Component { |
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 {render} from 'react-dom'; | |
| import React, {Component, Children, cloneElement} from 'react'; | |
| class CurrentTime extends Component { | |
| state = {time: ''}; | |
| componentDidMount() { | |
| this._interval = setInterval(() => this.setState({time: this.getTime()}), 50); | |
| } | |
| componentWillUnmount() { | |
| clearInterval(this._interval); |
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, { Children, Component, cloneElement} from 'react'; | |
| import Collapse from 'react-collapse'; | |
| export default class RunAccordion extends Component { | |
| state = {xShown: false, yShown: false}; | |
| addX = () => this.setState({xShown: true}); | |
| addY = () => this.setState({yShown: true}); | |
| removeX = () => this.setState({xShown: false}); | |
| removeY = () => this.setState({yShown: 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, { Children, Component, cloneElement} from 'react'; | |
| import Collapse from 'react-collapse'; | |
| class AccordionItem extends Component { | |
| render() { | |
| let {expanded, caption, onToggle, name, children, ...rest} = this.props; | |
| return ( | |
| <div> | |
| <a onClick={() => onToggle(name)}>{caption}</a> | |
| <Collapse isOpened={expanded}> |
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
| class Accordion extends Component { | |
| constructor(props) { | |
| super(props); | |
| let state = {openedHash: {}}; | |
| Children.toArray(props.children).forEach(child => { | |
| if (child){ | |
| state.openedHash[child.props.name] = !!child.props.defaultOpen | |
| } | |
| }); |
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
| class Accordion extends Component { | |
| constructor(props) { | |
| super(props); | |
| let state = {openedHash: {}}; | |
| Children.toArray(props.children).forEach(child => { | |
| if (child){ | |
| state.openedHash[child.props.name] = !!child.props.defaultOpen | |
| } | |
| }); |
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
| class Accordion extends Component { | |
| constructor(props) { | |
| super(props); | |
| let state = {openedHash: {}}; | |
| Children.toArray(props.children).forEach(child => { | |
| if (child){ | |
| state.openedHash[child.props.name] = !!child.props.defaultOpen | |
| } | |
| }); |
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
| export default class RunAccordion extends Component { | |
| state = {a: false, b: true, c: false, x: false, y: false, xShown: false, yShown: false}; | |
| addX = () => this.setState({xShown: true}); | |
| addY = () => this.setState({yShown: true}); | |
| removeX = () => this.setState({xShown: false}); | |
| removeY = () => this.setState({yShown: false}); | |
| expandAll = () => this.setState({ a: true, b: true, c: true, x: true, y: true }) | |
| collapseAll = () => this.setState({ a: false, b: false, c: false, x: false, y: false }) | |
| toggleTab = name => this.setState({[name]: !this.state[name]}); |
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
| class Accordion extends Component { | |
| constructor(props) { | |
| super(props); | |
| let state = {openedHash: {}}; | |
| Children.toArray(props.children).forEach(child => { | |
| if (child){ | |
| state.openedHash[child.props.name] = !!child.props.defaultOpen | |
| } | |
| }); |
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
| class AccordionItem extends Component { | |
| render() { | |
| let {expanded, caption, onToggle, name, children, render, ...rest} = this.props; | |
| return ( | |
| render | |
| ? render({onToggle: onToggle.bind(null, name), expanded}) | |
| : ( | |
| <div> | |
| <a onClick={() => onToggle(name)}>{caption}</a> | |
| <Collapse isOpened={expanded}> |