Skip to content

Commit 36b00a9

Browse files
davcorteznsandoya
andauthored
🎨 Enhanced Hero Component for Main Page (#65)
* Add a background image for hero of main page * fix: Update `Navbar.astro` z-index New hero section text elements were overlapping navbar. This conflict was related with z-index of both components --------- Co-authored-by: nsandoya <[email protected]>
1 parent e6924bc commit 36b00a9

File tree

3 files changed

+147
-21
lines changed

3 files changed

+147
-21
lines changed
1.02 MB
Loading

‎src/components/Hero.astro‎

Lines changed: 146 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,151 @@
11
---
2-
2+
// Image will be optimized by Astro's built-in image optimization
3+
const overlayStyle = "linear-gradient(to right, rgba(37, 99, 235, 0.9), rgba(29, 78, 216, 0.85))";
34
---
45

5-
<section
6-
class="flex flex-col items-center justify-center bg-gradient-to-r from-indigo-700 to-blue-500 h-[100vh] text-white py-20"
7-
>
8-
<div
9-
class="container grid grid-cols-1 gap-8 mx-auto px-4 text-center justify-items-center"
10-
>
11-
<h3 class="text-2xl font-medium">Bienvenido a</h3>
12-
<h1 class="text-6xl lg:text-8xl font-bold">Ecuador In Tech</h1>
13-
<p
14-
class="text-base mb-8 uppercase font-montserrat font-medium text-slate-300 tracking-wide lg:text-xl"
15-
>
16-
Conecta, Aprende y Comparte
17-
</p>
18-
<a
19-
href="/communities"
20-
class="w-fit bg-transparent border-white border-2 text-white px-5 py-2 rounded-xl font-medium hover:bg-white hover:text-blue-600 hover:font-semibold"
21-
>
22-
Conoce más
23-
</a>
6+
<section class="hero-section">
7+
<div class="hero-background">
8+
<img
9+
src="/background-hero.webp"
10+
alt="Diverse group of people collaborating"
11+
class="background-image"
12+
loading="lazy"
13+
decoding="async"
14+
class="absolute inset-0 w-full h-full object-cover object-center transition-transform duration-500 group-hover:scale-105"
15+
onload="this.style.opacity='1'"
16+
style="opacity: 0; transition: opacity 0.3s ease-in-out;"
17+
/>
18+
</div>
19+
20+
<div class="content-wrapper">
21+
<div class="hero-content">
22+
<h3 class="welcome-text">Bienvenido a</h3>
23+
<h1 class="main-title">Ecuador In Tech</h1>
24+
<p class="tagline">Conecta, Aprende y Comparte</p>
25+
26+
<div class="cta-group">
27+
<a href="/communities" class="primary-cta">
28+
Conoce más
29+
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 20 20" fill="currentColor">
30+
<path fill-rule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clip-rule="evenodd" />
31+
</svg>
32+
</a>
33+
<a href="/events" class="secondary-cta">
34+
Ver Eventos
35+
</a>
36+
</div>
37+
</div>
2438
</div>
2539
</section>
40+
41+
<style>
42+
.hero-section {
43+
@apply relative min-h-screen flex items-center justify-center overflow-hidden;
44+
}
45+
46+
.hero-background {
47+
@apply absolute inset-0 z-0;
48+
}
49+
50+
.background-image {
51+
@apply w-full h-full object-cover;
52+
filter: brightness(0.6);
53+
}
54+
55+
.hero-background::after {
56+
content: '';
57+
@apply absolute inset-0;
58+
background: linear-gradient(
59+
135deg,
60+
rgba(37, 99, 235, 0.9) 0%,
61+
rgba(29, 78, 216, 0.85) 100%
62+
);
63+
}
64+
65+
.content-wrapper {
66+
@apply relative z-10 container mx-auto px-4 py-20;
67+
}
68+
69+
.hero-content {
70+
@apply max-w-4xl mx-auto text-center text-white;
71+
}
72+
73+
.welcome-text {
74+
@apply text-2xl md:text-3xl font-medium mb-4
75+
animate-[fadeIn_1s_ease-in] opacity-0;
76+
animation: fadeIn 1s ease-in forwards;
77+
animation-delay: 0.2s;
78+
}
79+
80+
.main-title {
81+
@apply text-5xl md:text-7xl lg:text-8xl font-bold mb-6
82+
animate-[slideUp_1s_ease-out] opacity-0;
83+
animation: slideUp 1s ease-out forwards;
84+
animation-delay: 0.4s;
85+
}
86+
87+
.tagline {
88+
@apply text-lg md:text-xl uppercase font-montserrat font-medium
89+
text-blue-100 tracking-wide mb-12
90+
animate-[fadeIn_1s_ease-in] opacity-0;
91+
animation: fadeIn 1s ease-in forwards;
92+
animation-delay: 0.6s;
93+
}
94+
95+
.cta-group {
96+
@apply flex flex-col sm:flex-row gap-4 justify-center items-center
97+
animate-[fadeIn_1s_ease-in] opacity-0;
98+
animation: fadeIn 1s ease-in forwards;
99+
animation-delay: 0.8s;
100+
}
101+
102+
.primary-cta {
103+
@apply flex items-center gap-2 px-8 py-3 bg-white text-blue-600
104+
rounded-full font-semibold transition-all duration-300
105+
hover:bg-blue-50 hover:transform hover:-translate-y-1
106+
hover:shadow-lg focus:outline-none focus:ring-2
107+
focus:ring-white focus:ring-offset-2 focus:ring-offset-blue-600;
108+
}
109+
110+
.secondary-cta {
111+
@apply px-8 py-3 border-2 border-white text-white rounded-full
112+
font-semibold transition-all duration-300
113+
hover:bg-white/10 hover:transform hover:-translate-y-1
114+
focus:outline-none focus:ring-2 focus:ring-white
115+
focus:ring-offset-2 focus:ring-offset-blue-600;
116+
}
117+
118+
.icon {
119+
@apply w-5 h-5;
120+
}
121+
122+
@keyframes fadeIn {
123+
from {
124+
opacity: 0;
125+
}
126+
to {
127+
opacity: 1;
128+
}
129+
}
130+
131+
@keyframes slideUp {
132+
from {
133+
opacity: 0;
134+
transform: translateY(20px);
135+
}
136+
to {
137+
opacity: 1;
138+
transform: translateY(0);
139+
}
140+
}
141+
142+
@media (max-width: 640px) {
143+
.cta-group {
144+
@apply w-full;
145+
}
146+
147+
.primary-cta, .secondary-cta {
148+
@apply w-full justify-center;
149+
}
150+
}
151+
</style>

‎src/components/Navbar/Navbar.astro‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Navbar component:
2626
this.openMenu = !this.openMenu;
2727
}
2828
}"
29-
class="bg-gray-800 w-full fixed z-10"
29+
class="z-[100] bg-gray-800 w-full fixed"
3030
>
3131
<div class="container mx-auto px-4 py-2 flex justify-between items-center">
3232
<a href="/" class="font-gabarito text-white text-lg font-bold"

0 commit comments

Comments
 (0)