Add ui for answers from source
This commit is contained in:
62
web/src/components/AnswerSource.js
Normal file
62
web/src/components/AnswerSource.js
Normal file
@@ -0,0 +1,62 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Button, SelectionControlGroup } from 'react-md';
|
||||
import Modal from './modal/Modal';
|
||||
|
||||
class AnswerSource extends Component {
|
||||
constructor(props){
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
isModalOpen: false
|
||||
};
|
||||
}
|
||||
|
||||
onOpen() {
|
||||
this.setState({
|
||||
isModalOpen: true
|
||||
});
|
||||
}
|
||||
|
||||
onClose() {
|
||||
this.setState({
|
||||
isModalOpen: false
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
let modal;
|
||||
if (this.state.isModalOpen) {
|
||||
modal = (
|
||||
<Modal
|
||||
title="Predefined answers"
|
||||
actions={[
|
||||
<Button flat swapTheming onClick={this.onClose.bind(this)} key="cancel">Cancel</Button>,
|
||||
<Button flat primary swapTheming key="save">Save</Button>
|
||||
]}>
|
||||
<SelectionControlGroup
|
||||
id="answer-source"
|
||||
name="answer-source"
|
||||
type="radio"
|
||||
label="Import answer from:"
|
||||
controls={[{
|
||||
label: 'RSS feed - latest',
|
||||
value: 'latest',
|
||||
}]}>
|
||||
|
||||
</SelectionControlGroup>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<Button flat primary swapTheming
|
||||
onClick={this.onOpen.bind(this)}>
|
||||
Predefined answers
|
||||
</Button>
|
||||
{modal}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default AnswerSource;
|
||||
Reference in New Issue
Block a user