Files
old-tellall/web/src/components/IntentItem.js

34 lines
1.1 KiB
JavaScript
Raw Normal View History

2017-11-30 17:43:24 +01:00
import React, { Component } from 'react';
2017-12-01 11:03:48 +01:00
import {Button} from 'react-md';
2017-11-30 17:43:24 +01:00
import '../css/Intent.css'
class IntentItem extends Component {
constructor(props){
super(props);
this.state={intent: props.intent, index: props.index, onClick: props.onClick};
}
render() {
2017-12-01 11:03:48 +01:00
/*
<div className={this.props.selectedIndex===this.state.index ? 'IntentItem-selected' : 'IntentItem'} onClick={()=>{this.state.onClick(this.state.intent,this.state.index)}}>
<Button className={"IntentItem"} flat swapTheming>OK</Button>
2017-11-30 17:43:24 +01:00
<p> {this.state.index+1}. {this.state.intent.questions[0]} </p>
</div>
2017-12-01 11:03:48 +01:00
*/
return (
<div>
<Button className={this.props.selectedIndex===this.state.index ? 'IntentItem-selected' : 'IntentItem'}
onClick={()=>{this.state.onClick(this.state.intent,this.state.index)}}
flat>
{this.state.index+1}. {this.state.intent.questions[0]}
</Button>
<br></br>
</div>
2017-11-30 17:43:24 +01:00
);
}
}
export default IntentItem;