@graphcommerce/next-ui 4.2.0 → 4.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/CHANGELOG.md +47 -0
- package/Layout/components/LayoutHeaderBack.tsx +7 -2
- package/Layout/components/LayoutHeaderClose.tsx +5 -2
- package/LayoutDefault/components/LayoutDefault.tsx +3 -1
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +4 -2
- package/LayoutParts/MenuFab.tsx +1 -0
- package/PageMeta/index.tsx +52 -4
- package/Theme/MuiButton.ts +1 -1
- package/Theme/MuiFab.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1299](https://github.com/ho-nl/m2-pwa/pull/1299)
|
|
8
|
+
[`e37caf437`](https://github.com/ho-nl/m2-pwa/commit/e37caf4376b304ab733d41f2b4fa8be2c35fd807)
|
|
9
|
+
Thanks [@paales](https://github.com/paales)! - Make sure Buttons and Fabs can have custom variants
|
|
10
|
+
|
|
11
|
+
## 4.2.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#1296](https://github.com/ho-nl/m2-pwa/pull/1296)
|
|
16
|
+
[`a9cff2ce6`](https://github.com/ho-nl/m2-pwa/commit/a9cff2ce63fce5b86e9fd6bf63c10c782326d50e)
|
|
17
|
+
Thanks [@paales](https://github.com/paales)! - Make sure the page is max height when no menuFab or
|
|
18
|
+
cartFab is present
|
|
19
|
+
|
|
20
|
+
* [#1296](https://github.com/ho-nl/m2-pwa/pull/1296)
|
|
21
|
+
[`8473123fa`](https://github.com/ho-nl/m2-pwa/commit/8473123fa7d3f3eb1d282d9b4205c803a88010ea)
|
|
22
|
+
Thanks [@paales](https://github.com/paales)! - implement handling for canonical URLs based on
|
|
23
|
+
NEXT_PUBLIC_SITE_URL
|
|
24
|
+
|
|
25
|
+
- [#1296](https://github.com/ho-nl/m2-pwa/pull/1296)
|
|
26
|
+
[`50e205c51`](https://github.com/ho-nl/m2-pwa/commit/50e205c51f4d0d67d41d22fd70e8ed9a0996489e)
|
|
27
|
+
Thanks [@paales](https://github.com/paales)! - make sure the scroll performance of galleries in
|
|
28
|
+
safari is better
|
|
29
|
+
|
|
30
|
+
## 4.2.1
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#1294](https://github.com/ho-nl/m2-pwa/pull/1294)
|
|
35
|
+
[`19f33e0aa`](https://github.com/ho-nl/m2-pwa/commit/19f33e0aaf4e3121edd444926d08b6459d3ef400)
|
|
36
|
+
Thanks [@paales](https://github.com/paales)! - Make sure the minHeight of overlays always have the
|
|
37
|
+
correct height, even if the content changes size
|
|
38
|
+
|
|
39
|
+
* [#1294](https://github.com/ho-nl/m2-pwa/pull/1294)
|
|
40
|
+
[`aea787542`](https://github.com/ho-nl/m2-pwa/commit/aea787542484a0480a48031fcc4a9a5566c6bfc7)
|
|
41
|
+
Thanks [@paales](https://github.com/paales)! - Make sure the labels of LayoutHeaderBack/Close
|
|
42
|
+
aren’t rendered on mobile
|
|
43
|
+
|
|
44
|
+
* Updated dependencies
|
|
45
|
+
[[`4e28c8afd`](https://github.com/ho-nl/m2-pwa/commit/4e28c8afd9cead3577dd0eff97b5c44ba4c1c862),
|
|
46
|
+
[`afb993244`](https://github.com/ho-nl/m2-pwa/commit/afb993244aabc8135ce54a79743cbf63bc5677d3)]:
|
|
47
|
+
- @graphcommerce/framer-scroller@2.0.5
|
|
48
|
+
- @graphcommerce/framer-next-pages@3.1.1
|
|
49
|
+
|
|
3
50
|
## 4.2.0
|
|
4
51
|
|
|
5
52
|
### Minor Changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useUp, usePrevUp, usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { t } from '@lingui/macro'
|
|
3
|
+
import { Box } from '@mui/material'
|
|
3
4
|
import PageLink from 'next/link'
|
|
4
5
|
import { useRouter } from 'next/router'
|
|
5
6
|
import { LinkOrButton, LinkOrButtonProps } from '../../Button/LinkOrButton'
|
|
@@ -45,7 +46,9 @@ export default function LayoutHeaderBack(props: BackProps) {
|
|
|
45
46
|
aria-label={label}
|
|
46
47
|
{...props}
|
|
47
48
|
>
|
|
48
|
-
{
|
|
49
|
+
<Box component='span' sx={{ display: { xs: 'none', md: 'inline' } }}>
|
|
50
|
+
{label}
|
|
51
|
+
</Box>
|
|
49
52
|
</LinkOrButton>
|
|
50
53
|
)
|
|
51
54
|
}
|
|
@@ -60,7 +63,9 @@ export default function LayoutHeaderBack(props: BackProps) {
|
|
|
60
63
|
color='inherit'
|
|
61
64
|
{...props}
|
|
62
65
|
>
|
|
63
|
-
{
|
|
66
|
+
<Box component='span' sx={{ display: { xs: 'none', md: 'inline' } }}>
|
|
67
|
+
{up.title}
|
|
68
|
+
</Box>
|
|
64
69
|
</LinkOrButton>
|
|
65
70
|
</PageLink>
|
|
66
71
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useGo, usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { Trans } from '@lingui/macro'
|
|
3
|
+
import { Box } from '@mui/material'
|
|
3
4
|
import { LinkOrButton } from '../../Button/LinkOrButton'
|
|
4
5
|
import { IconSvg } from '../../IconSvg'
|
|
5
6
|
import { iconClose } from '../../icons'
|
|
@@ -19,10 +20,12 @@ export default function LayoutHeaderClose() {
|
|
|
19
20
|
color='inherit'
|
|
20
21
|
onClick={onClick}
|
|
21
22
|
aria-label='Close'
|
|
22
|
-
startIcon={<IconSvg src={iconClose} />}
|
|
23
|
+
startIcon={<IconSvg src={iconClose} size='medium' />}
|
|
23
24
|
// className={classes.close}
|
|
24
25
|
>
|
|
25
|
-
<
|
|
26
|
+
<Box component='span' sx={{ display: { xs: 'none', md: 'inline' } }}>
|
|
27
|
+
<Trans>Close</Trans>
|
|
28
|
+
</Box>
|
|
26
29
|
</LinkOrButton>
|
|
27
30
|
)
|
|
28
31
|
}
|
|
@@ -86,7 +86,7 @@ export function LayoutDefault(props: LayoutDefaultProps) {
|
|
|
86
86
|
>
|
|
87
87
|
{header}
|
|
88
88
|
</Box>
|
|
89
|
-
{
|
|
89
|
+
{menuFab || cartFab ? (
|
|
90
90
|
<Box
|
|
91
91
|
className={classes.fabs}
|
|
92
92
|
sx={(theme) => ({
|
|
@@ -115,6 +115,8 @@ export function LayoutDefault(props: LayoutDefaultProps) {
|
|
|
115
115
|
{menuFab}
|
|
116
116
|
{cartFab}
|
|
117
117
|
</Box>
|
|
118
|
+
) : (
|
|
119
|
+
<div />
|
|
118
120
|
)}
|
|
119
121
|
<div className={classes.children}>{children}</div>
|
|
120
122
|
<div className={classes.footer}>{footer}</div>
|
|
@@ -342,7 +342,9 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
342
342
|
* can't change this value with JS as that causes much jank
|
|
343
343
|
*/
|
|
344
344
|
'&.sizeSmFull, &.sizeSmMinimal': { paddingBottom: 56 },
|
|
345
|
-
'&.variantSmBottom.sizeSmFull': {
|
|
345
|
+
'&.variantSmBottom.sizeSmFull': {
|
|
346
|
+
minHeight: `calc(100vh - ${theme.appShell.headerHeightSm} * 0.5)`,
|
|
347
|
+
},
|
|
346
348
|
|
|
347
349
|
'&.variantSmBottom': {
|
|
348
350
|
borderTopLeftRadius: `${theme.shape.borderRadius * 4}px`,
|
|
@@ -373,7 +375,7 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
373
375
|
},
|
|
374
376
|
|
|
375
377
|
'&.sizeMdFull.variantMdBottom': {
|
|
376
|
-
minHeight: `calc(100vh
|
|
378
|
+
minHeight: `calc(100vh + ${theme.appShell.headerHeightMd} - (${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * 0.5)`,
|
|
377
379
|
},
|
|
378
380
|
'&.sizeMdFull.variantMdLeft': {
|
|
379
381
|
paddingBottom: '1px',
|
package/LayoutParts/MenuFab.tsx
CHANGED
package/PageMeta/index.tsx
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
|
+
import {
|
|
3
|
+
resolveHref,
|
|
4
|
+
getDomainLocale,
|
|
5
|
+
addBasePath,
|
|
6
|
+
addLocale,
|
|
7
|
+
} from 'next/dist/shared/lib/router/router'
|
|
2
8
|
import Head from 'next/head'
|
|
9
|
+
import { useRouter } from 'next/router'
|
|
3
10
|
|
|
4
11
|
// https://developers.google.com/search/docs/advanced/robots/robots_meta_tag#directives
|
|
5
12
|
export type MetaRobots =
|
|
@@ -15,19 +22,60 @@ export type MetaRobots =
|
|
|
15
22
|
| `max-video-preview:${number}`
|
|
16
23
|
type MetaRobotsAll = ['all' | 'none']
|
|
17
24
|
|
|
25
|
+
type Canonical = `http://${string}` | `https://${string}` | `/${string}` | string
|
|
26
|
+
|
|
18
27
|
export type PageMetaProps = {
|
|
19
28
|
title: string
|
|
20
|
-
canonical?:
|
|
29
|
+
canonical?: Canonical
|
|
21
30
|
metaDescription?: string
|
|
22
31
|
metaRobots?: MetaRobotsAll | MetaRobots[]
|
|
23
32
|
}
|
|
24
33
|
|
|
34
|
+
export function useCanonical(incomming?: Canonical) {
|
|
35
|
+
const router = useRouter()
|
|
36
|
+
let canonical = incomming
|
|
37
|
+
|
|
38
|
+
if (!canonical) return canonical
|
|
39
|
+
|
|
40
|
+
if (canonical?.startsWith('/')) {
|
|
41
|
+
if (!process.env.NEXT_PUBLIC_SITE_URL) {
|
|
42
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
43
|
+
throw Error('NEXT_PUBLIC_SITE_URL is not defined in .env')
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let [href, as] = resolveHref(router, canonical, true)
|
|
48
|
+
|
|
49
|
+
const curLocale = router.locale
|
|
50
|
+
|
|
51
|
+
// Copied from here https://github.com/vercel/next.js/blob/canary/packages/next/client/link.tsx#L313-L327
|
|
52
|
+
const localeDomain =
|
|
53
|
+
router &&
|
|
54
|
+
router.isLocaleDomain &&
|
|
55
|
+
getDomainLocale(as, curLocale, router && router.locales, router && router.domainLocales)
|
|
56
|
+
|
|
57
|
+
href = localeDomain || addBasePath(addLocale(as, curLocale, router && router.defaultLocale))
|
|
58
|
+
|
|
59
|
+
canonical = `${process.env.NEXT_PUBLIC_SITE_URL}${href}`
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (canonical && !(canonical ?? 'http').startsWith('http')) {
|
|
63
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`canonical must start with '/', 'http://' or 'https://', '${canonical}' given`,
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
canonical = undefined
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return canonical
|
|
72
|
+
}
|
|
73
|
+
|
|
25
74
|
export function PageMeta(props: PageMetaProps) {
|
|
26
75
|
const { active } = usePageContext()
|
|
27
|
-
const { title, canonical, metaDescription, metaRobots = ['all'] } = props
|
|
76
|
+
const { title, canonical: canonicalBare, metaDescription, metaRobots = ['all'] } = props
|
|
28
77
|
|
|
29
|
-
|
|
30
|
-
throw new Error(`canonical must start with http:// or https://, '${canonical}' given`)
|
|
78
|
+
const canonical = useCanonical(canonicalBare)
|
|
31
79
|
|
|
32
80
|
if (!active) return null
|
|
33
81
|
return (
|
package/Theme/MuiButton.ts
CHANGED
package/Theme/MuiFab.ts
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/next-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "4.2.
|
|
5
|
+
"version": "4.2.3",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"sideEffects": false,
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@emotion/react": "^11.7.1",
|
|
20
20
|
"@emotion/server": "^11.4.0",
|
|
21
21
|
"@emotion/styled": "^11.6.0",
|
|
22
|
-
"@graphcommerce/framer-next-pages": "^3.1.
|
|
23
|
-
"@graphcommerce/framer-scroller": "^2.0.
|
|
22
|
+
"@graphcommerce/framer-next-pages": "^3.1.1",
|
|
23
|
+
"@graphcommerce/framer-scroller": "^2.0.5",
|
|
24
24
|
"@graphcommerce/framer-utils": "^3.0.3",
|
|
25
25
|
"@graphcommerce/image": "^3.1.0",
|
|
26
26
|
"react-is": "^17.0.2",
|