@stephenchenorg/astro 1.2.1 → 1.2.3
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/dist/image/components/ResponsiveImage.astro +19 -1
- package/dist/pagination/stub/Pagination.astro +8 -2
- package/dist/query-params/components/ProvideUrlConfig.astro +1 -3
- package/dist/query-params/index.d.ts +1 -0
- package/dist/query-params/index.js +1 -0
- package/dist/query-params/url.d.ts +5 -0
- package/package.json +1 -1
|
@@ -4,9 +4,27 @@ interface Props extends astroHTML.JSX.ImgHTMLAttributes {
|
|
|
4
4
|
desktopBlur?: string | null
|
|
5
5
|
mobile?: string | null
|
|
6
6
|
mobileBlur?: string | null
|
|
7
|
+
|
|
8
|
+
// GraphQL image props
|
|
9
|
+
desktop_blur?: string | null
|
|
10
|
+
mobile_blur?: string | null
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
desktop,
|
|
15
|
+
desktopBlur: _desktopBlur,
|
|
16
|
+
mobile,
|
|
17
|
+
mobileBlur: _mobileBlur,
|
|
18
|
+
|
|
19
|
+
desktop_blur: _desktop_blur,
|
|
20
|
+
mobile_blur: _mobile_blur,
|
|
21
|
+
src: _src,
|
|
22
|
+
|
|
23
|
+
...attributes
|
|
24
|
+
} = Astro.props
|
|
25
|
+
|
|
26
|
+
// const desktopBlur = Astro.props.desktopBlur || Astro.props.desktop_blur
|
|
27
|
+
// const mobileBlur = Astro.props.mobileBlur || Astro.props.mobile_blur
|
|
10
28
|
|
|
11
29
|
const breakpoint = 768
|
|
12
30
|
---
|
|
@@ -12,10 +12,14 @@ const {
|
|
|
12
12
|
items,
|
|
13
13
|
showPagination,
|
|
14
14
|
currentPage,
|
|
15
|
+
canFirst,
|
|
15
16
|
canPrev,
|
|
16
17
|
canNext,
|
|
18
|
+
canLast,
|
|
19
|
+
firstUrl,
|
|
17
20
|
prevUrl,
|
|
18
21
|
nextUrl,
|
|
22
|
+
lastUrl,
|
|
19
23
|
getUrl,
|
|
20
24
|
} = usePagination({
|
|
21
25
|
total: Astro.props.total,
|
|
@@ -28,12 +32,14 @@ const {
|
|
|
28
32
|
|
|
29
33
|
{showPagination && (
|
|
30
34
|
<div>
|
|
31
|
-
{
|
|
35
|
+
{canFirst && <a href={firstUrl}>First</a>}
|
|
36
|
+
{canPrev && <a href={prevUrl}>Previous</a>}
|
|
32
37
|
{items.map(page =>
|
|
33
38
|
page === currentPage
|
|
34
39
|
? <span>{page}</span>
|
|
35
40
|
: <a href={getUrl(page)}>{page}</a>
|
|
36
41
|
)}
|
|
37
|
-
{canNext && <a href={nextUrl}
|
|
42
|
+
{canNext && <a href={nextUrl}>Next</a>}
|
|
43
|
+
{canLast && <a href={lastUrl}>Last</a>}
|
|
38
44
|
</div>
|
|
39
45
|
)}
|
|
@@ -13,14 +13,12 @@ const config: UrlConfig = {
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
<script is:inline define:vars={{ config }}>
|
|
16
|
-
// eslint-disable-next-line style/semi
|
|
17
16
|
window.__astro_provide_url_config__ = config;
|
|
18
17
|
</script>
|
|
19
18
|
|
|
20
19
|
<script>
|
|
21
|
-
import { urlConfigStore } from '
|
|
20
|
+
import { urlConfigStore } from '@stephenchenorg/astro/query-params'
|
|
22
21
|
|
|
23
|
-
// @ts-ignore
|
|
24
22
|
const props = window.__astro_provide_url_config__
|
|
25
23
|
|
|
26
24
|
const baseUrl: string = props?.baseUrl || location.pathname
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import qs from 'query-string';
|
|
2
2
|
import type { UrlConfig } from './types';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
__astro_provide_url_config__?: UrlConfig;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
3
8
|
export interface QueryParamsUrlOptions {
|
|
4
9
|
transformParams?: (params: Record<string, any>) => Record<string, any>;
|
|
5
10
|
}
|