@graphcommerce/next-ui 3.14.7 → 3.15.2
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/AppShell/AppShellHeader/index.tsx +12 -23
- package/AppShell/MenuFab.tsx +2 -3
- package/AppShell/SheetShellBase/index.tsx +8 -4
- package/CHANGELOG.md +45 -0
- package/Page/Document.tsx +2 -2
- package/package.json +2 -2
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useHistoryLink,
|
|
3
|
-
usePageContext,
|
|
4
|
-
usePageRouter,
|
|
5
|
-
usePrevUp,
|
|
6
|
-
useUp,
|
|
7
|
-
} from '@graphcommerce/framer-next-pages'
|
|
1
|
+
import { usePageContext, usePageRouter, usePrevUp, useUp } from '@graphcommerce/framer-next-pages'
|
|
8
2
|
import { Fab, makeStyles, Theme } from '@material-ui/core'
|
|
9
3
|
import clsx from 'clsx'
|
|
10
4
|
import { m, MotionValue, useMotionValue, useTransform } from 'framer-motion'
|
|
@@ -250,10 +244,6 @@ export default function AppShellHeader(props: AppShellHeaderProps) {
|
|
|
250
244
|
const titleOffset = useMotionValue<number>(100)
|
|
251
245
|
const titleHeight = useMotionValue<number>(100)
|
|
252
246
|
|
|
253
|
-
const { href: historyHref, onClick: historyOnClick } = useHistoryLink({
|
|
254
|
-
href: up?.href ?? '',
|
|
255
|
-
})
|
|
256
|
-
|
|
257
247
|
const setOffset = useCallback(
|
|
258
248
|
(offsetTop: number, offsetParent: Element | null, clientHeight: number) => {
|
|
259
249
|
titleHeight.set(clientHeight)
|
|
@@ -339,19 +329,18 @@ export default function AppShellHeader(props: AppShellHeaderProps) {
|
|
|
339
329
|
|
|
340
330
|
const canClickBack = backSteps > 0 && router.asPath !== prevUp?.href
|
|
341
331
|
let back = canClickBack && (
|
|
342
|
-
<
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
</Button>
|
|
353
|
-
</PageLink>
|
|
332
|
+
<Button
|
|
333
|
+
onClick={() => router.back()}
|
|
334
|
+
variant='pill-link'
|
|
335
|
+
size='small'
|
|
336
|
+
className={classes.backButton}
|
|
337
|
+
startIcon={backIcon}
|
|
338
|
+
aria-label='Back'
|
|
339
|
+
>
|
|
340
|
+
{up?.href === router.asPath ? up?.title : 'Back'}
|
|
341
|
+
</Button>
|
|
354
342
|
)
|
|
343
|
+
|
|
355
344
|
if (!canClickBack && up?.href) {
|
|
356
345
|
back = (
|
|
357
346
|
<PageLink href={up?.href} passHref>
|
package/AppShell/MenuFab.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import { makeStyles, StyleRules, Theme } from '@material-ui/core'
|
|
13
13
|
import { useDomEvent } from 'framer-motion'
|
|
14
14
|
import { useRouter } from 'next/router'
|
|
15
|
-
import React, { useRef } from 'react'
|
|
15
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
16
16
|
import responsiveVal from '../../Styles/responsiveVal'
|
|
17
17
|
import AppShellProvider from '../AppShellProvider'
|
|
18
18
|
import ShellBase, { PageLayoutBaseProps } from '../ShellBase'
|
|
@@ -63,11 +63,15 @@ function SheetShellBase(props: SheetShellBaseProps) {
|
|
|
63
63
|
const { depth, closeSteps, active, direction } = usePageContext()
|
|
64
64
|
const open = depth < 0 || router.asPath === pageRouter.asPath
|
|
65
65
|
const initialLocale = useRef(router.locale)
|
|
66
|
+
const [isNavigating, setIsNavigating] = useState<boolean>(false)
|
|
66
67
|
|
|
67
68
|
function handleClose() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (!isNavigating) {
|
|
70
|
+
setIsNavigating(true)
|
|
71
|
+
return initialLocale.current !== router.locale
|
|
72
|
+
? pageRouter.push('/')
|
|
73
|
+
: pageRouter.go(closeSteps * -1)
|
|
74
|
+
}
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
function handleSnap(snapPoint: SnapPoint) {
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,51 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.15.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.15.1...@graphcommerce/next-ui@3.15.2) (2021-11-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **sheet-shell-base:** prevent sheet backdrop from navigating back multiple times ([5ca2f7e](https://github.com/ho-nl/m2-pwa/commit/5ca2f7e0d3404501a6b5763daf1d442c8080f8cb))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.15.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.15.0...@graphcommerce/next-ui@3.15.1) (2021-11-11)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* better handling to go back from product page ([ff8e72b](https://github.com/ho-nl/m2-pwa/commit/ff8e72beef81b9fb0d20cbfbd50c282f0144aed7))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# [3.15.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.14.8...@graphcommerce/next-ui@3.15.0) (2021-11-11)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* lingui configuration and integration greatly simplified and fixed ssr ([d8ec22a](https://github.com/ho-nl/m2-pwa/commit/d8ec22a80295af854a4cf6f357c4fb137c5b550d))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [3.14.8](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.14.7...@graphcommerce/next-ui@3.14.8) (2021-11-09)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* **menu-fab:** revert h3 styling for mobile menu ([7a45b4f](https://github.com/ho-nl/m2-pwa/commit/7a45b4fb8b0165f7a072bc0658833c819c9f8082))
|
|
45
|
+
* restyle menu to h4 ([642e166](https://github.com/ho-nl/m2-pwa/commit/642e16635dc06f38bed91ffd1a374922ac70439b))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
6
51
|
## [3.14.7](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.14.6...@graphcommerce/next-ui@3.14.7) (2021-11-09)
|
|
7
52
|
|
|
8
53
|
|
package/Page/Document.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ServerStyleSheets } from '@material-ui/core/styles'
|
|
2
2
|
// eslint-disable-next-line @next/next/no-document-import-in-page
|
|
3
|
-
import NextDocument, { DocumentContext } from 'next/document'
|
|
3
|
+
import NextDocument, { DocumentContext, DocumentInitialProps } from 'next/document'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
|
|
6
6
|
export default class Document extends NextDocument {
|
|
7
|
-
static getInitialProps = async (ctx: DocumentContext) => {
|
|
7
|
+
static getInitialProps = async (ctx: DocumentContext): Promise<DocumentInitialProps> => {
|
|
8
8
|
const sheets = new ServerStyleSheets()
|
|
9
9
|
const originalRenderPage = ctx.renderPage
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.2",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"project": "./tsconfig.json"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "47e8be849eaecea00f8673696ae1ec3283ec5fd6"
|
|
57
57
|
}
|