import React from 'react'; import { connect } from 'react-redux' class NarrativeCard extends React.Component { constructor() { super(); this.state = { step: 0 } } goToPrevKeyFrame() { if (this.state.step > 0) { this.setState({ step: this.state.step - 1 }); } } goToNextKeyFrame() { if (this.state.step < this.props.narrative.steps.length - 1) { this.setState({ step: this.state.step + 1 }); } } componentDidUpdate() { if (this.props.narrative !== null) { const step = this.props.narrative.steps[this.state.step]; this.props.onSelect([step]); } } renderClose() { return ( ) } render() { if (this.props.narrative !== null && this.props.narrative.steps[this.state.step]) { const steps = this.props.narrative.steps; const step = steps[this.state.step]; return (
{this.props.narrative.description}