improve comment form: cancel button and full width

This commit is contained in:
Rigel Kent 2019-12-15 22:44:31 +01:00
parent dd4f25eea8
commit 88adad2d0f
No known key found for this signature in database
GPG Key ID: 5E53E96A494E452F
5 changed files with 29 additions and 5 deletions

View File

@ -16,9 +16,12 @@
</div>
</div>
<div class="submit-comment">
<div class="comment-buttons">
<button *ngIf="isAddButtonDisplayed()" class="cancel-button" (click)="cancelCommentReply()" i18n>
Cancel
</button>
<button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid || addingComment }" i18n>
Post comment
Reply
</button>
</div>
</form>

View File

@ -30,18 +30,29 @@ form {
}
}
.submit-comment {
.cancel-button {
font-weight: $font-semibold;
display: inline-block;
padding: 0 10px 0 10px;
white-space: nowrap;
background: transparent;
}
.comment-buttons {
display: flex;
justify-content: flex-end;
button {
@include peertube-button;
@include orange-button;
&:last-child {
@include orange-button;
}
}
}
@media screen and (max-width: 600px) {
textarea, .submit-comment button {
textarea, .comment-buttons button {
font-size: 14px !important;
}

View File

@ -26,6 +26,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
@Input() focusOnInit = false
@Output() commentCreated = new EventEmitter<VideoCommentCreate>()
@Output() cancel = new EventEmitter()
@ViewChild('visitorModal', { static: true }) visitorModal: NgbModal
@ViewChild('textarea', { static: true }) textareaElement: ElementRef
@ -145,4 +146,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit {
return this.videoCommentService
.addCommentThread(this.video.id, commentCreate)
}
private cancelCommentReply () {
this.cancel.emit(null)
}
}

View File

@ -50,6 +50,7 @@
[parentComments]="newParentComments"
[focusOnInit]="true"
(commentCreated)="onCommentReplyCreated($event)"
(cancel)="onResetReply()"
></my-video-comment-add>
<div *ngIf="commentTree" class="children">

View File

@ -19,6 +19,10 @@
}
}
.right {
width: 100%;
}
.comment-avatar {
@include avatar(36px);