-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathPersistenceBadge.astro
More file actions
78 lines (69 loc) · 1.92 KB
/
PersistenceBadge.astro
File metadata and controls
78 lines (69 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
// Get the current page route
const route = Astro.locals.starlightRoute;
const isAwsServicePage = route.id.startsWith('aws/services/') && !route.id.includes('/index');
const persistence = route.entry?.data?.persistence || null;
// Determine persistence status and display text
const getPersistenceInfo = (persistenceValue) => {
if (!persistenceValue) {
return { status: 'not-supported', text: 'Not Supported' };
} else if (persistenceValue === 'supported') {
return { status: 'supported', text: 'Supported' };
} else if (persistenceValue === 'supported with limitations') {
return { status: 'limited', text: 'Limited Support' };
} else {
return { status: 'not-supported', text: 'Not Supported' };
}
};
const persistenceInfo = getPersistenceInfo(persistence);
---
{isAwsServicePage && (
<div class="persistence-badges">
<span class="badge-label">Persistence:</span>
<span class={`persistence-badge persistence-badge-${persistenceInfo.status}`}>
{persistenceInfo.text}
</span>
</div>
)}
<style>
.persistence-badges {
margin-top: 0.5rem;
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
}
.badge-label {
font-size: 0.875rem;
font-weight: 600;
color: #6b7280;
margin-right: 0.25rem;
}
.persistence-badge {
display: inline-flex;
align-items: center;
padding: 0.25rem 0.75rem;
border-radius: 1rem;
font-size: 0.875rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.025em;
}
/* Persistence badge styles */
.persistence-badge-supported {
background-color: #d1fae5;
color: #065f46;
border: 1px solid #a7f3d0;
}
.persistence-badge-limited {
background-color: #fef3c7;
color: #92400e;
border: 1px solid #fcd34d;
}
.persistence-badge-not-supported {
background-color: #fee2e2;
color: #991b1b;
border: 1px solid #fecaca;
}
</style>