Skip to content

Commit 07ca234

Browse files
authored
docs: move type after usafe
1 parent ab040ac commit 07ca234

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/content/docs/4.utils/2.query-collection-navigation.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,6 @@ description: The queryCollectionNavigation composable generates the navigation
44
tree of given collection.
55
---
66

7-
## Type
8-
9-
```ts
10-
function queryCollectionNavigation<T extends keyof PageCollections>(
11-
collection: T,
12-
fields?: Array<keyof PageCollections[T]>
13-
): ChainablePromise<T, ContentNavigationItem[]>
14-
15-
interface ChainablePromise<T extends keyof PageCollections, R> extends Promise<R> {
16-
where(field: keyof PageCollections[T] | string, operator: SQLOperator, value?: unknown): ChainablePromise<T, R>
17-
andWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
18-
orWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
19-
order(field: keyof PageCollections[T], direction: 'ASC' | 'DESC'): ChainablePromise<T, R>
20-
}
21-
```
22-
237
## Usage
248

259
Use the auto-imported `queryCollectionNavigation` to generate a navigation tree for a specific collection. This is particularly useful for creating dynamic navigation menus or sidebars based on your content structure.
@@ -49,6 +33,22 @@ title: Getting Started
4933
icon: i-lucide-square-play
5034
```
5135
36+
## Type
37+
38+
```ts
39+
function queryCollectionNavigation<T extends keyof PageCollections>(
40+
collection: T,
41+
fields?: Array<keyof PageCollections[T]>
42+
): ChainablePromise<T, ContentNavigationItem[]>
43+
44+
interface ChainablePromise<T extends keyof PageCollections, R> extends Promise<R> {
45+
where(field: keyof PageCollections[T] | string, operator: SQLOperator, value?: unknown): ChainablePromise<T, R>
46+
andWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
47+
orWhere(groupFactory: QueryGroupFunction<PageCollections[T]>): ChainablePromise<T, R>
48+
order(field: keyof PageCollections[T], direction: 'ASC' | 'DESC'): ChainablePromise<T, R>
49+
}
50+
```
51+
5252
## API
5353

5454
### `queryCollectionNavigation(collection: CollectionName, extraField: keyof Collection)`

0 commit comments

Comments
 (0)