feat: Mejorar la sección Hero con efectos de máquina de escribir y ajustes de estilo

This commit is contained in:
Shni
2025-11-04 13:26:11 -06:00
parent 001e7a33a7
commit 9f7a31005c

View File

@@ -3,8 +3,8 @@
<div class="hero-content"> <div class="hero-content">
<div class="hero-text"> <div class="hero-text">
<h1 class="hero-title"> <h1 class="hero-title">
<span class="typewriter">{{ displayText }}</span> <span ref="typewriterRef" class="typewriter">{{ displayText }}</span>
<span class="cursor" :class="{ blink: showCursor }">|</span> <span ref="cursorRef" class="cursor" :class="{ blink: showCursor }">|</span>
</h1> </h1>
<p class="hero-subtitle">{{ t('hero.subtitle') }}</p> <p class="hero-subtitle">{{ t('hero.subtitle') }}</p>
@@ -52,7 +52,7 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, watch } from 'vue' import { ref, onMounted, watch, nextTick } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { botService } from '@/services/bot' import { botService } from '@/services/bot'
@@ -68,6 +68,8 @@ const showCursor = ref(true)
const currentIndex = ref(0) const currentIndex = ref(0)
const isDeleting = ref(false) const isDeleting = ref(false)
const isLoading = ref(true) const isLoading = ref(true)
const typewriterRef = ref(null)
const cursorRef = ref(null)
const stats = ref({ const stats = ref({
servers: '...', servers: '...',
@@ -106,6 +108,7 @@ const typewriterEffect = () => {
if (currentIndex.value < currentText.length) { if (currentIndex.value < currentText.length) {
displayText.value = currentText.substring(0, currentIndex.value + 1) displayText.value = currentText.substring(0, currentIndex.value + 1)
currentIndex.value++ currentIndex.value++
nextTick(() => updateCursorPosition())
setTimeout(typewriterEffect, speed) setTimeout(typewriterEffect, speed)
} else { } else {
// Pause at the end // Pause at the end
@@ -118,6 +121,7 @@ const typewriterEffect = () => {
if (currentIndex.value > 0) { if (currentIndex.value > 0) {
displayText.value = currentText.substring(0, currentIndex.value - 1) displayText.value = currentText.substring(0, currentIndex.value - 1)
currentIndex.value-- currentIndex.value--
nextTick(() => updateCursorPosition())
setTimeout(typewriterEffect, speed) setTimeout(typewriterEffect, speed)
} else { } else {
isDeleting.value = false isDeleting.value = false
@@ -126,6 +130,13 @@ const typewriterEffect = () => {
} }
} }
const updateCursorPosition = () => {
if (typewriterRef.value && cursorRef.value) {
const textWidth = typewriterRef.value.offsetWidth
cursorRef.value.style.left = `${textWidth}px`
}
}
// Watch for language changes // Watch for language changes
watch(locale, () => { watch(locale, () => {
currentIndex.value = 0 currentIndex.value = 0
@@ -167,11 +178,11 @@ const inviteBot = () => {
} }
.hero-content { .hero-content {
max-width: 1200px; max-width: 1400px;
width: 100%; width: 100%;
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 600px 1fr;
gap: 60px; gap: 80px;
align-items: center; align-items: center;
} }
@@ -184,26 +195,44 @@ const inviteBot = () => {
font-weight: 800; font-weight: 800;
margin-bottom: 24px; margin-bottom: 24px;
line-height: 1.2; line-height: 1.2;
min-height: 120px;
position: relative;
width: 100%;
max-width: 600px;
}
.hero-title::before {
content: 'Un bot con mucha personalidad';
font-size: 4rem;
font-weight: 800;
visibility: hidden;
display: block;
height: 0;
overflow: hidden;
pointer-events: none;
}
.typewriter {
background: linear-gradient(135deg, #fff, var(--color-secondary, #ff5252)); background: linear-gradient(135deg, #fff, var(--color-secondary, #ff5252));
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
background-clip: text; background-clip: text;
min-height: 120px;
display: flex;
align-items: center;
}
.typewriter {
display: inline-block;
min-width: 0;
white-space: nowrap; white-space: nowrap;
display: inline-block;
position: absolute;
left: 0;
top: 0;
} }
.cursor { .cursor {
display: inline-block;
color: var(--color-primary, #ff1744); color: var(--color-primary, #ff1744);
opacity: 1; opacity: 1;
transition: opacity 0.1s; transition: opacity 0.1s;
background: none;
-webkit-text-fill-color: var(--color-primary, #ff1744);
position: absolute;
left: 0;
top: 0;
} }
.cursor.blink { .cursor.blink {
@@ -215,6 +244,7 @@ const inviteBot = () => {
color: rgba(255, 255, 255, 0.7); color: rgba(255, 255, 255, 0.7);
margin-bottom: 32px; margin-bottom: 32px;
line-height: 1.6; line-height: 1.6;
max-width: 600px;
} }
.hero-actions { .hero-actions {
@@ -288,8 +318,10 @@ const inviteBot = () => {
height: 500px; height: 500px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: flex-end;
width: 100%; width: 100%;
padding-right: 0;
overflow: visible;
} }
.floating-card { .floating-card {
@@ -316,20 +348,20 @@ const inviteBot = () => {
} }
.card-1 { .card-1 {
top: 40px; top: 30px;
right: 0; right: -538px;
animation: float 6s ease-in-out infinite; animation: float 6s ease-in-out infinite;
} }
.card-2 { .card-2 {
top: 180px; top: 190px;
right: 140px; right: -772px;
animation: float 6s ease-in-out infinite 2s; animation: float 6s ease-in-out infinite 2s;
} }
.card-3 { .card-3 {
bottom: 60px; bottom: 50px;
right: 40px; right: -540px;
animation: float 6s ease-in-out infinite 4s; animation: float 6s ease-in-out infinite 4s;
} }
@@ -363,12 +395,22 @@ const inviteBot = () => {
.hero-title { .hero-title {
font-size: 2.5rem; font-size: 2.5rem;
min-height: 80px; min-height: 80px;
max-width: 500px;
}
.hero-title::before {
font-size: 2.5rem;
}
.hero-subtitle {
max-width: 500px;
} }
.hero-visual { .hero-visual {
height: 400px; height: 400px;
padding-right: 0; padding-right: 0;
justify-content: center; justify-content: flex-end;
overflow: visible;
} }
.floating-card { .floating-card {
@@ -378,18 +420,18 @@ const inviteBot = () => {
} }
.card-1 { .card-1 {
top: 40px; top: 30px;
right: 10px; right: -200px;
} }
.card-2 { .card-2 {
top: 180px; top: 170px;
right: 120px; right: -300px;
} }
.card-3 { .card-3 {
bottom: 80px; bottom: 70px;
right: 60px; right: -210px;
} }
.card-icon { .card-icon {
@@ -412,6 +454,16 @@ const inviteBot = () => {
@media (max-width: 640px) { @media (max-width: 640px) {
.hero-title { .hero-title {
font-size: 2rem; font-size: 2rem;
min-height: 70px;
max-width: 100%;
}
.hero-title::before {
font-size: 2rem;
}
.hero-subtitle {
max-width: 100%;
} }
.hero-actions { .hero-actions {
@@ -425,6 +477,7 @@ const inviteBot = () => {
.hero-visual { .hero-visual {
height: 300px; height: 300px;
padding-right: 0; padding-right: 0;
overflow: visible;
} }
.floating-card { .floating-card {
@@ -435,17 +488,17 @@ const inviteBot = () => {
.card-1 { .card-1 {
top: 20px; top: 20px;
right: 5px; right: -80px;
} }
.card-2 { .card-2 {
top: 130px; top: 130px;
right: 80px; right: -150px;
} }
.card-3 { .card-3 {
bottom: 60px; bottom: 50px;
right: 30px; right: -90px;
} }
.card-icon { .card-icon {