File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -6,19 +6,31 @@ const route = Astro.locals.starlightRoute;
66const isAwsServicePage = route .id .startsWith (' aws/services/' ) && ! route .id .includes (' /index' );
77const tags = route .entry ?.data ?.tags || [];
88
9- // Find pricing tags
109const pricingTags = tags .filter (tag =>
1110 [' Free' , ' Base' , ' Ultimate' ].includes (tag )
1211);
12+
13+ const getAvailablePlans = (plans ) => {
14+ if (plans .includes (' Free' )) {
15+ return [' Free' , ' Base' , ' Ultimate' ];
16+ } else if (plans .includes (' Base' )) {
17+ return [' Base' , ' Ultimate' ];
18+ } else if (plans .includes (' Ultimate' )) {
19+ return [' Ultimate' ];
20+ }
21+ return plans ;
22+ };
23+
24+ const availablePlans = getAvailablePlans (pricingTags );
1325---
1426
1527<Default />
1628
17- { isAwsServicePage && pricingTags .length > 0 && (
29+ { isAwsServicePage && availablePlans .length > 0 && (
1830 <div class = " pricing-badges" >
19- { pricingTags .map (tag => (
20- <span class = { ` pricing-badge pricing-badge-${tag .toLowerCase ()} ` } >
21- { tag }
31+ { availablePlans .map (plan => (
32+ <span class = { ` pricing-badge pricing-badge-${plan .toLowerCase ()} ` } >
33+ { plan }
2234 </span >
2335 ))}
2436 </div >
@@ -61,4 +73,4 @@ const pricingTags = tags.filter(tag =>
6173 color: #92400e;
6274 border: 1px solid #fcd34d;
6375 }
64- </style >
76+ </style >
You can’t perform that action at this time.
0 commit comments