Skip to content

Commit

Permalink
fix: not showing form popup after send
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Fernandez Teixeira committed Jul 5, 2024
1 parent 47a67af commit 44a282e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 13 deletions.
6 changes: 5 additions & 1 deletion cardapio/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,14 @@ <h2>Carrinho</h2>
<div id='cart-items' class="sidebar-content">
<p id="emptycart">Seu carrinho está vazio.</p>
</div>

<div class="cart-footer">
<p>Total: R$<span id="cart-total">0.00</span></p>
<button id="clear-cart-btn">Remover Todos</button>
<button id="checkout-btn" onclick="showCustomAlert()">Finalizar Compra</button>
<button id="checkout-btn" onclick="showCustomAlert()">Finalizar Compra

</button>

<div id="custom-alert" class="custom-alert hidden">
<div class="custom-alert-content">
<span class="btn-close" onclick="closeCustomAlert()">&times;</span>
Expand Down
7 changes: 6 additions & 1 deletion contato/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ <h1>Contato</h1>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="5" required></textarea>

<button id="submit" type="submit">Submit</button>
<button id="submit" onclick="showCustomAlert()">Submit</button>
<div id="custom-alert" class="custom-alert hidden">
<div class="custom-alert-content">
<span class="btn-close" onclick="closeCustomAlert()">&times;</span>
<p>Obrigado pelo FeedBack!</p>
<button id="closeSubmit"onclick="closeCustomAlert()">Fechar</button>
</form>
<div id="successMessage" class="hidden">Thank you for contacting us!</div>
<!-- Popup Modal -->
Expand Down
17 changes: 11 additions & 6 deletions contato/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@ document
var message = document.getElementById("message").value;

if (name && email && message) {
document.getElementById("successMessage").classList.remove("hidden");
document.getElementById("successMessage").classList.add("visible");

document.getElementById("modalMessage").textContent =
document.getElementById("successMessage").textContent;
document.getElementById("successModal").style.display = "block";
// Clear the form fields
document.getElementById("contactForm").reset();
} else {
document.getElementById("successMessage").classList.remove("visible");
document.getElementById("successMessage").classList.add("hidden");
}
});

Expand All @@ -54,3 +51,11 @@ window.onclick = function (event) {
modal.style.display = "none";
}
};
// Mostrar popup ao enviar formulário
function showCustomAlert() {
document.getElementById("custom-alert").classList.remove("hidden");
}
// Fechar popup do formulário
function closeCustomAlert() {
document.getElementById("custom-alert").classList.add("hidden");
}
44 changes: 39 additions & 5 deletions contato/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,19 @@ a {
animation: appear 1s backwards;
}

.contact-form {
animation: appear 1s backwards;
}

h1 {
animation-delay: 0.2s;
}

p {
animation-delay: 0.8s;
animation-delay: 0.5s;
}

a {
animation-delay: 1.6s;
}
.contact-form {
animation: appear 1s backwards;
animation-delay: 0.5s;
background-color: rgba(245, 222, 179, 0.8);
}
Expand Down Expand Up @@ -273,3 +270,40 @@ ul {
width: 100%;
}
}

.custom-alert {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
}

.custom-alert-content {
background-color: white;
padding: 30px;
border-radius: 5px;
text-align: center;
position: relative;
color: #111;
}
.custom-alert-content p {
animation: appear 0.4s backwards;
padding-bottom: 15px;
}
.btn-close {
position: absolute;
top: 10px;
right: 10px;
cursor: pointer;
font-size: 20px;
}

.hidden {
display: none;
}

0 comments on commit 44a282e

Please sign in to comment.