Skip to content

Commit 86eddd1

Browse files
committed
feat: update footer layout
Signed-off-by: David Lima <antdavidlima@gmail.com>
1 parent 2f8e926 commit 86eddd1

16 files changed

Lines changed: 977 additions & 641 deletions

File tree

lang/cs/main.json

Lines changed: 18 additions & 6 deletions
Large diffs are not rendered by default.

lang/en/main.json

Lines changed: 17 additions & 16 deletions
Large diffs are not rendered by default.

lang/fr/main.json

Lines changed: 65 additions & 53 deletions
Large diffs are not rendered by default.

lang/nb-NO/main.json

Lines changed: 97 additions & 85 deletions
Large diffs are not rendered by default.

lang/pt-BR/main.json

Lines changed: 145 additions & 133 deletions
Large diffs are not rendered by default.

lang/ta/main.json

Lines changed: 144 additions & 132 deletions
Large diffs are not rendered by default.

source/_assets/js/main.js

Lines changed: 84 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,49 @@ require('aos/dist/aos.css');
44
(function () {
55
"use strict";
66

7-
window.onscroll = function () {
8-
// show or hide the back-top-top button
9-
const backToTop = document.querySelector(".back-to-top");
10-
if (
11-
document.body.scrollTop > 50 ||
12-
document.documentElement.scrollTop > 50
13-
) {
14-
backToTop.style.display = "flex";
15-
} else {
16-
backToTop.style.display = "none";
7+
// Debounce function to improve performance
8+
function debounce(func, wait) {
9+
let timeout;
10+
return function executedFunction(...args) {
11+
const later = () => {
12+
clearTimeout(timeout);
13+
func(...args);
14+
};
15+
clearTimeout(timeout);
16+
timeout = setTimeout(later, wait);
17+
};
18+
}
19+
20+
// Show or hide scroll-dependent elements
21+
function handleScrollElements() {
22+
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
23+
const backToTop = document.querySelector("#back-to-top");
24+
const footerContact = document.querySelector("#footer-contact");
25+
const shouldShow = scrollTop > 50;
26+
27+
if (backToTop) {
28+
if (shouldShow) {
29+
backToTop.classList.add("visible");
30+
backToTop.setAttribute("aria-hidden", "false");
31+
} else {
32+
backToTop.classList.remove("visible");
33+
backToTop.setAttribute("aria-hidden", "true");
34+
}
1735
}
18-
};
36+
37+
if (footerContact) {
38+
if (shouldShow) {
39+
footerContact.classList.add("visible");
40+
footerContact.setAttribute("aria-hidden", "false");
41+
} else {
42+
footerContact.classList.remove("visible");
43+
footerContact.setAttribute("aria-hidden", "true");
44+
}
45+
}
46+
}
47+
48+
// Attach scroll handler with debounce
49+
window.addEventListener("scroll", debounce(handleScrollElements, 10));
1950

2051
//===== close navbar-collapse when a clicked
2152
let navbarToggler = document.querySelector(".navbar-toggler");
@@ -77,7 +108,46 @@ require('aos/dist/aos.css');
77108
return (-c / 2) * (t * (t - 2) - 1) + b;
78109
};
79110

80-
document.querySelector(".back-to-top").onclick = () => {
81-
scrollTo(document.documentElement);
82-
};
111+
// Back to top button functionality
112+
const backToTopBtn = document.querySelector(".back-to-top");
113+
if (backToTopBtn) {
114+
backToTopBtn.addEventListener("click", (e) => {
115+
e.preventDefault();
116+
scrollTo(document.documentElement);
117+
});
118+
119+
// Keyboard support
120+
backToTopBtn.addEventListener("keydown", (e) => {
121+
if (e.key === "Enter" || e.key === " ") {
122+
e.preventDefault();
123+
scrollTo(document.documentElement);
124+
}
125+
});
126+
}
127+
128+
// Footer contact functionality
129+
const footerContact = document.querySelector("#footer-contact");
130+
if (footerContact) {
131+
const handleContactClick = () => {
132+
// Add your contact/sales redirect logic here
133+
// For example: window.location.href = '/contact-us' or open a modal
134+
const contactLink = footerContact.getAttribute("data-contact-url");
135+
if (contactLink) {
136+
window.location.href = contactLink;
137+
}
138+
};
139+
140+
footerContact.addEventListener("click", handleContactClick);
141+
142+
// Keyboard support
143+
footerContact.addEventListener("keydown", (e) => {
144+
if (e.key === "Enter" || e.key === " ") {
145+
e.preventDefault();
146+
handleContactClick();
147+
}
148+
});
149+
}
150+
151+
// Initialize scroll elements state
152+
handleScrollElements();
83153
})();

source/_assets/scss/_common.scss

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,49 @@ p {
168168
border-radius: 5px;
169169
position: fixed;
170170
right: 30px;
171-
bottom: 30px;
171+
bottom: 160px;
172172
z-index: 99;
173173
color: var(--white);
174+
opacity: 0;
175+
visibility: hidden;
176+
transform: translateY(20px);
177+
transition: opacity 0.3s ease-in-out,
178+
visibility 0.3s ease-in-out,
179+
transform 0.3s ease-in-out,
180+
background 0.3s ease;
181+
182+
&.visible {
183+
opacity: 1;
184+
visibility: visible;
185+
transform: translateY(0);
186+
}
174187

175188
&:hover {
176189
color: var(--white);
177190
background: var(--heading-color);
191+
transform: translateY(-2px);
192+
}
193+
194+
&:focus {
195+
outline: 2px solid var(--primary-color);
196+
outline-offset: 2px;
197+
}
198+
199+
&:focus:not(:focus-visible) {
200+
outline: none;
201+
}
202+
203+
&:focus-visible {
204+
outline: 2px solid var(--primary-color);
205+
outline-offset: 2px;
206+
}
207+
208+
// Responsive design for smaller screens
209+
@media (max-width: 576px) {
210+
right: 10px;
211+
bottom: 100px;
212+
width: 36px;
213+
height: 36px;
214+
line-height: 36px;
178215
}
179216
}

0 commit comments

Comments
 (0)