@graphcommerce/framer-next-pages 3.1.2 → 3.1.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/CHANGELOG.md +11 -0
- package/components/Page.tsx +2 -12
- package/components/Pages.tsx +6 -1
- package/hooks/useGo.ts +2 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1363](https://github.com/graphcommerce-org/graphcommerce/pull/1363) [`c9f7ac026`](https://github.com/graphcommerce-org/graphcommerce/commit/c9f7ac026b49047eca05be208b515f364e21571c) Thanks [@paales](https://github.com/paales)! - Calling back multiple times in succession doens’t work on ipad and causes flashes on other devices. Replace with window.history.go(-x)
|
|
8
|
+
|
|
9
|
+
* [#1360](https://github.com/graphcommerce-org/graphcommerce/pull/1360) [`829b8690b`](https://github.com/graphcommerce-org/graphcommerce/commit/829b8690bc5d0a46e596299e4120e9837a9f179c) Thanks [@paales](https://github.com/paales)! - Make sure the minimum height of the viewport is at least the viewport size on mobile.
|
|
10
|
+
|
|
11
|
+
* Updated dependencies [[`829b8690b`](https://github.com/graphcommerce-org/graphcommerce/commit/829b8690bc5d0a46e596299e4120e9837a9f179c)]:
|
|
12
|
+
- @graphcommerce/framer-utils@3.1.0
|
|
13
|
+
|
|
3
14
|
## 3.1.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/components/Page.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { clientSizeCssVar } from '@graphcommerce/framer-utils'
|
|
2
2
|
import { m, useIsPresent } from 'framer-motion'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import type { PageItem } from '../types'
|
|
@@ -34,17 +34,7 @@ export function Page(props: PageProps) {
|
|
|
34
34
|
const zIndex = active ? 1 : undefined
|
|
35
35
|
|
|
36
36
|
return (
|
|
37
|
-
<m.div
|
|
38
|
-
style={{ position, top, zIndex }}
|
|
39
|
-
css={css({
|
|
40
|
-
left: 0,
|
|
41
|
-
right: 0,
|
|
42
|
-
minHeight: '100vh',
|
|
43
|
-
'@supports (-webkit-touch-callout: none)': {
|
|
44
|
-
height: '-webkit-fill-available',
|
|
45
|
-
},
|
|
46
|
-
})}
|
|
47
|
-
>
|
|
37
|
+
<m.div style={{ position, top, zIndex, minHeight: clientSizeCssVar.y, left: 0, right: 0 }}>
|
|
48
38
|
{children}
|
|
49
39
|
</m.div>
|
|
50
40
|
)
|
package/components/Pages.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { clientSizeCssVar, useClientSizeCssVar } from '@graphcommerce/framer-utils'
|
|
2
|
+
import { AnimatePresence, m } from 'framer-motion'
|
|
2
3
|
import { requestIdleCallback, cancelIdleCallback } from 'next/dist/client/request-idle-callback'
|
|
3
4
|
import { AppPropsType } from 'next/dist/shared/lib/utils'
|
|
4
5
|
import { NextRouter, Router } from 'next/router'
|
|
@@ -43,6 +44,7 @@ function getPageInfo(router: NextRouter) {
|
|
|
43
44
|
export function FramerNextPages(props: PagesProps) {
|
|
44
45
|
const { router, Component, pageProps: incomingProps, fallback = '/', fallbackRoute = '/' } = props
|
|
45
46
|
|
|
47
|
+
useClientSizeCssVar()
|
|
46
48
|
const items = useRef<PageItem[]>([])
|
|
47
49
|
const idx = Number(global.window?.history.state?.idx ?? 0)
|
|
48
50
|
const prevHistory = useRef<number>(-1)
|
|
@@ -185,6 +187,9 @@ and pass it as a param in <FramerNextPages fallbackRoute='/[...url]' /> in your
|
|
|
185
187
|
|
|
186
188
|
return (
|
|
187
189
|
<AnimatePresence initial={false}>
|
|
190
|
+
<m.div
|
|
191
|
+
style={{ position: 'absolute', top: 0, minHeight: clientSizeCssVar.y, left: 0, right: 0 }}
|
|
192
|
+
/>
|
|
188
193
|
{renderItems.map((item, itemIdx) => {
|
|
189
194
|
const { historyIdx, sharedKey, overlayGroup } = item
|
|
190
195
|
const active = itemIdx === renderItems.length - 1
|
package/hooks/useGo.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRouter } from 'next/router'
|
|
2
2
|
|
|
3
3
|
export function useGo(delta: number) {
|
|
4
|
-
const { push
|
|
4
|
+
const { push } = useRouter()
|
|
5
5
|
return () => {
|
|
6
6
|
if (delta >= 0) {
|
|
7
7
|
console.error(`Called .go(${delta}), only negative numbers are allowed. Redirecting to home`)
|
|
@@ -10,7 +10,6 @@ export function useGo(delta: number) {
|
|
|
10
10
|
return
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
for (let i = 0; i < deltaAbs; i++) back()
|
|
13
|
+
window.history.go(delta)
|
|
15
14
|
}
|
|
16
15
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/framer-next-pages",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.1.
|
|
5
|
+
"version": "3.1.3",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@graphcommerce/framer-utils": "^3.0
|
|
15
|
+
"@graphcommerce/framer-utils": "^3.1.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^4.
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.2",
|
|
19
19
|
"@graphcommerce/prettier-config-pwa": "^4.0.3",
|
|
20
20
|
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
21
21
|
"@playwright/test": "^1.19.2"
|