Skip to content

Commit 4f4592d

Browse files
committed
Refactor Default Hero to be stand alone component
1 parent e059e32 commit 4f4592d

7 files changed

Lines changed: 101 additions & 96 deletions

File tree

src/components/Hero/@types/content.ts

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

src/components/Hero/@types/ctaLinks.ts

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

src/components/Hero/@types/image.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,58 @@
33
* Hero Content Column - Default Variant
44
*/
55
import Sprite from '@components/Sprite/index.astro'
6-
import type { ContentProps as Props } from '@components/Hero/@types/content'
76
8-
export type { Props }
7+
export interface Props {
8+
pretitle?: string
9+
title?: string
10+
benefits?: Array<{
11+
text: string
12+
highlight: string
13+
}>
14+
primaryLink?: {
15+
href: string
16+
text: string
17+
}
18+
secondaryLink?: {
19+
href: string
20+
text: string
21+
}
22+
}
923
10-
const { pretitle, title, benefits, primaryLink, secondaryLink } = Astro.props
24+
const { pretitle, title, benefits, primaryLink, secondaryLink } = Astro.props as Props
1125
---
1226

1327
{/* Content Column */}
1428
<div class="order-2 lg:order-1 space-y-6">
1529
{/* Pretitle */}
1630
<span
17-
class="inline-block text-sm md:text-base font-bold tracking-wide text-[var(--color-primary)] uppercase"
31+
class="inline-block text-sm md:text-base font-bold tracking-wide text-primary uppercase"
1832
>
1933
{pretitle}
2034
</span>
2135

2236
{/* Main Title */}
2337
<h1
24-
class="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold text-[var(--color-text)] leading-tight"
38+
class="text-3xl sm:text-4xl md:text-5xl lg:text-6xl font-bold text-text leading-tight"
2539
>
2640
{title}
2741
</h1>
2842

