Skip to content

Commit

Permalink
[Enhancement #51] QuestionCommentIcon is now closer of the text of ic…
Browse files Browse the repository at this point in the history
…on, '@value' removed from /has-comment, UI tweaking
  • Loading branch information
LaChope committed Oct 8, 2021
1 parent 78040a7 commit 362a6d7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 16 deletions.
29 changes: 23 additions & 6 deletions src/components/Question.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,16 @@ export default class Question extends React.Component {
{label}
</h6>
</div>
<div className="col-sm-auto">
{this._renderQuestionHelp()}
</div>
<div className="col-sm-1">
{this._renderQuestionComment()}
</div>
{this._renderQuestionHelp() ?
<>
<div className="col-sm-auto">
{this._renderQuestionHelp()}
</div>
<div className="col-sm-auto">
{this._renderQuestionComment()}
</div>
</>
: this._renderQuestionComment()}
</div>
</Accordion.Toggle>
{collapsible ? <Accordion.Collapse>{cardBody}</Accordion.Collapse> : { cardBody }}
Expand All @@ -172,6 +176,19 @@ export default class Question extends React.Component {
}
}

_renderTest() {
return (
<>
<div className="col-sm-auto">
{this._renderQuestionHelp()}
</div>
<div className="col-sm-1">
{this._renderQuestionComment()}
</div>
</>
)
}

_renderQuestionContent() {
let content = [];
if (this.state.expanded) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/comment/NewComment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ const NewComment = (props) => {
return (
<CommentForm
onSaveComment={saveCommentHandler}
onChange={props.onValueChange}
onChange={props.onCommentValueChange}
/>
)
}

NewComment.propTypes = {
onAddComment: PropTypes.func.isRequired,
onChange: PropTypes.func.isRequired,
onValueChange: PropTypes.func.isRequired,
onCommentValueChange: PropTypes.func.isRequired,
comment: PropTypes.array.isRequired
};

Expand Down
14 changes: 7 additions & 7 deletions src/components/comment/QuestionCommentIcon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ const QuestionCommentIcon = (props) => {
return question[Constants.HAS_COMMENT];
};

const onValueChange = (value) => {
const onCommentValueChangeHandler = (value) => {
const change = {};
_setValue(change, value);
_setComment(change, value);
props.onChange(commentIndex, change);
};

const _setValue = (change, value) => {
const _setComment = (change, value) => {
change[Constants.HAS_COMMENT_VALUE] = {
'@id' : value
[Constants.HAS_COMMENT_VALUE] : value
}
change[Constants.HAS_AUTHOR] = {
'@value' : context.options.currentUser
[Constants.HAS_AUTHOR] : context.options.currentUser
}
change[Constants.HAS_TIMESTAMP] = {
'@value' : Date.now()
[Constants.HAS_TIMESTAMP] : Date.now()
}
};

Expand All @@ -73,7 +73,7 @@ const QuestionCommentIcon = (props) => {
<NewComment
onAddComment={addCommentHandler}
onChange={props.onChange}
onValueChange={onValueChange}
onCommentValueChange={onCommentValueChangeHandler}
comment={_getComments()}
/>
<CommentList
Expand Down
12 changes: 11 additions & 1 deletion src/styles/s-forms.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ input:disabled {

.comment-tooltip > .tooltip-inner {
max-width: none;
width: 30vw;
max-height: 400px;
width: 800px;
border: solid 2px #afafaf;
background-color: #cbeef6;
color: #000000;
overflow: hidden scroll;
}

.comment-content {
Expand All @@ -207,6 +212,11 @@ input:disabled {
padding-top: 20px;
}

.comment-timestamp {
color: #696969;
font-style: italic;
}

@keyframes emphasiseOnRelevant {
0% {
display: none;
Expand Down

0 comments on commit 362a6d7

Please sign in to comment.