-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
178 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import Form from './form'; | ||
import './embedded.scss'; | ||
|
||
// File is js because it is dynamically imported (and minimal) | ||
export default function EmbeddedForm() { | ||
const [submitted, setSubmitted] = React.useState(false); | ||
|
||
if (submitted) { | ||
return <ThankYou />; | ||
} | ||
|
||
return ( | ||
<main id="maincontent" className="embedded-contact"> | ||
<h1>Report an issue</h1> | ||
<div> | ||
Need to suggest a content correction instead? Fill out the{' '} | ||
<a href="/errata" target="_blank"> | ||
errata form | ||
</a> | ||
. | ||
</div> | ||
<Form setSubmitted={setSubmitted} /> | ||
</main> | ||
); | ||
} | ||
|
||
function ThankYou() { | ||
const signalDone = React.useCallback( | ||
() => window.parent.postMessage('contact form submitted', '*'), | ||
[] | ||
); | ||
|
||
return ( | ||
<main id="maincontent" className="embedded-contact"> | ||
<h1>Thanks for contacting us.</h1> | ||
<div>Someone from our team will follow up with you soon.</div> | ||
<button type="button" className="btn primary" onClick={signalDone}> | ||
Done | ||
</button> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@import 'pattern-library/core/pattern-library/headers'; | ||
|
||
.embedded-contact { | ||
max-width: calc(100vw - 6rem); | ||
width: $text-content-max; | ||
margin: 3rem auto; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 2rem; | ||
|
||
h1 { | ||
@include set-font(h3); | ||
margin: 0; | ||
} | ||
|
||
form { | ||
@include wider-than($tablet-max) { | ||
padding-left: 4rem; | ||
} | ||
} | ||
|
||
button { | ||
@include button(); | ||
|
||
&.primary { | ||
@extend %primary; | ||
align-self: flex-start; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@import 'pattern-library/core/pattern-library/headers'; | ||
|
||
form { | ||
textarea { | ||
height: auto; | ||
resize: none; | ||
} | ||
|
||
> .form-content > label { | ||
display: block; | ||
height: $form-element-height; | ||
margin-bottom: $form-element-height; | ||
|
||
&.auto-height { | ||
height: auto; | ||
} | ||
|
||
} | ||
|
||
.label-text { | ||
@include set-font(h4); | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
.btn, | ||
.btn[type="submit"] { | ||
@include button(); | ||
margin-bottom: $normal-margin; | ||
width: 12rem; | ||
padding: 0; | ||
|
||
} | ||
|
||
[type="submit"] { | ||
@extend %primary; | ||
|
||
float: none; | ||
margin: 0; | ||
padding: 0 5rem; | ||
} | ||
} |