react-bricks 4.7.1 → 4.7.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro/List.astro +51 -0
- package/astro/Slot.astro +2 -1
- package/astro/package.json +2 -1
- package/astro/server/package.json +1 -1
- package/frontend/package.json +1 -1
- package/index.js +1 -1
- package/package.json +2 -1
- package/react-bricks.esm.js +1 -1
- package/rsc/client/package.json +1 -1
- package/rsc/package.json +1 -1
package/astro/List.astro
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { fetchPages } from 'react-bricks/astro/server'
|
|
3
|
+
import { reactBricksAstroStore } from 'react-bricks/astro'
|
|
4
|
+
// import reactBricksAstroStore from '../../ReactBricks/reactBricksAstroStore'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
of: string
|
|
8
|
+
where?: {
|
|
9
|
+
tag?: string
|
|
10
|
+
language?: string
|
|
11
|
+
filterBy?: { [key: string]: any }
|
|
12
|
+
}
|
|
13
|
+
sort?: string
|
|
14
|
+
page?: number
|
|
15
|
+
pageSize?: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let error = false
|
|
19
|
+
const { of, where, sort, page, pageSize } = Astro.props as Props
|
|
20
|
+
|
|
21
|
+
const config = reactBricksAstroStore.getConfig()
|
|
22
|
+
if (!config) {
|
|
23
|
+
console.warn('React Bricks Store is not initialized')
|
|
24
|
+
error = true
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Get pages
|
|
28
|
+
const pages = await fetchPages({
|
|
29
|
+
type: of,
|
|
30
|
+
tag: where?.tag,
|
|
31
|
+
language: where?.language,
|
|
32
|
+
filterBy: where?.filterBy,
|
|
33
|
+
sort,
|
|
34
|
+
page,
|
|
35
|
+
pageSize,
|
|
36
|
+
usePagination: true,
|
|
37
|
+
config,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
if (!pages) {
|
|
41
|
+
error = true
|
|
42
|
+
}
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
error || !Astro.slots.has('default') ? (
|
|
47
|
+
''
|
|
48
|
+
) : (
|
|
49
|
+
<Fragment set:html={Astro.slots.render('default', [pages])} />
|
|
50
|
+
)
|
|
51
|
+
}
|
package/astro/Slot.astro
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { types } from 'react-bricks/astro'
|
|
3
|
-
import reactBricksAstroStore from '
|
|
3
|
+
import { reactBricksAstroStore } from 'react-bricks/astro'
|
|
4
4
|
import SlotViewer from './SlotViewer.astro'
|
|
5
|
+
// import reactBricksAstroStore from '../../ReactBricks/reactBricksAstroStore'
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
page: types.Page
|
package/astro/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-bricks-astro",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.2-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"module": "react-bricks-astro.esm.js",
|
|
6
6
|
"types": "./react-bricks-astro.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"types": "./react-bricks-astro.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"./DynamicComponent.astro": "./DynamicComponent.astro",
|
|
16
|
+
"./List.astro": "./List.astro",
|
|
16
17
|
"./PageViewer.astro": "./PageViewer.astro",
|
|
17
18
|
"./Slot.astro": "./Slot.astro",
|
|
18
19
|
"./SlotViewer.astro": "./SlotViewer.astro",
|