astro_avtourist/frontend/src/components/base/AdBanner.astro

97 lines
2.3 KiB
Text
Raw Normal View History

---
interface AdBannerProps {
width?: string;
height?: string;
className?: string;
}
const {
width = "300",
height = "250",
className = ""
} = Astro.props as AdBannerProps;
const displayWidth = `${width}px`;
const displayHeight = `${height}px`;
const sizeLabel = `${width}×${height}`;
---
<div class={`ad-banner ${className}`} style={`--ad-width: ${displayWidth}; --ad-height: ${displayHeight};`}>
<div class="ad-banner__placeholder">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
<circle cx="8.5" cy="8.5" r="1.5"/>
<polyline points="21 15 16 10 5 21"/>
</svg>
<span>Рекламный блок</span>
<span class="ad-banner__size">{sizeLabel}</span>
</div>
</div>
<style>
.ad-banner {
background: #ffffff;
border-radius: 16px;
border: 1px solid #e2e8f0;
overflow: hidden;
}
.ad-banner__placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 2rem 1rem;
text-align: center;
min-height: calc(var(--ad-height, 250px) - 4px);
min-width: calc(var(--ad-width, 300px) - 2px);
width: 100%;
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}
.ad-banner__placeholder svg {
width: 48px;
height: 48px;
color: #94a3b8;
margin-bottom: 1rem;
}
.ad-banner__placeholder span {
color: #64748b;
font-size: 0.9rem;
}
.ad-banner__size {
font-size: 0.75rem !important;
color: #94a3b8 !important;
margin-top: 0.5rem;
}
.ad-banner--dashed {
border: 2px dashed #cbd5e1;
background: #f1f5f9;
}
.ad-banner--dashed .ad-banner__placeholder {
background: transparent;
}
.ad-banner--horizontal {
display: flex;
align-items: center;
justify-content: center;
}
.ad-banner--horizontal .ad-banner__placeholder {
min-height: 90px;
padding: 1.5rem 2rem;
}
.ad-banner--vertical {
min-height: var(--ad-height, 250px);
}
.ad-banner--vertical .ad-banner__placeholder {
height: 100%;
}
</style>