2943
{/* Benefits Section */}
3044
{
3145
benefits && benefits.length > 0 && (
32-
<div class="bg-[var(--color-bg-offset)] rounded-2xl p-6 md:p-8 border border-[var(--color-border)]">
33-
<div class="text-sm font-semibold text-[var(--color-text-offset)] mb-4 uppercase tracking-wide">
46+
<div class="bg-bg-offset rounded-2xl p-6 md:p-8 border border-border">
47+
<div class="text-sm font-semibold text-text-offset mb-4 uppercase tracking-wide">
3448
Up to:
3549
</div>
3650
<ul class="space-y-4">
3751
{benefits.map(benefit => (
3852
<li class="flex items-start gap-3">
39-
<span class="flex-shrink-0 w-6 h-6 text-[var(--color-success)] [&_.icon]:w-6 [&_.icon]:h-6 [&_.icon]:stroke-current">
53+
<span class="shrink-0 w-6 h-6 text-success [&_.icon]:w-6 [&_.icon]:h-6 [&_.icon]:stroke-current">
4054
<Sprite name="check" />
4155
</span>
42-
<span class="text-base md:text-lg text-[var(--color-text)]">
43-
<strong class="font-bold text-[var(--color-primary)]">{benefit.highlight}</strong>{' '}
56+
<span class="text-base md:text-lg text-text">
57+
<strong class="font-bold text-primary">{benefit.highlight}</strong>{' '}
4458
{benefit.text}
4559
</span>
4660
</li>
@@ -56,7 +70,7 @@ const { pretitle, title, benefits, primaryLink, secondaryLink } = Astro.props
5670
primaryLink && (
5771
<a
5872
href={primaryLink.href}
59-
class="group inline-block px-8 py-4 bg-[var(--color-primary)] hover:bg-[var(--color-primary-hover)] text-white font-semibold rounded-xl transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5 text-center"
73+
class="group inline-block px-8 py-4 bg-primary hover:bg-primary-hover text-white font-semibold rounded-xl transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5 text-center"
6074
>
6175
{primaryLink.text}
6276
<svg
@@ -79,7 +93,7 @@ const { pretitle, title, benefits, primaryLink, secondaryLink } = Astro.props
7993
secondaryLink && (
8094
<a
8195
href={secondaryLink.href}
82-
class="group inline-block px-8 py-4 bg-transparent border-2 border-[var(--color-border)] hover:border-[var(--color-primary)] text-[var(--color-text)] hover:text-[var(--color-primary)] font-semibold rounded-xl transition-all duration-200 text-center"
96+
class="group inline-block px-8 py-4 bg-transparent border-2 border-border hover:border-primary text-text hover:text-primary font-semibold rounded-xl transition-all duration-200 text-center"
8397
>
8498
{secondaryLink.text}
8599
<svg

src/components/Hero/default/ctaLinks.astro renamed to src/components/Hero/Default/ctaLinks.astro

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@
22
/**
33
* Hero CTA Links - Default Variant
44
*/
5-
import type { CtaProps as Props } from '@components/Hero/@types/ctaLinks'
5+
export interface Props {
6+
primaryLink: {
7+
href: string
8+
text: string
9+
}
10+
secondaryLink: {
11+
href: string
12+
text: string
13+
}
14+
}
615
7-
export type { Props }
8-
9-
const { primaryLink, secondaryLink } = Astro.props
16+
const { primaryLink, secondaryLink } = Astro.props as Props
1017
---
1118

1219
{/* CTA Links */}
1320
<div class="flex flex-col sm:flex-row gap-4 pt-2">
1421
<a
1522
href={primaryLink.href}
16-
class="group inline-block px-8 py-4 bg-[var(--color-primary)] hover:bg-[var(--color-primary-hover)] text-white font-semibold rounded-xl transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5 text-center"
23+
class="group inline-block px-8 py-4 bg-primary hover:bg-primary-hover text-white font-semibold rounded-xl transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5 text-center"
1724
>
1825
{primaryLink.text}
1926
<svg
@@ -31,7 +38,7 @@ const { primaryLink, secondaryLink } = Astro.props
3138
</a>
3239
<a
3340
href={secondaryLink.href}
34-
class="group inline-block px-8 py-4 bg-transparent border-2 border-[var(--color-border)] hover:border-[var(--color-primary)] text-[var(--color-text)] hover:text-[var(--color-primary)] font-semibold rounded-xl transition-all duration-200 text-center"
41+
class="group inline-block px-8 py-4 bg-transparent border-2 border-border hover:border-primary text-text hover:text-primary font-semibold rounded-xl transition-all duration-200 text-center"
3542
>
3643
{secondaryLink.text}
3744
<svg
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
* Hero Image Column - Default Variant
44
*/
55
import { Image as AstroImage } from 'astro:assets'
6-
import type { ImageProps as Props } from '@components/Hero/@types/image'
6+
import type { ImageMetadata } from 'astro'
77
8-
export type { Props }
8+
export interface Props {
9+
image?: {
10+
src: ImageMetadata
11+
alt: string
12+
}
13+
}
914
10-
const { image } = Astro.props
15+
const { image } = Astro.props as Props
1116
---
1217

1318
{/* Image Column */}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
import Content from './content.astro'
3+
import ImageBlock from './image.astro'
4+
import type { ImageMetadata } from 'astro'
5+
6+
interface Benefit {
7+
text: string
8+
highlight: string
9+
}
10+
11+
interface Link {
12+
href: string
13+
text: string
14+
}
15+
16+
export interface Props {
17+
pretitle?: string
18+
title?: string
19+
benefits?: Benefit[]
20+
primaryLink?: Link
21+
secondaryLink?: Link
22+
image?: {
23+
src: ImageMetadata
24+
alt: string
25+
}
26+
}
27+
28+
const {
29+
pretitle = 'Client-Focused Web Application Developer',
30+
title = 'Building Modern Web Solutions That Drive Results',
31+
benefits = [
32+
{ text: 'increase in sales', highlight: '57%' },
33+
{ text: 'ROI for every $1', highlight: '$114' },
34+
{ text: 'conversion', highlight: 'Up to 400%' },
35+
],
36+
primaryLink = { href: '/services/web-development', text: 'Improve Your Product' },
37+
secondaryLink = { href: '/services/consulting', text: 'Start from scratch' },
38+
image,
39+
} = Astro.props
40+
---
41+
42+
<section class="container mx-auto px-4 sm:px-6 lg:px-8 py-12 md:py-16 lg:py-20">
43+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12 items-center">
44+
<Content
45+
pretitle={pretitle}
46+
title={title}
47+
benefits={benefits}
48+
primaryLink={primaryLink}
49+
secondaryLink={secondaryLink}
50+
/>
51+
52+
<ImageBlock {image} />
53+
</div>
54+
</section>

0 commit comments

Comments
 (0)