Skip to content

Commit 230138c

Browse files
committed
do some stuff
1 parent 81baf00 commit 230138c

File tree

9 files changed

+169
-26
lines changed

9 files changed

+169
-26
lines changed

src/components/SectionCards.astro

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
import { getCollection } from 'astro:content';
3+
import { SectionCards as SectionCardsReact } from './SectionCards.tsx';
4+
5+
interface Props {
6+
basePath: string;
7+
title?: string;
8+
customTitles?: Record<string, string>;
9+
}
10+
11+
const { basePath, title, customTitles = {} } = Astro.props;
12+
13+
// Get only index files from immediate subdirectories
14+
const allSections = await getCollection('docs', ({ id }) => {
15+
// Must start with the base path
16+
if (!id.startsWith(basePath)) {
17+
return false;
18+
}
19+
20+
// Get the path after the base path
21+
const relativePath = id.substring(basePath.length);
22+
23+
// Split into parts and filter out empty strings
24+
const pathParts = relativePath.split('/').filter(part => part !== '');
25+
26+
// For index files, we should have exactly 1 part: [subdirectory]
27+
// because index files get the ID of their parent directory in Astro
28+
if (pathParts.length === 1) {
29+
const subdirectory = pathParts[0];
30+
31+
// These are the known subdirectories with index files
32+
const validSubdirectories = [
33+
'web-app',
34+
'config',
35+
'cloud-sandbox',
36+
'networking',
37+
'state-management',
38+
'chaos-engineering',
39+
'security-testing'
40+
];
41+
42+
43+
44+
return validSubdirectories.includes(subdirectory);
45+
}
46+
47+
return false;
48+
});
49+
50+
const sortedSections = allSections.sort((a, b) => {
51+
const titleA = a.data.title || a.data.linkTitle || '';
52+
const titleB = b.data.title || b.data.linkTitle || '';
53+
return titleA.localeCompare(titleB);
54+
});
55+
56+
const sectionData = sortedSections.map(section => {
57+
// Extract the subdirectory name from the section ID
58+
const relativePath = section.id.substring(basePath.length);
59+
const subdirectory = relativePath.split('/').filter(part => part !== '')[0];
60+
61+
// Use custom title if provided, otherwise fall back to the section title
62+
const sectionTitle = customTitles[subdirectory] || section.data.title || section.data.linkTitle || 'Unknown Section';
63+
const description = section.data.description || `Learn more about ${sectionTitle}`;
64+
65+
const href = `/${section.id}`;
66+
67+
return {
68+
title: sectionTitle,
69+
description,
70+
href
71+
};
72+
});
73+
74+
75+
---
76+
77+
<SectionCardsReact
78+
sections={sectionData}
79+
title={title}
80+
client:load
81+
/>

src/components/SectionCards.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from 'react';
2+
import { ServiceBox } from './ServiceBox.tsx';
3+
4+
interface Section {
5+
title: string;
6+
description: string;
7+
href: string;
8+
}
9+
10+
interface SectionCardsProps {
11+
sections: Section[];
12+
title?: string;
13+
}
14+
15+
export const SectionCards: React.FC<SectionCardsProps> = ({
16+
sections,
17+
title
18+
}) => {
19+
return (
20+
<div className="searchable-services">
21+
{title && <h2 className="section-cards-title">{title}</h2>}
22+
23+
<div className="service-grid">
24+
{sections.map((section, index) => (
25+
<ServiceBox
26+
key={`${section.href}-${index}`}
27+
title={section.title}
28+
description={section.description}
29+
href={section.href}
30+
/>
31+
))}
32+
</div>
33+
</div>
34+
);
35+
};

src/content/docs/aws/capabilities/config/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ description: This section describes the configuration options available for Loca
44
template: doc
55
---
66

7-
# Config
7+
This section describes the configuration options, internal mechanisms, and other LocalStack-specific features that are available to users. The following figure shows an overview of the covered topics:
8+
9+
10+
11+
![Understanding LocalStack configuration](/images/aws/understanding-localstack-overview.png)

src/content/docs/aws/capabilities/index.md

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Capabilities
3+
description: This section describes the capabilities of LocalStack, that go beyond the core cloud service emulation, and provide additional features and capabilities for LocalStack users.
4+
template: doc
5+
sidebar:
6+
order: 5
7+
---
8+
9+
import SectionCards from '../../../../components/SectionCards.astro';
10+
11+
By emulating cloud services locally, LocalStack enables additional features and workflows that are not feasible on the cloud.
12+
13+
<SectionCards
14+
basePath="aws/capabilities/"
15+
customTitles={{
16+
"web-app": "LocalStack Web App",
17+
"config": "Configuration",
18+
"cloud-sandbox": "Cloud Sandbox",
19+
"networking": "Networking",
20+
"state-management": "State Management",
21+
"chaos-engineering": "Chaos Engineering",
22+
"security-testing": "Security Testing"
23+
}}
24+
/>

src/content/docs/aws/capabilities/networking/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ template: doc
55
sidebar:
66
order: 1
77
---
8-
9-
# Networking
10-

src/content/docs/aws/enterprise/index.md

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Overview
3+
description: LocalStack Enterprise provides the most sophisticated and secure setup we offer, with advanced features and capabilities for large organizations and teams.
4+
template: doc
5+
sidebar:
6+
order: 1
7+
---
8+
9+
import SectionCards from '../../../../components/SectionCards.astro';
10+
11+
# LocalStack Enterprise
12+
13+
This section provides guides and resources to help you get started with LocalStack Enterprise.
14+
15+
<SectionCards
16+
basePath="aws/enterprise/"
17+
customTitles={{
18+
"enterprise-support": "Enterprise Support",
19+
"enterprise-image": "Enterprise Image",
20+
"k8s-operator": "Kubernetes Operator",
21+
"kubernetes-execution": "Kubernetes Executor",
22+
"sso": "Single Sign-On",
23+
}}
24+
/>

src/content/docs/aws/services/index.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ sidebar:
88

99
import SearchableAwsServices from '../../../../components/SearchableAwsServices.astro';
1010

11-
Browse LocalStack's implemented AWS services and explore their comprehensive feature sets. Each service provides detailed documentation on APIs, configuration options, and practical examples to help you get started quickly.
12-
1311
<SearchableAwsServices />

0 commit comments

Comments
 (0)