Skip to content

Commit afc7d94

Browse files
committed
Introduce Navigation Topics
1 parent 292f0ce commit afc7d94

File tree

17 files changed

+3082
-116
lines changed

17 files changed

+3082
-116
lines changed

docs_headless/astro.config.mjs

Lines changed: 637 additions & 93 deletions
Large diffs are not rendered by default.

docs_headless/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@tailwindcss/vite": "^4.1.11",
1616
"astro": "^5.6.1",
1717
"sharp": "^0.34.2",
18+
"starlight-sidebar-topics": "^0.6.0",
1819
"tailwindcss": "^4.1.11"
1920
},
2021
"devDependencies": {
Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
---
2-
import MobileMenuFooter from "@astrojs/starlight/components/MobileMenuFooter.astro";
3-
import SidebarPersister from "@astrojs/starlight/components/SidebarPersister.astro";
4-
import SidebarSublist from "@astrojs/starlight/components/SidebarSublist.astro";
2+
import MobileMenuFooter from '@astrojs/starlight/components/MobileMenuFooter.astro';
3+
import SidebarPersister from '@astrojs/starlight/components/SidebarPersister.astro';
4+
import SidebarSublist from '@astrojs/starlight/components/SidebarSublist.astro';
5+
import StarlightSidebarTopicsSidebar from 'starlight-sidebar-topics/components/Sidebar.astro';
56
67
const { sidebar } = Astro.locals.starlightRoute;
78
---
89

910
<script is:inline aria-hidden="true">
10-
// This script scrolls the sidebar to the link matching the current page when the page loads
11-
window.addEventListener("load", () => {
12-
const sidebarContainer = document.getElementById("starlight__sidebar");
13-
const currentItem = sidebarContainer.querySelector(
14-
"a[aria-current='page']"
15-
);
16-
if (currentItem) {
17-
sidebarContainer.scrollTo({
18-
top: currentItem.offsetTop - sidebarContainer.offsetTop,
19-
behavior: "smooth",
20-
});
21-
}
22-
});
11+
// This script scrolls the sidebar to the link matching the current page when the page loads
12+
window.addEventListener('load', () => {
13+
const sidebarContainer = document.getElementById('starlight__sidebar');
14+
const currentItem = sidebarContainer.querySelector(
15+
"a[aria-current='page']"
16+
);
17+
if (currentItem) {
18+
sidebarContainer.scrollTo({
19+
top: currentItem.offsetTop - sidebarContainer.offsetTop,
20+
behavior: 'smooth',
21+
});
22+
}
23+
});
2324
</script>
2425

26+
<StarlightSidebarTopicsSidebar />
27+
2528
<SidebarPersister>
26-
<SidebarSublist sublist={sidebar} />
29+
<SidebarSublist sublist={sidebar} />
2730
</SidebarPersister>
2831

2932
<div class="md:sl-hidden">
30-
<MobileMenuFooter />
33+
<MobileMenuFooter />
3134
</div>

docs_headless/src/content/docs/guides/Architecture.md renamed to docs_headless/src/content/docs/headless/guides/Architecture.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ React-admin relies on a several design decisions that structure its codebase.
88

99
React-admin is specifically designed to build [Single-Page Applications (SPA)](https://en.wikipedia.org/wiki/Single-page_application). In a react-admin app, the browser fetches the required HTML, CSS, and JavaScript to render the application only once. Subsequently, data is fetched from APIs through AJAX calls. This is in contrast to traditional web applications, where the browser fetches a new HTML page for each screen.
1010

11-
![SPA lifecycle](../../../assets/SPA-lifecycle.png)
11+
![SPA lifecycle](../../../../assets/SPA-lifecycle.png)
1212

1313
The SPA architecture ensures that react-admin apps are [exceptionally fast](./Features.md#fast), easy to host, and compatible with existing APIs without requiring a dedicated backend.
1414

@@ -58,7 +58,7 @@ The `<Resource>` component allows react-admin to automatically link CRUD pages b
5858

5959
React-admin does not make any assumptions about the specific structure of your API. Instead, it defines its own syntax for data fetching, authentication, internationalization, and preferences. To interact with your API, react-admin relies on adapters called **providers**.
6060

61-
![Providers](../../../assets/providers.png)
61+
![Providers](../../../../assets/providers.png)
6262

6363
For example, to fetch a list of records from the API, you would use the `dataProvider` object as follows:
6464

docs_headless/src/content/docs/guides/CRUD.md renamed to docs_headless/src/content/docs/headless/guides/CRUD.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ const App = () => (
414414

415415
Guesser components start by fetching data from the API, analyzing the shape of the response, and then picking up Field and Input components that match the data type. They also dump the generated code in the console to let you start customizing the UI.
416416

417-
![ListGuesser](../../../assets/tutorial_guessed_list.png)
417+
![ListGuesser](../../../../assets/tutorial_guessed_list.png)
418418

419419
Check the following components to learn more about guessers:
420420

docs_headless/src/content/docs/guides/DataFetchingGuide.md renamed to docs_headless/src/content/docs/headless/guides/DataFetchingGuide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ You can build a react-admin app on top of any API, whether it uses REST, GraphQL
99

1010
In a react-admin app, you don't write API calls using `fetch` or `axios`. Instead, you communicate with your API through an object called the `dataProvider`.
1111

12-
![Backend agnostic](../../../assets/data-provider.png)
12+
![Backend agnostic](../../../../assets/data-provider.png)
1313

1414
The `dataProvider` exposes a predefined interface that allows react-admin to query any API in a normalized way.
1515

docs_headless/src/content/docs/reference/example.md renamed to docs_headless/src/content/docs/headless/reference/example.md

File renamed without changes.

docs_headless/src/content/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ hero:
88
file: ../../assets/houston.webp
99
actions:
1010
- text: Guides & concepts
11-
link: /guides/architecture/
11+
link: /mui/guides/architecture/
1212
icon: right-arrow
1313
---
1414

0 commit comments

Comments
 (0)