docs: add routing page (#9550)

- Add a new homepage to `book` project for the routing page
- Move all main doc pages to be under `/v2/learn` (and added redirects + fixed links across docs)
- Other: add admin components to resources dropdown + fixes to search on mobile.

Closes DX-955

Preview: https://docs-v2-git-docs-router-page-medusajs.vercel.app/v2
This commit is contained in:
Shahed Nasser
2024-10-18 08:24:34 +00:00
committed by GitHub
parent 7a47f5211d
commit 0a37675f0e
223 changed files with 2549 additions and 696 deletions
@@ -0,0 +1,58 @@
export const metadata = {
title: `${pageNumber} Admin Development Constraints`,
}
# {metadata.title}
This chapter lists some constraints of admin widgets and UI routes.
## Arrow Functions
Widget and UI route components must be created as arrow functions.
export const arrowHighlights = [
["2", "function", "Don't declare the widget / UI route as a function."],
["7", "() => ", "Use arrow functions when creating a widget / UI route."]
]
```ts highlights={arrowHighlights}
// Don't
function ProductWidget() {
// ...
}
// Do
const ProductWidget = () => {
// ...
}
```
---
## Widget Zone
A widget zone's value must be wrapped in double or single quotes. It can't be a template literal or a variable.
export const zoneHighlights = [
["3", "`product.details.before`", "Don't specify the value of `zone` as a template literal."],
["9", "ZONE", "Don't specify a variable as the value of `zone`."],
["14", `"product.details.before"`, "Wrap the value of `zone` in double or single quotes."]
]
```ts highlights={zoneHighlights}
// Don't
export const config = defineWidgetConfig({
zone: `product.details.before`,
})
// Don't
const ZONE = "product.details.after"
export const config = defineWidgetConfig({
zone: ZONE,
})
// Do
export const config = defineWidgetConfig({
zone: "product.details.before",
})
```