Skip to content

Commit a4e77de

Browse files
author
Salma Alam-Naylor
committed
Scroll to top of thanks page and contact page
1 parent a014ea0 commit a4e77de

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

apps/fretonator-web/src/app/common/footer/footer.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h6 class="footer__sectionTitle">Who made this?</h6>
5858
the Fretonator is to crowdsource feedback and ideas to create the ultimate guitar learning hub that's simple,
5959
easy and enjoyable to use.</p>
6060
<a [routerLink]="['/', 'contact']"
61-
(click)="onLinkClick()"
61+
(click)="onClick()"
6262
class="footer__copy footer__copy--right footer__copy--link">Submit your feedback</a>
6363
<p class="footer__copy footer__copy--right">The Fretonator is free and always will be!</p>
6464
<a href="https://www.buymeacoffee.com/fretonator"

apps/fretonator-web/src/app/common/footer/footer.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class FooterComponent {
1212
constructor(private globalService: GlobalService) {
1313
}
1414

15-
onLinkClick() {
15+
onClick() {
1616
this.globalService.getScrollTarget().scrollIntoView();
1717
}
1818
}

apps/fretonator-web/src/app/pages/contact/contact-index/contact-index.component.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { FormErrorMessages } from '../../../util/constants'
1111
templateUrl: './contact-index.component.html',
1212
styleUrls: ['./contact-index.component.scss']
1313
})
14-
export class ContactIndexComponent implements OnInit, AfterViewInit {
14+
export class ContactIndexComponent implements AfterViewInit {
1515
@ViewChild('scrollTarget') scrollTarget: ElementRef<HTMLElement>;
1616
formName = 'Contact';
1717
formSubmitError = false;
@@ -47,11 +47,9 @@ export class ContactIndexComponent implements OnInit, AfterViewInit {
4747
private globalService: GlobalService) {
4848
}
4949

50-
ngOnInit(): void {
51-
}
52-
5350
ngAfterViewInit(): void {
5451
this.globalService.setScrollTarget(this.scrollTarget.nativeElement);
52+
this.globalService.getScrollTarget().scrollIntoView();
5553
}
5654

5755
onSubmit() {

apps/fretonator-web/src/app/pages/contact/contact-success/contact-success.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="success__container">
1+
<div class="success__container" #scrollTarget>
22
<h1 class="success__title">You are amazing! <span role="img" aria-label="raising hands emoji">🙌🏼️</span></h1>
33
<p class="success__copy">I can't thank you enough for your feedback. I will endeavour to reply to all messages when I
44
can.</p>
@@ -14,5 +14,5 @@ <h2 class="success__subtitle">Want to get involved?</h2>
1414
pull request.</p>
1515
<a [routerLink]="['/']"
1616
class="success__cta"
17-
(click)="clickLink()">Return to the Fretonator</a>
17+
(click)="onClick()">Return to the Fretonator</a>
1818
</div>
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
import { Component } from '@angular/core';
1+
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
22
import { GlobalService } from '../../../global.service';
33

44
@Component({
55
selector: 'app-contact-success',
66
templateUrl: './contact-success.component.html',
77
styleUrls: ['./contact-success.component.scss']
88
})
9-
export class ContactSuccessComponent {
9+
export class ContactSuccessComponent implements AfterViewInit {
10+
@ViewChild('scrollTarget') scrollTarget: ElementRef<HTMLElement>;
1011

1112
constructor(private globalService: GlobalService) {
1213
}
1314

14-
clickLink() {
15+
ngAfterViewInit(): void {
16+
this.globalService.setScrollTarget(this.scrollTarget.nativeElement);
17+
this.globalService.getScrollTarget().scrollIntoView();
18+
}
19+
20+
onClick() {
1521
this.globalService.getScrollTarget().scrollIntoView();
1622
}
1723
}

apps/fretonator-web/src/app/pages/not-found/not-found-index/not-found-index.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@
4040
cursor: pointer;
4141
margin-left: auto;
4242
margin-right: auto;
43+
color: var(--offwhite);
4344
}

apps/fretonator-web/src/app/util/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ export const FormErrorMessages = {
649649
},
650650
message: {
651651
required: 'Go on, give me some feedback!',
652-
minLength: 'Keep typing, you\'re doing great.',
652+
minLength: 'Keep typing, you\'re doing great. (Give me at least 30 characters please!)',
653653
general: 'Oops! There\'s something wrong with the message field.'
654654
}
655655
};

0 commit comments

Comments
 (0)