Skip to content

Commit

Permalink
refactor: rename FeedbackControl to RatingControl
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav committed Dec 8, 2023
1 parent 8d9e5c9 commit 6a791b4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<form [formGroup]="feedbackForm" class="feedback-form">
<form
[formGroup]="feedbackForm"
class="feedback-form"
(ngSubmit)="submitForm()">
<legend class="feedback-form-title">Tell us what you think</legend>
<input
class="feedback-form-control"
Expand All @@ -10,8 +13,7 @@
[formControl]="feedbackForm.controls.email"
placeholder="Email"
type="text" />
<app-feedback-control (ratingUpdated)="rating = $event">
</app-feedback-control>
<app-rating-control (ratingUpdated)="rating = $event"> </app-rating-control>
<textarea
class="feedback-form-control"
[formControl]="feedbackForm.controls.comment"
Expand All @@ -20,9 +22,8 @@
class="feedback-form-submit"
type="submit"
[disabled]="
feedbackForm.touched && (rating === null || feedbackForm.invalid)
"
(click)="submitForm()">
!feedbackForm.touched || rating === null || feedbackForm.invalid
">
Submit
</button>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { Validators } from '@angular/forms';
import { FormControl } from '@angular/forms';
import { FormGroup } from '@angular/forms';
import { ReactiveFormsModule } from '@angular/forms';
import { FeedbackControlComponent } from '../feedback-control/feedback-control.component';
import { RatingControlComponent } from '../rating-control/rating-control.component';

@Component({
standalone: true,
imports: [FeedbackControlComponent, ReactiveFormsModule],
imports: [RatingControlComponent, ReactiveFormsModule],
selector: 'app-feedback-form',
templateUrl: 'feedback-form.component.html',
styleUrls: ['feedback-form.component.scss'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { Component } from '@angular/core';

@Component({
standalone: true,
selector: 'app-feedback-control',
templateUrl: 'feedback-control.component.html',
styleUrls: ['feedback-control.component.scss'],
selector: 'app-rating-control',
templateUrl: 'rating-control.component.html',
styleUrls: ['rating-control.component.scss'],
})
export class FeedbackControlComponent {
export class RatingControlComponent {
@Output()
readonly ratingUpdated: EventEmitter<string> = new EventEmitter<string>();

Expand Down

0 comments on commit 6a791b4

Please sign in to comment.