-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fix postMessage in embedded Contact form #2673
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ea22357
Fix postMessage in embedded Contact form
RoyEJohnson fd96488
Separate embedded form
RoyEJohnson 4ebd25b
Screaming snake case
RoyEJohnson d9697b1
Fix layout issues
RoyEJohnson cac8aac
Link to subjects page instead of errata
RoyEJohnson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,44 @@ | ||
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? Find the book | ||
on our{' '} | ||
<a href="/subjects" target="_blank"> | ||
subjects page | ||
</a>. | ||
{' '}You can submit errata from the details page for the book. | ||
</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:not(.clear-file) { | ||
@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,46 @@ | ||
@import 'pattern-library/core/pattern-library/headers'; | ||
@import '../errata-form/form/FileUploader'; | ||
|
||
form { | ||
textarea { | ||
height: auto; | ||
resize: none; | ||
} | ||
|
||
> .form-content > label { | ||
display: block; | ||
height: $form-element-height; | ||
margin-bottom: $form-element-height; | ||
|
||
&.auto-height { | ||
height: auto; | ||
} | ||
|
||
} | ||
|
||
.file-button { | ||
@include file-button(); | ||
margin-bottom: $normal-margin; | ||
} | ||
|
||
.label-text { | ||
@include set-font(h4); | ||
margin-bottom: 0.5rem; | ||
} | ||
|
||
.btn, | ||
.btn[type="submit"] { | ||
@include button(); | ||
width: 12rem; | ||
padding: 0; | ||
|
||
} | ||
|
||
[type="submit"] { | ||
@extend %primary; | ||
|
||
float: none; | ||
margin: 0; | ||
padding: 0 5rem; | ||
} | ||
} |
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,22 @@ | ||
@mixin file-button() { | ||
align-items: center; | ||
display: grid; | ||
grid-gap: 1rem; | ||
grid-template-columns: repeat(3, auto) 1fr; | ||
|
||
&.empty { | ||
order: 1; | ||
|
||
+ .file-button.empty { | ||
display: none; | ||
} | ||
} | ||
|
||
.clear-file { | ||
appearance: none; | ||
background-color: inherit; | ||
color: inherit; | ||
justify-self: left; | ||
|
||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably need some padding to push the text over or down to accommodate the close button:
(and I think this is on your assignments PR, but seems like some padding issue with that button?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reworked the put-away as a back button in a footer (like the design).
PR for that is:
https://github.com/openstax/assignments/pull/192
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might need some
position: fixed
rules? But I'll let ya'll work that out on that PR