Skip to content

Commit b5bcf7d

Browse files
committed
Migrate CTAs to CallToAction component folder and add theme CSS variables support
1 parent 8fda6e6 commit b5bcf7d

8 files changed

Lines changed: 267 additions & 145 deletions

File tree

src/components/CTAContact/index.astro

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/components/CTAFeatured/index.astro

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/components/CTANewsletter/index.astro

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
/**
3+
* Contact Call-to-Action Component
4+
*
5+
* A prominent call-to-action section encouraging users to get in touch.
6+
* Features customizable title, description, and action buttons with theme-aware styling.
7+
*
8+
* @example
9+
* ```astro
10+
* <Contact />
11+
* <Contact
12+
* title="Let's Build Something Amazing"
13+
* description="Ready to transform your digital presence?"
14+
* primaryLink={{ href: "/contact", text: "Start Your Project" }}
15+
* />
16+
* ```
17+
*/
18+
19+
export interface Props {
20+
/** Main heading for the CTA */
21+
title?: string
22+
/** Supporting description text */
23+
description?: string
24+
/** Primary action button */
25+
primaryLink?: {
26+
href: string
27+
text: string
28+
}
29+
/** Optional secondary action button */
30+
secondaryLink?: {
31+
href: string
32+
text: string
33+
}
34+
}
35+
36+
const {
37+
title = "Ready to Start Your Project?",
38+
description = "Let's discuss your goals and create something amazing together.",
39+
primaryLink = { href: "/contact", text: "Get In Touch" },
40+
secondaryLink = { href: "/services", text: "View Services" }
41+
} = Astro.props
42+
---
43+
44+
<section class="py-16 md:py-24 bg-gradient-to-br from-[var(--color-primary)] to-[var(--color-accent)] relative overflow-hidden">
45+
<!-- Decorative background elements -->
46+
<div class="absolute inset-0 opacity-10">
47+
<div class="absolute top-0 left-0 w-96 h-96 bg-white rounded-full blur-3xl -translate-x-1/2 -translate-y-1/2"></div>
48+
<div class="absolute bottom-0 right-0 w-96 h-96 bg-white rounded-full blur-3xl translate-x-1/2 translate-y-1/2"></div>
49+
</div>
50+
51+
<div class="container mx-auto px-4 sm:px-6 lg:px-8 relative z-10">
52+
<div class="max-w-4xl mx-auto text-center">
53+
<h2 class="text-3xl md:text-4xl lg:text-5xl font-bold text-white mb-6 leading-tight">
54+
{title}
55+
</h2>
56+
<p class="text-lg md:text-xl text-white/90 mb-10 max-w-2xl mx-auto leading-relaxed">
57+
{description}
58+
</p>
59+
60+
<div class="flex flex-col sm:flex-row gap-4 justify-center items-center">
61+
<a
62+
href={primaryLink.href}
63+
class="inline-flex items-center justify-center px-8 py-4 bg-white text-[var(--color-primary)] font-semibold rounded-xl hover:bg-white/90 transition-all duration-200 hover:shadow-xl hover:-translate-y-0.5 min-w-[200px] text-center"
64+
>
65+
{primaryLink.text}
66+
<svg class="w-5 h-5 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
67+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
68+
</svg>
69+
</a>
70+
{secondaryLink && (
71+
<a
72+
href={secondaryLink.href}
73+
class="inline-flex items-center justify-center px-8 py-4 bg-transparent border-2 border-white text-white font-semibold rounded-xl hover:bg-white hover:text-[var(--color-primary)] transition-all duration-200 hover:shadow-xl hover:-translate-y-0.5 min-w-[200px] text-center"
74+
>
75+
{secondaryLink.text}
76+
</a>
77+
)}
78+
</div>
79+
</div>
80+
</div>
81+
</section>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
/**
3+
* Featured Call-to-Action Component
4+
*
5+
* A visually prominent CTA with optional image support using astro:assets.
6+
* Perfect for highlighting special offers, case studies, or featured content.
7+
*
8+
* @example
9+
* ```astro
10+
* import myImage from '@assets/images/featured.webp'
11+
*
12+
* <Featured
13+
* title="See How We Helped LabCorp"
14+
* description="Discover our approach to enterprise web solutions"
15+
* link={{ href: "/case-studies/labcorp", text: "View Case Study" }}
16+
* image={{ src: myImage, alt: "LabCorp case study preview" }}
17+
* />
18+
* ```
19+
*/
20+
21+
import { Image } from 'astro:assets'
22+
import Button from '@components/Button/index.astro'
23+
import type { ImageMetadata } from 'astro'
24+
25+
export interface Props {
26+
/** Main heading for the featured content */
27+
title?: string
28+
/** Supporting description text */
29+
description?: string
30+
/** Action link configuration */
31+
link?: {
32+
href: string
33+
text: string
34+
}
35+
/** Optional image using astro:assets */
36+
image?: {
37+
src: ImageMetadata
38+
alt: string
39+
}
40+
/** Target audience identifier for analytics */
41+
audience?: string
42+
}
43+
44+
const {
45+
title = "Featured Content",
46+
description = "Discover more content and resources.",
47+
link = { href: "/", text: "Learn More" },
48+
image,
49+
audience = "all"
50+
} = Astro.props
51+
---
52+
53+
<div class="py-8 md:py-12" data-audience={audience}>
54+
<aside class="container mx-auto px-4 sm:px-6 lg:px-8">
55+
<div class="bg-gradient-to-br from-[var(--color-success-bg)] to-[var(--color-info-bg)] rounded-2xl shadow-xl overflow-hidden">
56+
<div class={`grid gap-8 ${image ? 'lg:grid-cols-2' : 'lg:grid-cols-1'} items-center`}>
57+
<!-- Content Column -->
58+
<div class="p-8 md:p-12 lg:p-16">
59+
<div class="max-w-xl">
60+
<h3 class="text-2xl md:text-3xl lg:text-4xl font-bold text-[var(--color-text)] mb-4 leading-tight">
61+
{title}
62+
</h3>
63+
<p class="text-base md:text-lg text-[var(--color-text-offset)] mb-8 leading-relaxed">
64+
{description}
65+
</p>
66+
<a href={link.href} class="inline-block">
67+
<Button
68+
text={link.text}
69+
variant="success"
70+
size="large"
71+
/>
72+
</a>
73+
</div>
74+
</div>
75+
76+
<!-- Image Column (if image provided) -->
77+
{image && (
78+
<div class="relative lg:h-full min-h-[300px] lg:min-h-[400px]">
79+
<a href={link.href} class="block h-full">
80+
<Image
81+
src={image.src}
82+
alt={image.alt}
83+
class="w-full h-full object-cover hover:scale-105 transition-transform duration-300"
84+
loading="lazy"
85+
widths={[400, 600, 800]}
86+
sizes="(max-width: 768px) 100vw, 50vw"
87+
/>
88+
</a>
89+
</div>
90+
)}
91+
</div>
92+
</div>
93+
</aside>
94+
</div>

0 commit comments

Comments
 (0)