-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
 https://deploy-preview-437--nifty-wozniak-71a44b.netlify.app/cloud/overview --------- Co-authored-by: Oliver Howell <[email protected]>
- Loading branch information
1 parent
fca52b8
commit c4d39d3
Showing
9 changed files
with
441 additions
and
27 deletions.
There are no files selected for viewing
Binary file not shown.
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,71 @@ | ||
@keyframes animatetop { | ||
from { | ||
top: -300px; | ||
opacity: 0; | ||
} | ||
|
||
to { | ||
top: 0; | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes fadeIn { | ||
from { | ||
opacity: 0; | ||
} | ||
|
||
to { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
.overlay { | ||
display: none; | ||
position: fixed; | ||
z-index: 1; | ||
left: 0; | ||
top: 0; | ||
width: 100%; | ||
height: 100%; | ||
overflow: auto; | ||
background-color: rgba(0, 0, 0, 0.4); | ||
animation-name: fadeIn; | ||
animation-duration: 0.4s; | ||
} | ||
|
||
.overlay.open { | ||
display: block; | ||
} | ||
|
||
.overlay-content { | ||
background-color: #fefefe; | ||
margin: 15vh auto 0; | ||
padding: 20px; | ||
border: 1px solid #888; | ||
border-radius: 10px; | ||
width: fit-content; | ||
max-width: 1000px; | ||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); | ||
animation-name: animatetop; | ||
animation-duration: 0.4s; | ||
position: relative; | ||
} | ||
|
||
.close-overlay { | ||
position: absolute; | ||
top: 1rem; | ||
right: 1rem; | ||
color: var(--neutral-light); | ||
font-size: 28px; | ||
line-height: 0.5; | ||
font-weight: bold; | ||
transition: color 300ms; | ||
} | ||
|
||
.close-overlay:hover, | ||
.close-overlay:focus { | ||
color: black; | ||
text-decoration: none; | ||
cursor: pointer; | ||
} |
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,73 @@ | ||
const feedbackForm = document.getElementById('feedback-form') | ||
const additionalTextualFeedback = document.getElementById('additional-textual-feedback') | ||
const overlay = document.getElementById('feedback-overlay') | ||
const helpfulFeedbackWidget = document.getElementById('helpful-feedback-widget') | ||
const feedbackSubmitSuccess = document.getElementById('feedback-submit-success') | ||
const submitBtn = document.getElementById('feedback-form-submit-btn') | ||
|
||
const handleSubmit = (event) => { | ||
event.preventDefault() | ||
submitBtn.setAttribute('disabled', '') | ||
|
||
// eslint-disable-next-line no-undef | ||
const formData = new FormData(feedbackForm) | ||
|
||
// eslint-disable-next-line no-undef | ||
fetch('/', { | ||
method: 'POST', | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
body: new URLSearchParams(formData).toString(), | ||
}) | ||
.then(() => console.debug('Thank you for your feedback')) | ||
.catch((error) => console.error(error)) | ||
submitBtn.removeAttribute('disabled') | ||
overlay.classList.remove('open') | ||
feedbackSubmitSuccess.classList.remove('hidden') | ||
helpfulFeedbackWidget.classList.add('hidden') | ||
} | ||
|
||
const openFormContainer = (containerToOpen, containerToClose, radioToCheck, radioToUncheck) => { | ||
feedbackForm.reset() | ||
document.getElementById(containerToOpen).classList.remove('hidden') | ||
document.getElementById(containerToClose).classList.add('hidden') | ||
document.getElementById(radioToCheck).setAttribute('checked', '') | ||
document.getElementById(radioToUncheck).removeAttribute('checked') | ||
overlay.classList.add('open') | ||
} | ||
|
||
const showPositiveFeedbackForm = () => { | ||
openFormContainer( | ||
'positive-feedback-form-container', | ||
'negative-feedback-form-container', | ||
'yes', | ||
'no' | ||
) | ||
} | ||
|
||
const showNegativeFeedbackForm = () => { | ||
openFormContainer( | ||
'negative-feedback-form-container', | ||
'positive-feedback-form-container', | ||
'no', | ||
'yes' | ||
) | ||
} | ||
|
||
const changeFeedbackAdditionalTextPlacement = (event) => { | ||
// eslint-disable-next-line no-undef | ||
const formData = new FormData(feedbackForm) | ||
const feedbackValue = formData.get('feedback') | ||
const selectedRadioButton = document.querySelector(`[value="${feedbackValue}"]`) | ||
selectedRadioButton.parentNode.insertAdjacentElement('afterend', additionalTextualFeedback) | ||
} | ||
|
||
const closeOverlay = () => { | ||
feedbackForm.reset() | ||
overlay.classList.remove('open') | ||
} | ||
|
||
feedbackForm.addEventListener('submit', handleSubmit) | ||
feedbackForm.addEventListener('change', changeFeedbackAdditionalTextPlacement) | ||
document.getElementById('close-feedback-overlay').addEventListener('click', closeOverlay) | ||
document.getElementById('positive-feedback-starter').addEventListener('click', showPositiveFeedbackForm) | ||
document.getElementById('negative-feedback-starter').addEventListener('click', showNegativeFeedbackForm) |
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
Oops, something went wrong.