Skip to content

Commit 1bdb713

Browse files
author
Salma Alam-Naylor
committed
Styles for contact form
1 parent bb259cf commit 1bdb713

16 files changed

+303
-50
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ <h6 class="footer__sectionTitle">Who made this?</h6>
5757
<p class="footer__copy footer__copy--right">I'm a musician and software engineer in Manchester, UK. My goal with
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>
60-
<p class="footer__copy footer__copy--right">Feedback/request form coming soon.</p>
60+
<a [routerLink]="['/', 'contact']"
61+
class="footer__copy footer__copy--right footer__copy--link">Submit your feedback</a>
6162
<p class="footer__copy footer__copy--right">The Fretonator is free and always will be!</p>
6263
<a href="https://www.buymeacoffee.com/fretonator"
6364
rel="nofollow noopener noreferrer"

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
flex-direction: column;
6262
justify-content: center;
6363
text-align: center;
64+
margin-bottom: pxToRem($grid-unit * 2);
6465

6566
@media screen and (min-width: $screen-med) {
6667
justify-content: flex-start;
@@ -76,6 +77,12 @@
7677
}
7778
}
7879

80+
.footer__copy--link {
81+
@include text_link();
82+
color: var(--peach);
83+
border-color: var(--peach);
84+
}
85+
7986
.footer__sectionTitle {
8087
@include font_medium();
8188
font-size: pxToRem(18);

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { FooterComponent } from './footer.component';
44
import { Component } from '@angular/core';
5-
import { RouterTestingModule } from '@angular/router/testing';
6-
import { HeaderModule } from '../header/header.module';
75
import { FooterModule } from './footer.module';
6+
import { RouterTestingModule } from '@angular/router/testing';
87

98
describe('FooterComponent', () => {
109
@Component({
@@ -22,7 +21,7 @@ describe('FooterComponent', () => {
2221
beforeEach(async(() => {
2322
TestBed.configureTestingModule({
2423
declarations: [FooterComponentSpec],
25-
imports: [FooterModule]
24+
imports: [FooterModule, RouterTestingModule]
2625
}).compileComponents();
2726
}));
2827

apps/fretonator-web/src/app/common/header/__snapshots__/header.component.spec.ts.snap

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ exports[`HeaderComponent should match snapshot 1`] = `
8989
About
9090
</a>
9191
</li>
92+
<li
93+
class="header__linksItem"
94+
>
95+
<a
96+
class="header__linksItemLink"
97+
href="/contact"
98+
routerlinkactive="header__linksItemLink--active"
99+
>
100+
Contact
101+
</a>
102+
</li>
92103
<li
93104
class="header__linksItem"
94105
>
@@ -98,7 +109,7 @@ exports[`HeaderComponent should match snapshot 1`] = `
98109
rel="nofollow noopener noreferrer"
99110
target="_blank"
100111
>
101-
Support
112+
Donate
102113
</a>
103114
</li>
104115
</ul>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"
2+
class="svg">
3+
<path
4+
d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"></path>
5+
</svg>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.svg {
2+
flex: 1;
3+
height: 100%;
4+
fill: currentColor;
5+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { TickComponent } from './tick.component';
4+
5+
describe('TickComponent', () => {
6+
let component: TickComponent;
7+
let fixture: ComponentFixture<TickComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ TickComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(TickComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-tick-svg',
5+
templateUrl: './tick.component.html',
6+
styleUrls: ['./tick.component.scss']
7+
})
8+
export class TickComponent {
9+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { TickComponent } from './tick.component';
4+
5+
6+
7+
@NgModule({
8+
declarations: [TickComponent],
9+
exports: [
10+
TickComponent
11+
],
12+
imports: [
13+
CommonModule
14+
]
15+
})
16+
export class TickModule { }
Lines changed: 67 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,85 @@
1-
<form [name]="formName"
2-
data-netlify="true"
3-
method="POST"
4-
action="/contact/success"
5-
netlify-honeypot="bot-field"
6-
[formGroup]="form"
7-
(ngSubmit)="onSubmit()">
8-
<div>
9-
<label for="name">
10-
Name
1+
<div class="form__container" #scrollTargetContact>
2+
<h1 class="form__title">Share the love <span role="img" aria-label="red heart emoji">❤️</span></h1>
3+
<p class="form__copy">My goal with
4+
the Fretonator is to crowdsource feedback and ideas to create the ultimate guitar learning hub that's simple,
5+
easy and enjoyable to use.</p>
6+
<p class="form__copy">Noticed a bug? Got an idea for a feature? Want to collaborate? Or just want to say hello? I'd
7+
love to
8+
hear from you. Send
9+
me a message!</p>
10+
<p class="form__copy form__copy--bold">Let's build the Fretonator together.</p>
11+
<form [name]="formName"
12+
data-netlify="true"
13+
method="POST"
14+
action="/contact/success"
15+
netlify-honeypot="bot-field"
16+
class="form"
17+
[formGroup]="form"
18+
(ngSubmit)="onSubmit()">
19+
<label for="name" class="form__label">
20+
Your name *
1121
</label>
12-
<input id="name" name="Name" type="text" formControlName="name">
22+
<div class="form__inputGroup">
23+
<input id="name"
24+
name="Name"
25+
type="text"
26+
formControlName="name"
27+
class="form__input">
28+
<span class="form__validIcon" *ngIf="name.valid">
29+
<app-tick-svg></app-tick-svg>
30+
</span>
31+
</div>
1332
<ng-container *ngIf="name.touched">
14-
<p *ngIf="name.errors?.required">Enter your name, yo!</p>
15-
<p *ngIf="name.errors?.pattern">Please enter a valid name!</p>
16-
<p *ngIf="name.errors?.maxlength">Come on, your name isn't actually {{name.errors?.maxlength.actualLength}}
33+
<p class="form__error" *ngIf="name.errors?.required">Enter your name, yo! A fake one will do.</p>
34+
<p class="form__error" *ngIf="name.errors?.pattern">Please enter a valid name that won't break the form!</p>
35+
<p class="form__error" *ngIf="name.errors?.maxlength">Come on, your name isn't
36+
actually {{name.errors?.maxlength.actualLength}}
1737
characters long!</p>
18-
<pre>{{name.errors | json}}</pre>
1938
</ng-container>
20-
</div>
21-
<div>
22-
<label for="email">
23-
Email
39+
<label for="email" class="form__label">
40+
Your contact email
2441
</label>
25-
<input id="email" name="Email" type="email" formControlName="email">
42+
<div class="form__inputGroup">
43+
<input id="email"
44+
name="Email"
45+
type="email"
46+
formControlName="email"
47+
class="form__input">
48+
<span class="form__validIcon" *ngIf="email.value.length > 0 && email.valid">
49+
<app-tick-svg></app-tick-svg>
50+
</span>
51+
</div>
2652
<ng-container *ngIf="email.touched">
27-
<p *ngIf="email.errors?.email">An email address isn't required, but if you'd like me to reply to your message,
28-
please enter a valid email address!</p>
29-
<pre>{{email.errors | json}}</pre>
53+
<p class="form__error" *ngIf="email.errors?.email">An email address isn't required, but if you'd like me to reply
54+
to your message, please enter a valid one!</p>
3055
</ng-container>
3156

32-
</div>
33-
<div>
34-
<label for="message">
35-
Message
57+
<label for="message" class="form__label">
58+
Your message *
3659
</label>
37-
<textarea id="message" name="Message" formControlName="message"></textarea>
60+
<div class="form__inputGroup">
61+
<textarea id="message"
62+
name="Message"
63+
formControlName="message"
64+
class="form__input form__input--textArea"></textarea>
65+
<span class="form__validIcon form__validIcon--textArea" *ngIf="message.valid">
66+
<app-tick-svg></app-tick-svg>
67+
</span>
68+
</div>
3869
<ng-container *ngIf="message.touched">
39-
<p *ngIf="message.errors?.required">Go on, give me some feedback!</p>
40-
<p *ngIf="message.errors?.minlength">Go on, give me some feedback!</p>
41-
<pre>{{message.errors | json}}</pre>
70+
<p class="form__error" *ngIf="message.errors?.required">Go on, give me some feedback!</p>
71+
<p class="form__error" *ngIf="message.errors?.minlength">Come on, you can write more than that!</p>
4272
</ng-container>
4373

44-
<div>
74+
<div class="form__honeypot">
4575
<label for="bot-field">Don't fill this out if you're human!</label>
4676
<input type="text" id="bot-field" name="bot-field" formControlName="honeypot">
47-
<pre>{{honeypot.errors | json}}</pre>
4877
</div>
4978

5079
<input type="submit" class="form__submit" formControlName="submit" aria-label="Submit Form"/>
51-
<p *ngIf="formSubmitError">Oh no! Didn't work.</p>
52-
</div>
80+
<p class="form__error form__error--global" *ngIf="formSubmitError">Eeesh! Something went wrong when we tried to
81+
submit the form. Please
82+
try again.</p>
5383

54-
</form>
84+
</form>
85+
</div>

0 commit comments

Comments
 (0)