Skip to content

Commit 725fd6b

Browse files
committed
Compose FeatureCard component for landing page feature grid
1 parent cddd2b5 commit 725fd6b

2 files changed

Lines changed: 71 additions & 55 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
interface Props {
3+
title: string;
4+
description: string;
5+
}
6+
7+
const { title, description } = Astro.props;
8+
---
9+
10+
<div class="info-card">
11+
<div class="info-icon">
12+
<slot name="icon" />
13+
</div>
14+
<h3>{title}</h3>
15+
<p>{description}</p>
16+
</div>
17+
18+
<style>
19+
.info-card {
20+
padding: 1.5rem;
21+
border-radius: 8px;
22+
border: 1px solid var(--border-color);
23+
background-color: var(--bg-secondary);
24+
transition:
25+
transform var(--transition-speed),
26+
border-color var(--transition-speed);
27+
}
28+
29+
.info-card:hover {
30+
transform: translateY(-2px);
31+
border-color: var(--forest-green);
32+
}
33+
34+
.info-icon {
35+
color: var(--forest-green);
36+
margin-bottom: 0.75rem;
37+
display: flex;
38+
align-items: center;
39+
}
40+
41+
h3 {
42+
font-size: 1.15rem;
43+
margin-bottom: 0.5rem;
44+
}
45+
46+
p {
47+
font-size: 0.9rem;
48+
color: var(--text-secondary);
49+
}
50+
</style>

‎ui/src/pages/[lang]/index.astro‎

Lines changed: 21 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
import Button from '../../components/Button.astro';
3+
import FeatureCard from '../../components/FeatureCard.astro';
34
import AppShell from '../../layouts/AppShell.astro';
45
import { languages, useTranslations } from '../../i18n/ui';
56
import lessons from '../../data/lessons.json';
@@ -44,31 +45,26 @@ const totalLessons = lessons.length;
4445
</div>
4546

4647
<section class="info-grid">
47-
<div class="info-card">
48-
<div class="info-icon">
49-
<BookOpen size={24} />
50-
</div>
51-
<h3>
52-
{totalLessons} {t('card.lessons.title')}
53-
</h3>
54-
<p>{t('card.lessons.desc')}</p>
55-
</div>
56-
57-
<div class="info-card">
58-
<div class="info-icon">
59-
<Settings size={24} />
60-
</div>
61-
<h3>{t('card.stdlib.title')}</h3>
62-
<p>{t('card.stdlib.desc')}</p>
63-
</div>
64-
65-
<div class="info-card">
66-
<div class="info-icon">
67-
<Zap size={24} />
68-
</div>
69-
<h3>{t('card.run.title')}</h3>
70-
<p>{t('card.run.desc')}</p>
71-
</div>
48+
<FeatureCard
49+
title={`${totalLessons} ${t('card.lessons.title')}`}
50+
description={t('card.lessons.desc')}
51+
>
52+
<BookOpen size={24} slot="icon" />
53+
</FeatureCard>
54+
55+
<FeatureCard
56+
title={t('card.stdlib.title')}
57+
description={t('card.stdlib.desc')}
58+
>
59+
<Settings size={24} slot="icon" />
60+
</FeatureCard>
61+
62+
<FeatureCard
63+
title={t('card.run.title')}
64+
description={t('card.run.desc')}
65+
>
66+
<Zap size={24} slot="icon" />
67+
</FeatureCard>
7268
</section>
7369

7470
<section class="philosophy-section">
@@ -137,36 +133,6 @@ const totalLessons = lessons.length;
137133
gap: 1.5rem;
138134
}
139135

140-
.info-card {
141-
padding: 1.5rem;
142-
border-radius: 8px;
143-
border: 1px solid var(--border-color);
144-
background-color: var(--bg-secondary);
145-
transition: transform var(--transition-speed);
146-
}
147-
148-
.info-card:hover {
149-
transform: translateY(-2px);
150-
border-color: var(--forest-green);
151-
}
152-
153-
.info-icon {
154-
color: var(--forest-green);
155-
margin-bottom: 0.75rem;
156-
display: flex;
157-
align-items: center;
158-
}
159-
160-
.info-card h3 {
161-
font-size: 1.15rem;
162-
margin-bottom: 0.5rem;
163-
}
164-
165-
.info-card p {
166-
font-size: 0.9rem;
167-
color: var(--text-secondary);
168-
}
169-
170136
.philosophy-section {
171137
padding-top: 2rem;
172138
border-top: 1px solid var(--border-color);

0 commit comments

Comments
 (0)