Skip to content

Commit

Permalink
Merge branch 'main' into 4.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah11918 authored May 8, 2024
2 parents 2d6feb7 + d40b0fc commit 6b7f603
Show file tree
Hide file tree
Showing 56 changed files with 1,373 additions and 283 deletions.
28 changes: 18 additions & 10 deletions config/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,30 @@ type StarlightSidebarConfig = NonNullable<Parameters<typeof starlight>[0]['sideb

/** Generate a Starlight sidebar config object from our existing `nav.ts` files. */
export function makeSidebar(): StarlightSidebarConfig {
let currentSubGroup: Extract<StarlightSidebarConfig[number], { items: any }>;

Check warning on line 25 in config/sidebar.ts

View workflow job for this annotation

GitHub Actions / Check for code issues with ESLint

Unexpected any. Specify a different type
return navTranslations.en.reduce((sidebar, item) => {
if ('header' in item) {
sidebar.push({
const newGroup = {
label: item.text,
translations: getTranslations(item),
items: [],
});
} else {
const group = sidebar.at(-1);
if (group && 'items' in group) {
group.items.push({
label: item.text,
link: item.slug,
translations: getTranslations(item),
});
collapsed: item.collapsed,
};
if (item.nested) {
const parentGroup = sidebar.at(-1);
if (parentGroup && 'items' in parentGroup) {
parentGroup.items.push(newGroup);
}
} else {
sidebar.push(newGroup);
}
currentSubGroup = newGroup;
} else {
currentSubGroup.items.push({
label: item.text,
link: item.slug,
translations: getTranslations(item),
});
}
return sidebar;
}, [] as StarlightSidebarConfig);
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ hero:
title: Astro Docs
tagline: Guides, resources, and API references to help you build with Astro.
actions:
- text: Get started
- text: Install Astro
icon: rocket
link: /en/install/auto/
variant: primary
Expand Down
3 changes: 2 additions & 1 deletion src/content/docs/en/guides/data-fetching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ i18nReady: true

## `fetch()` in Astro

All [Astro components](/en/basics/astro-components/) have access to the [global `fetch()` function](https://developer.mozilla.org/en-US/docs/Web/API/fetch) in their component script to make HTTP requests to APIs using the full URL (e.g. https://example.com/api or `Astro.url + "/api"`).
All [Astro components](/en/basics/astro-components/) have access to the [global `fetch()` function](https://developer.mozilla.org/en-US/docs/Web/API/fetch) in their component script to make HTTP requests to APIs using the full URL (e.g. https://example.com/api).
Additionally, you can construct a URL to your project's pages and endpoints that are rendered on demand on the server using `new URL("/api", Astro.url)`.

This fetch call will be executed at build time, and the data will be available to the component template for generating dynamic HTML. If [SSR](/en/guides/server-side-rendering/) mode is enabled, any fetch calls will be executed at runtime.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ app.onToolbarPlacementUpdated((options) => {
Changes the state of the app. This can be used to enable or disable the app programmatically, for example, when the user clicks on a button in the app's UI.

```ts title="src/my-app.js"
app.changeAppState({state: false});
app.toggleState({ state: false });
```

### `toggleNotification()`
Expand Down
Loading

0 comments on commit 6b7f603

Please sign in to comment.