www: new fenced code block design (#1629)

This commit is contained in:
Marvin Hagemeister
2023-08-13 10:52:41 +02:00
committed by GitHub
parent 7679e278cc
commit 6a599dbed5
43 changed files with 363 additions and 342 deletions
+23 -23
View File
@@ -20,13 +20,13 @@ Let's illustrate that with an example:
Without any way to group routes this is a problem because every route segment
can only have one `_layout` file.
```txt
/routes
/_layout.tsx <-- applies to all routes here :(
/about.tsx
/career.tsx
/archive.tsx
/contact.tsx
```txt Project structure
└── routes
   ├── _layout.tsx # applies to all routes here :(
   ├── about.tsx
   ├── career.tsx
   ├── archive.tsx
   └── contact.tsx
```
We can solve this problem with route groups. A route group is a folder which has
@@ -34,25 +34,25 @@ a name that is wrapped in braces. For example `(pages)` would be considered a
route and so would be `(marketing)`. This enables us to group related routes in
a folder and use a different `_layout` file for each group.
```txt
/routes
/(marketing)
/_layout.tsx <-- only applies to about.tsx and career.tsx
/about.tsx
/career.tsx
/(info)
/_layout.tsx <-- only applies to archive.tsx and contact.tsx
/archive.tsx
/contact.tsx
```txt Project structure
└── routes
   ├── (marketing)
   │ ├── _layout.tsx # only applies to about.tsx and career.tsx
   │ ├── about.tsx
   │ └── career.tsx
   └── (info)
   ├── _layout.tsx # only applies to archive.tsx and contact.tsx
   ├── archive.tsx
   └── contact.tsx
```
> ℹ️ Be careful about routes in different groups which match to the same URL.
> Such scenarios will lead to ambiguity as to which route file should be picked.
>
> ```txt
> /routes
> /(group-1)
> /about.tsx <-- Bad: Both routes map to the same `/about` url
> /(group-2)
> /about.tsx <-- Bad: Both routes map to the same `/about` url
> ```txt Project structure
> └── routes
>    ├── (group-1)
>    │ └── about.tsx # Bad: Maps to same `/about` url
>    └── (group-2)
>    └── about.tsx # Bad: Maps to same `/about` url
> ```