Skip to content

Commit

Permalink
✨front-end updates and loading for contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosSouza committed Sep 12, 2024
1 parent 90a2cd7 commit 86c8942
Show file tree
Hide file tree
Showing 8 changed files with 327 additions and 84 deletions.
18 changes: 15 additions & 3 deletions content/contact.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type: page
---

<form id="contactForm" method="post">
<form id="contactForm">
<div class="form-group">
<label for="name">Name *</label>
<input type="text" id="name" name="name" placeholder="Your Name..." required>
Expand All @@ -17,5 +17,17 @@
<label for="message">Message *</label>
<textarea id="message" name="message" placeholder="Your Message..." rows="6" required></textarea>
</div>
<button type="submit">Submit</button>
</form>
<button type="submit" id="submitButton">
<span class="button-text">Send</span>
<svg class="loading-svg" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
</svg>
</button>
</form>
<div id="thankYouMessage" style="display: none;">
<h3>Thank you!</h3>
<p>Your message has been sent successfully.</p>
</div>

<script src="https://cdn.jsdelivr.net/npm/@emailjs/browser@3/dist/email.min.js"></script>
<script src="/js/contact-form.js"></script>
219 changes: 206 additions & 13 deletions themes/bruno/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,120 @@ nav {
}

.menu {
display: none;
}
.menu-open{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(243, 243, 242, 0); /* Start with transparent background */
opacity: 0;
visibility: hidden;
transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease;
z-index: 1000;
display: flex;
gap: 10px;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 30px;
pointer-events: none; /* Prevent interaction when hidden */
}

.menu-open {
opacity: 1;
visibility: visible;
background-color: rgba(243, 243, 242, 1); /* Fully opaque when open */
pointer-events: auto; /* Allow interaction when visible */
}

.menu a {
font-size: 24px;
text-decoration: none;
background-color: white;
padding: 10%;
width: 100%;
height: 100%;
color: #aaa;
transition: color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
opacity: 0;
transform: translateY(20px);
}

.menu a.active {
color: #444;
}

