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