Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding contact form success message #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { HomeComponent } from './pages/home/home.component';
import { MenuComponent } from './pages/menu/menu.component';
import { AboutComponent } from './pages/about/about.component';
import { ContactComponent } from './pages/contact/contact.component';
import { SuccessComponent } from './pages/success/success.component';

const routes: Routes = [
{
Expand All @@ -23,6 +24,10 @@ const routes: Routes = [
path: 'contact',
component: ContactComponent
},
{
path: 'success',
component: SuccessComponent
},
{
path: '*',
redirectTo: ''
Expand Down
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { MyStoryComponent } from './pages/my-story/my-story.component';
import { MissionComponent } from './pages/mission/mission.component';
import { VisionComponent } from './pages/vision/vision.component';
import { MenuComponent } from './pages/menu/menu.component';
import { SuccessComponent } from './pages/success/success.component';

@NgModule({
declarations: [
Expand All @@ -24,7 +25,8 @@ import { MenuComponent } from './pages/menu/menu.component';
MyStoryComponent,
MissionComponent,
VisionComponent,
MenuComponent
MenuComponent,
SuccessComponent
],
imports: [
BrowserModule,
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/contact/contact.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ <h1>Ready to order?</h1> <br>
</p> <br>

<div class="form-box justify-content-center" style="max-width: 500px; margin: auto;">
<form name="contact-form" class="contact-form text-center border p-5" method="POST" data-netlify="true">
<form name="contact-form" class="contact-form text-center border p-5" method="POST" data-netlify="true" action="/pages/success">
<input type="hidden" name="form-name" value="contact-form" />
<p hidden>
<label>Don’t fill this out if you’re human: <input name="bot-field" /></label>
Expand Down
5 changes: 5 additions & 0 deletions src/app/pages/success/success.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="body-section">
<h2>Thanks for getting in touch!</h2>

<p>We're baking up a sweet reply and will deliver it to you as soon as chef says it's ready.</p>
</div>
17 changes: 17 additions & 0 deletions src/app/pages/success/success.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@import "../../shared/global-variables.scss";

p {
text-align: center;
}

// @media (min-width: 680) {
// .vcenter {
// height: 116px;
// width: 680px;
// position:absolute;
// top:50%;
// left:50%;
// margin-top:-58px; /* this is half the height of your div*/
// margin-left:-340px; /*this is half of width of your div*/
// }
// }
25 changes: 25 additions & 0 deletions src/app/pages/success/success.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SuccessComponent } from './success.component';

describe('SuccessComponent', () => {
let component: SuccessComponent;
let fixture: ComponentFixture<SuccessComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ SuccessComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(SuccessComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/pages/success/success.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-success',
templateUrl: './success.component.html',
styleUrls: ['./success.component.scss']
})
export class SuccessComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</head>

<body>
<form name="contact-form" netlify netlify-honeypot="bot-field" hidden>
<form name="contact-form" netlify netlify-honeypot="bot-field" action="/pages/success" hidden>
<input type="text" name="name" />
<input type="email" name="emailAddress" />
<input type="tel" name="phoneNumber" />
Expand Down