.menu-open a {
opacity: 1;
transform: translateY(0);
transition: color 0.3s ease, opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.menu-close {
position: absolute;
top: 20px;
right: 20px;
font-size: 24px;
cursor: pointer;
border: none;
background: none;
opacity: 0;
transition: opacity 0.3s ease;
}

.menu-open .menu-close {
opacity: 1;
}

/* Stagger the animation for menu items */
.menu a:nth-child(1) { transition-delay: 0.1s; }
.menu a:nth-child(2) { transition-delay: 0.2s; }
.menu a:nth-child(3) { transition-delay: 0.3s; }
/* Add more if you have more menu items */

/* Ensure menu is hidden on larger screens if needed */
@media (min-width: 769px) {
.menu {
position: static;
opacity: 1;
visibility: visible;
background-color: transparent;
pointer-events: auto;
flex-direction: row;
justify-content: center; /* Center the menu items */
height: auto;
margin-top: 10px;
}

.menu a {
margin: 0 10px;
text-decoration: none;
color: #666;
font-weight: 300;
text-transform: none;
font-size: 40px;
padding-left: 40px;
opacity: 1;
transform: translateY(0);
transition: none;
}

.menu-toggle, .menu-close {
display: none;
}

header {
margin-left: auto;
margin-right: auto;
padding-bottom: 40px;
padding-top: 70px;
}

nav {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.logo {
margin-bottom: 125px;
}
}

.menu-toggle {
Expand All @@ -60,9 +163,9 @@ nav {

.menu-toggle .bar {
width: 25px;
height: 3px;
height: 2px;
background-color: #333;
margin: 3px 0;
margin: 2px 0;
}
.all-works{
padding-top: 25px;
Expand Down Expand Up @@ -307,7 +410,11 @@ button[type="submit"]:hover {
padding-bottom: 16px;
}


@media (min-width: 262px){
.logo {
white-space: nowrap;
}
}
@media (min-width: 541px) {
.logo{
font-size: 33px;
Expand Down Expand Up @@ -349,7 +456,7 @@ button[type="submit"]:hover {
@media (min-width: 769px) {
.menu {
display: flex;
margin-top: 10px;
margin-top: 30px;
}
.menu a {
margin: 0 10px;
Expand All @@ -369,7 +476,9 @@ button[type="submit"]:hover {
.menu-toggle {
display: none;
}

.menu-close{
display: none;
}
nav {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -488,3 +597,87 @@ button[type="submit"]:hover {
}
}

/* Add these new styles for the video container */
.video-container {
position: relative;
padding-bottom: 56.25%; /* 16:9 aspect ratio */
height: 0;
overflow: hidden;
max-width: 100%;
margin-bottom: 20px; /* Add some space below the video */
}

.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

/* Adjust the existing styles for project-details video */
.project-details video {
width: 100%;
max-width: 100%;
height: auto;
padding-bottom: 20px;
}


#submitButton {
position: relative;
transition: background-color 0.3s;
}

#submitButton .button-text {
transition: opacity 0.3s;
}

#submitButton .loading-svg {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: none;
animation: spin 1s linear infinite;
}

#submitButton.loading .button-text {
opacity: 0;
}

#submitButton.loading .loading-svg {
display: block;
}

@keyframes spin {
0% { transform: translate(-50%, -50%) rotate(0deg); }
100% { transform: translate(-50%, -50%) rotate(360deg); }
}

#thankYouMessage {
text-align: center;
padding: 20px;
background-color: #f0f0f0;
border-radius: 5px;
margin-top: 20px;
}

#submitButton .loading-svg circle {
stroke-dasharray: 60;
stroke-dashoffset: 60;
animation: circle-animation 1.5s cubic-bezier(0.78, 0.13, 0.15, 0.86) infinite;
}

@keyframes circle-animation {
0% {
stroke-dashoffset: 60;
}
50% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: -60;
}
}

19 changes: 11 additions & 8 deletions themes/bruno/assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
document.addEventListener("DOMContentLoaded", function() {
new VenoBox({
selector: ".open-modal",
bgcolor: '#ffffff',
overlayColor: 'rgba(255, 255, 255, 0.85)',
maxWidth: '85%',
toolsColor: '#d2d2d2',
});
// hamburger mobile menu
let menuToggle = document.querySelector('.menu-toggle');
let menu = document.querySelector('.menu');

menuToggle.addEventListener('click', () => {
menu.classList.toggle('menu-open');
})

let menuClose = document.querySelector('.menu-close');
menuClose.addEventListener('click', () => {
menu.classList.remove('menu-open');
})
22 changes: 18 additions & 4 deletions themes/bruno/assets/js/contact-form.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
(function() {
// Inicialize o EmailJS com sua chave pública
emailjs.init("l3aDxyNn-8gbF6W4Y");

document.getElementById('contactForm').addEventListener('submit', function(event) {
const form = document.getElementById('contactForm');
const submitButton = document.getElementById('submitButton');
const thankYouMessage = document.getElementById('thankYouMessage');

form.addEventListener('submit', function(event) {
event.preventDefault();

// Disable the submit button and show loading
submitButton.disabled = true;
submitButton.classList.add('loading');

emailjs.sendForm('service_8zgyk4l', 'template_kvshg7o', this)
.then(function() {
console.log('SUCCESS!');
alert('Mensagem enviada com sucesso!');
// Hide the form and show the thank you message
form.style.display = 'none';
thankYouMessage.style.display = 'block';
}, function(error) {
console.log('FAILED...', error);
alert('Falha ao enviar a mensagem. Por favor, tente novamente.');
alert('Failed to send the message. Please try again.');
})
.finally(function() {
// Re-enable the submit button and hide loading
submitButton.disabled = false;
submitButton.classList.remove('loading');
});
});
})();
9 changes: 9 additions & 0 deletions themes/bruno/assets/js/portfolio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
document.addEventListener("DOMContentLoaded", function() {
new VenoBox({
selector: ".open-modal",
bgcolor: '#ffffff',
overlayColor: 'rgba(255, 255, 255, 0.85)',
maxWidth: '85%',
toolsColor: '#d2d2d2',
});
})
4 changes: 2 additions & 2 deletions themes/bruno/layouts/_default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<section class="all-works">
<!-- Get the works page -->
{{ $works := .Site.GetPage "/works" }}
<!-- Iterate over all works pages -->
{{ range $works.Pages }}
<!-- Iterate over all works pages, sorted by year in descending order -->
{{ range sort $works.Pages ".Params.year" "desc" }}
<div class="project">
<a href="{{ .RelPermalink }}">
<!-- Check for JPG, PNG, and WebP thumbnails -->
Expand Down
Loading

0 comments on commit 86c8942

Please sign in to comment.