Skip to content

Commit

Permalink
[Enhancement #51] QuestionCommentIcon implemented in Answer
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Oct 5, 2021
1 parent 1176fdb commit 78040a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/components/Answer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,11 @@ const Answer = (props) => {
/>
) : null;

// TODO implement QuestionCommentIcon
return (
<div>
<span>{label}</span>
{questionHelp}
{/*<QuestionCommentIcon question={question} onChange={}/>*/}
<QuestionCommentIcon question={question} onChange={props.onCommentChange}/>
</div>
);
}
Expand Down Expand Up @@ -187,7 +186,8 @@ Answer.propTypes = {
answer: PropTypes.object.isRequired,
question: PropTypes.object.isRequired,
onChange: PropTypes.func.isRequired,
index: PropTypes.number
index: PropTypes.number,
onCommentChange: PropTypes.func.isRequired
};

export default Answer;
7 changes: 6 additions & 1 deletion src/components/Question.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ export default class Question extends React.Component {
children.push(
<div key={'row-item-' + i} className={cls} id={question['@id']}>
<div className="answer-content" style={this._getAnswerWidthStyle()}>
<Answer index={i} answer={answers[i]} question={question} onChange={this.onAnswerChange} />
<Answer
index={i}
answer={answers[i]}
question={question}
onChange={this.onAnswerChange}
onCommentChange={this.onCommentChange}/>
</div>
{this._renderUnits()}
{this._renderPrefixes()}
Expand Down
16 changes: 1 addition & 15 deletions test/rendering/form1.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,21 +503,7 @@
"@id" : "aircraft-name-9553",
"has-layout-class" : "text",
"@type" : "doc:question",
"has_related_question" : [],
"has-comment" : [
{
"@type" : "form:comment",
"has-comment-value" : "Some comment",
"has-author" : "http://fel.cvut.cz/people/max-chopart",
"has-timestamp" : "1633096904"
},
{
"@type" : "form:comment",
"has-comment-value" : "Another comment",
"has-author" : "http://fel.cvut.cz/people/miroslav-blasko",
"has-timestamp" : "1633096908"
}
]
"has_related_question" : []
},
{
"@id" : "aircraft-number-2375",
Expand Down

0 comments on commit 78040a7

Please sign in to comment.