Skip to content

Commit 477d0b7

Browse files
committed
WIP Add Card Grid layout to List component
1 parent b786630 commit 477d0b7

4 files changed

Lines changed: 54 additions & 48 deletions

File tree

src/components/List/index.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const { items, size, variant = 'default', classes } = Astro.props
3333

3434
{variant === 'accent-border-left-list' && <AccentBorderLeftList items={items} classes={classes} />}
3535
{variant === 'badge-list' && <BadgeList items={items} classes={classes} size={size} />}
36-
{variant === 'card-grid-list' && <CardGridList items={items} classes={classes} size={size} />}
36+
{variant === 'card-grid-list' && <CardGridList items={items} classes={classes} />}
3737
{variant === 'check-icons-list' && <CheckIconsList items={items} classes={classes} size={size} />}
3838
{variant === 'chevron-list' && <ChevronList items={items} classes={classes} size={size} />}
3939
{variant === 'colored-marker-list' && <ColoredMarkerList items={items} classes={classes} size={size} />}

src/components/List/layouts/CardGridList.astro

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ export type Props = {
33
items: {
44
lead?: string
55
text: string
6-
color?: string
76
}[]
87
classes?: {
98
ul?: string
@@ -14,36 +13,18 @@ export type Props = {
1413
1514
const { items, classes }: Props = Astro.props
1615
17-
const ulClass = ["space-y-4", classes?.ul]
18-
const liClass = ["border-l-4 pl-4 py-2", classes?.li]
16+
const ulClass = ["grid grid-cols-1 md:grid-cols-2 gap-4", classes?.ul]
17+
const liClass = ["bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors", classes?.li]
18+
const emClass = ["block text-content font-semibold not-italic mb-2", classes?.em]
1919
---
2020

2121
<ul class:list={ulClass}>
2222
{
2323
items.map((item) => (
2424
<li class:list={liClass}>
25-
<em class={classes?.em}>{item.lead}</em>
26-
<span>{item.text}</span>
25+
<em class:list={emClass}>{item.lead}</em>
26+
<span class="text-sm text-content-offset">{item.text}</span>
2727
</li>
2828
))
2929
}
3030
</ul>
31-
32-
<ul class="grid grid-cols-1 md:grid-cols-2 gap-4">
33-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
34-
<em class="block text-content font-semibold not-italic mb-2">Is the gateway healthy?</em>
35-
<span class="text-sm text-content-offset">Request rate, error rate, and latency percentiles answer this instantly.</span>
36-
</li>
37-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
38-
<em class="block text-content font-semibold not-italic mb-2">Is a specific backend unhealthy?</em>
39-
<span class="text-sm text-content-offset">Per-upstream metrics and circuit breaker state tell you.</span>
40-
</li>
41-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
42-
<em class="block text-content font-semibold not-italic mb-2">Is a specific consumer affected?</em>
43-
<span class="text-sm text-content-offset">Consumer-specific labels let you slice the data.</span>
44-
</li>
45-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
46-
<em class="block text-content font-semibold not-italic mb-2">What happened to this specific request?</em>
47-
<span class="text-sm text-content-offset">Trace ID and request ID correlation connect all the pieces.</span>
48-
</li>
49-
</ul>

src/content/articles/demo/index.mdx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,3 +1584,51 @@ Display customer feedback and testimonials:
15841584
</div>
15851585

15861586
<br />
1587+
1588+
```markdown
1589+
<List
1590+
variant="card-grid-list"
1591+
items={[
1592+
{
1593+
lead: "Is the gateway healthy?",
1594+
text: "Request rate, error rate, and latency percentiles answer this instantly.",
1595+
},
1596+
{
1597+
lead: "Is a specific backend unhealthy?",
1598+
text: "Per-upstream metrics and circuit breaker state tell you.",
1599+
},
1600+
{
1601+
lead: "Is a specific consumer affected?",
1602+
text: "Consumer-specific labels let you slice the data.",
1603+
},
1604+
{
1605+
lead: "What happened to this specific request?",
1606+
text: "Trace ID and request ID correlation connect all the pieces.",
1607+
},
1608+
]}
1609+
/>
1610+
```
1611+
1612+
<List
1613+
variant="card-grid-list"
1614+
items={[
1615+
{
1616+
lead: "Is the gateway healthy?",
1617+
text: "Request rate, error rate, and latency percentiles answer this instantly.",
1618+
},
1619+
{
1620+
lead: "Is a specific backend unhealthy?",
1621+
text: "Per-upstream metrics and circuit breaker state tell you.",
1622+
},
1623+
{
1624+
lead: "Is a specific consumer affected?",
1625+
text: "Consumer-specific labels let you slice the data.",
1626+
},
1627+
{
1628+
lead: "What happened to this specific request?",
1629+
text: "Trace ID and request ID correlation connect all the pieces.",
1630+
},
1631+
]}
1632+
/>
1633+
1634+
<br />

src/pages/hero.astro

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,6 @@ const path = '/hero/'
1212
<section class="container mx-auto px-4 sm:px-6 lg:px-8 py-16 space-y-16">
1313
<h2 class="text-3xl font-bold text-content mb-8 border-b border-trim pb-4">List Style Variations</h2>
1414

15-
<!-- VARIATION 2: Card Grid -->
16-
<div class="max-w-4xl">
17-
<p class="text-xs font-bold text-content-offset uppercase tracking-widest mb-4">Variation 2: Card Grid</p>
18-
<ul class="grid grid-cols-1 md:grid-cols-2 gap-4">
19-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
20-
<em class="block text-content font-semibold not-italic mb-2">Is the gateway healthy?</em>
21-
<span class="text-sm text-content-offset">Request rate, error rate, and latency percentiles answer this instantly.</span>
22-
</li>
23-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
24-
<em class="block text-content font-semibold not-italic mb-2">Is a specific backend unhealthy?</em>
25-
<span class="text-sm text-content-offset">Per-upstream metrics and circuit breaker state tell you.</span>
26-
</li>
27-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
28-
<em class="block text-content font-semibold not-italic mb-2">Is a specific consumer affected?</em>
29-
<span class="text-sm text-content-offset">Consumer-specific labels let you slice the data.</span>
30-
</li>
31-
<li class="bg-page-offset border border-trim rounded-lg p-5 hover:border-primary transition-colors">
32-
<em class="block text-content font-semibold not-italic mb-2">What happened to this specific request?</em>
33-
<span class="text-sm text-content-offset">Trace ID and request ID correlation connect all the pieces.</span>
34-
</li>
35-
</ul>
36-
</div>
37-
3815
<!-- VARIATION 3: Icon Bullets with Dash Separator -->
3916
<div class="max-w-3xl">
4017
<p class="text-xs font-bold text-content-offset uppercase tracking-widest mb-4">Variation 3: Check Icons with Dash Separator</p>

0 commit comments

Comments
 (0)