import { h, render, Component } from 'preact'; // eslint-disable-line no-unused-vars import HeaderLightItem from './partials/HeaderLightItem.jsx'; import GraphItem from './partials/GraphItem.jsx'; // displays the current Chart Screen depending on mode export default class ChartScreen extends Component { // RENDER render () { const question = this.props.questions[this.props.currentQuestion]; let textKey; // get text depending on mode switch (this.props.mode) { case 'presentation': textKey = 'answer1'; break; case 'comparison': textKey = 'answer2'; break; default: textKey = 'text'; break; } // ... combine and render it return (

{question.texts[this.props.currentStep][textKey].split('\n').map(item => {item}
)}

{ this.props.mode === 'interaction' ?

{question.texts[this.props.currentStep].instruction}

: [] } { question.texts[this.props.currentStep].hint && this.props.mode === 'interaction' ?

{question.texts[this.props.currentStep].hint.split('\n').map(item => {item}
)}

: [] }
{question.source}
{this.props.mode !== 'interaction' || this.props.interactionData.length > 0 ? : [] }
); } }