Новые правки в компоенты

This commit is contained in:
Web-serfer 2026-04-19 19:00:42 +05:00
parent 36a3d37ad3
commit 815986969a
19 changed files with 1703 additions and 143 deletions

View file

@ -0,0 +1,510 @@
---
import Button from '@components/base/Button.astro';
import { Icon } from 'astro-icon/components';
interface HeroProps {
badgeText: string;
titleWhite: string;
titleGold: string;
description: string;
btnText?: string;
btnHref?: string;
btnSecondary?: string;
btnSecondaryHref?: string;
btnSecondaryClass?: string;
modalTarget?: string;
bgImage?: string;
minHeight?: string;
headerOffset?: string;
layout?: 'default' | 'with-image';
sideImage?: string;
sideImageAlt?: string;
experienceBadge?: {
number: string;
text: string;
};
icon?: string;
}
const {
badgeText,
titleWhite,
titleGold,
description,
btnText,
btnHref = "#contact",
btnSecondary,
btnSecondaryHref = "/services",
btnSecondaryClass = "",
modalTarget,
bgImage = "",
minHeight = "100vh",
headerOffset = "80px",
layout = "default",
sideImage = "",
sideImageAlt = "",
experienceBadge,
icon
} = Astro.props as HeroProps;
const showImage = layout === 'with-image' && sideImage;
---
<section
class="hero-section hero-home"
style={`min-height: ${minHeight}; padding-top: ${headerOffset}; ${bgImage ? `background-image: url("${bgImage}")` : ''}`}
>
{bgImage && (
<img
src={bgImage}
alt=""
class="hero-bg-lcp"
fetchpriority="high"
decoding="async"
width="1920"
height="1080"
/>
)}
<div class="hero-overlay"></div>
<div class="site-container hero-grid">
<div class="hero-content">
<div class="badge">
{icon ? (
<span class="badge-icon">
<Icon name={icon} />
</span>
) : (
<span class="status-dot"></span>
)}
{badgeText}
</div>
<h1 class="hero-title">
<span class="text-white">{titleWhite}</span>
<br />
<span class="text-gold">{titleGold}</span>
</h1>
<p class="hero-description">{description}</p>
{btnText && (
<div class="hero-actions">
{modalTarget ? (
<Button variant="gold" size="lg" data-modal-target={modalTarget}>
{btnText}
</Button>
) : (
<Button variant="gold" size="lg" href={btnHref}>
{btnText}
</Button>
)}
{btnSecondary && (
<Button variant="outline" size="lg" href={btnSecondaryHref} class={btnSecondaryClass}>
{btnSecondary}
</Button>
)}
</div>
)}
</div>
{showImage && (
<div class="hero-image-wrapper">
<div class="image-composition">
<img
src={sideImage}
alt={sideImageAlt || "Юрист"}
class="main-image"
width="380"
height="500"
loading="eager"
fetchpriority="high"
decoding="async"
/>
{experienceBadge && (
<div class="experience-badge">
<span class="exp-number">{experienceBadge.number}</span>
<span class="exp-text">{experienceBadge.text}</span>
</div>
)}
</div>
</div>
)}
</div>
</section>
<style>
.hero-section {
position: relative;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
margin: 0 !important;
box-sizing: border-box;
overflow: hidden;
transition: padding-top 0.3s ease;
}
.hero-bg-lcp {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0;
pointer-events: none;
z-index: -1;
}
.hero-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(90deg, #0a2540 0%, rgba(10, 37, 64, 0.9) 50%, rgba(10, 37, 64, 0.7) 100%);
z-index: 1;
}
.site-container {
position: relative;
z-index: 2;
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
width: 100%;
}
/* --- GRID LAYOUT --- */
.hero-grid {
display: flex;
justify-content: space-between;
align-items: center;
gap: 3rem;
width: 100%;
padding-bottom: 4rem;
}
.hero-content {
flex: 1.2;
max-width: 700px;
}
/* --- BADGE --- */
.badge {
display: inline-flex;
align-items: center;
gap: 0.6rem;
background-color: rgba(234, 194, 110, 0.15);
border: 1px solid rgba(234, 194, 110, 0.3);
color: #eac26e;
padding: 0.5rem 1rem;
border-radius: 6px;
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 1.5px;
margin-bottom: 2.5rem;
}
.badge svg {
color: #eac26e;
flex-shrink: 0;
}
/* Мерцающая точка - оптимизированная анимация */
.status-dot {
width: 10px;
height: 10px;
background: #22c55e;
border-radius: 50%;
position: relative;
flex-shrink: 0;
}
.status-dot::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
background: #22c55e;
animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
z-index: -1;
}
.badge-icon {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.badge-icon svg {
width: 20px !important;
height: 20px !important;
stroke-width: 2 !important;
}
@keyframes pulse-ring {
0% {
transform: scale(1);
opacity: 0.8;
}
100% {
transform: scale(2.5);
opacity: 0;
}
}
/* --- TITLE --- */
.hero-title {
font-size: clamp(2rem, 5vw, 3.8rem);
font-weight: 800;
line-height: 1.15;
margin: 0 0 2rem 0;
}
.text-white {
color: #ffffff;
}
.text-gold {
color: #eac26e;
}
/* --- DESCRIPTION --- */
.hero-description {
color: rgba(255, 255, 255, 0.85);
font-size: 1.15rem;
line-height: 1.6;
margin-bottom: 2.5rem;
max-width: 580px;
}
/* --- ACTIONS --- */
.hero-actions {
display: flex;
gap: 1.5rem;
align-items: stretch;
}
.hero-actions > * {
display: flex;
align-items: center;
}
/* --- IMAGE BLOCK --- */
.hero-image-wrapper {
flex: 1;
display: flex;
justify-content: flex-end;
position: relative;
}
.image-composition {
position: relative;
width: 100%;
max-width: 480px;
}
.image-composition::before {
content: '';
position: absolute;
top: -10px;
left: 20px;
right: -20px;
bottom: 10px;
background-color: #ffffff;
border-radius: 12px;
transform: rotate(3deg);
z-index: -1;
opacity: 0;
animation: fadeInRotate 0.8s ease 0.6s forwards;
}
@keyframes fadeInRotate {
from {
opacity: 0;
transform: rotate(0deg) translateY(20px);
}
to {
opacity: 1;
transform: rotate(3deg) translateY(0);
}
}
.main-image {
width: 100%;
border-radius: 12px;
border: 8px solid #ffffff;
filter: grayscale(100%);
box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}
.experience-badge {
position: absolute;
bottom: 30px;
left: -30px;
background: #ffffff;
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 15px 35px rgba(0,0,0,0.2);
min-width: 180px;
}
.exp-number {
font-size: 2.2rem;
font-weight: 900;
color: #1e3050;
line-height: 1;
display: block;
}
.exp-text {
font-size: 0.7rem;
font-weight: 800;
color: #535e6c;
text-transform: uppercase;
}
/* --- АДАПТАЦИЯ --- */
@media (max-width: 992px) {
.hero-section {
padding-top: 70px;
min-height: auto;
}
.hero-grid {
flex-direction: column;
text-align: center;
padding-top: 1.5rem;
}
.hero-content {
align-items: center;
}
.hero-actions {
justify-content: center;
}
.hero-image-wrapper {
margin-top: 3rem;
justify-content: center;
}
.experience-badge {
left: 0;
bottom: -20px;
}
}
@media (max-width: 767px) {
.hero-section {
padding-top: 64px;
}
.hero-title {
font-size: 1.8rem;
}
.hero-actions {
flex-direction: column;
width: 100%;
}
.hero-actions > * {
width: 100%;
}
.image-composition::before {
display: none;
}
}
@media (max-width: 480px) {
.hero-section {
padding-top: 64px;
}
.hero-title {
font-size: 1.8rem;
}
}
/* Кастомные стили для кнопки "Мои услуги" */
:global(.btn-services) {
background: transparent !important;
border: 2px solid #ffffff !important;
color: #ffffff !important;
padding: 0.875rem 1.5rem !important;
font-size: 1.125rem !important;
line-height: 1.75rem !important;
position: relative;
overflow: hidden;
z-index: 1;
height: auto !important;
min-height: 3.25rem !important;
transition: all 0.3s ease;
}
:global(.btn-services)::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
transition: left 0.5s ease;
z-index: -1;
}
:global(.btn-services)::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.2));
transition: width 0.4s ease;
z-index: -1;
}
:global(.btn-services:hover) {
background: rgba(255, 255, 255, 0.1) !important;
border-color: #eac26e !important;
color: #eac26e !important;
transform: translateY(-3px);
box-shadow: 0 8px 25px rgba(234, 194, 110, 0.3);
}
:global(.btn-services:hover)::before {
left: 100%;
}
:global(.btn-services:hover)::after {
width: 100%;
}
:global(.btn-services:active) {
transform: translateY(-1px);
box-shadow: 0 4px 15px rgba(234, 194, 110, 0.2);
}
</style>