@graphcommerce/docs 5.2.0-canary.2 → 5.2.0-canary.4
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 +18 -0
- package/framework/links.md +122 -0
- package/magento/readme.md +43 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 5.2.0-canary.4
|
|
4
|
+
|
|
5
|
+
## 5.2.0-canary.3
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- [#1766](https://github.com/graphcommerce-org/graphcommerce/pull/1766) [`e34169ee2`](https://github.com/graphcommerce-org/graphcommerce/commit/e34169ee2e0fdc052ff589ceca0bc67557584c1f) - Upgraded to Next.js 13
|
|
10
|
+
|
|
11
|
+
- NextLink integrates the next/link functionality with @mui/material's Link and ButtonBase (and all it's derivatives) components.
|
|
12
|
+
- NextLink automatically adds `target="_blank"` when the href is external.
|
|
13
|
+
- NextLink makes all relative href absolute. `href="my-page"` will be rendered as `href="/my-page"`.
|
|
14
|
+
|
|
15
|
+
Upgrade instructions: https://www.graphcommerce.org/docs/framework/links#upgrading-from-nextjs-12 ([@paales](https://github.com/paales))
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1766](https://github.com/graphcommerce-org/graphcommerce/pull/1766) [`c408c0a88`](https://github.com/graphcommerce-org/graphcommerce/commit/c408c0a8836c3ef1f54527b503d1d62855f08d3c) - Added Magento configuration section to the docs ([@paales](https://github.com/paales))
|
|
20
|
+
|
|
3
21
|
## 5.2.0-canary.2
|
|
4
22
|
|
|
5
23
|
## 5.2.0-canary.1
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Handling links in GraphCommerce
|
|
2
|
+
|
|
3
|
+
GraphCommerce integrates the next/link functionality with @mui/material's Link
|
|
4
|
+
and ButtonBase (and all it's derivatives) components with NextLink. There is no
|
|
5
|
+
need to wrap a Link component with next/link anymore.
|
|
6
|
+
|
|
7
|
+
NextLink automatically adds `target="_blank"` when the href is external.
|
|
8
|
+
|
|
9
|
+
NextLink makes all relative href absolute. `<Link href="my-page"/>` will be
|
|
10
|
+
rendered as `<Link href="/my-page"/>`.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
Using NextLink is as simple as using the Link/Button component from
|
|
15
|
+
@mui/material.
|
|
16
|
+
|
|
17
|
+
### Basic usage
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { Link, Fab, Button } from '@mui/material'
|
|
21
|
+
|
|
22
|
+
function MyComponent() {
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<Link href='/about'>About</Link>
|
|
26
|
+
<Button href='/bla'>Styled as a button</Button>
|
|
27
|
+
<Link href='https://www.graphcommerce.org/'>GraphCommerce©</Link>
|
|
28
|
+
</>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Using next/link's props or relative URL's
|
|
34
|
+
|
|
35
|
+
If you want to use props of next/link and satisfy typescript you need to provide
|
|
36
|
+
`component={NextLink}`.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Link } from '@mui/material'
|
|
40
|
+
import { NextLink } from '@graphcommerce/next-ui'
|
|
41
|
+
|
|
42
|
+
function MyComponent() {
|
|
43
|
+
return (
|
|
44
|
+
<Link href='subpage' relative component={NextLink} prefetch={false}>
|
|
45
|
+
About
|
|
46
|
+
</Link>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Using next/link with a custom component
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Chip } from '@mui/material'
|
|
55
|
+
import { NextLink } from '@graphcommerce/next-ui'
|
|
56
|
+
|
|
57
|
+
function MyComponent() {
|
|
58
|
+
return <Chip component={NextLink} href={`/${url}`} label={'my label'} />
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Upgrading from Next.js 12
|
|
63
|
+
|
|
64
|
+
Before Next.js 13, the next/link component needed to wrap a Material-UI Link
|
|
65
|
+
component;
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import PageLink from 'next/link'
|
|
69
|
+
import { Link } from '@mui/material'
|
|
70
|
+
|
|
71
|
+
function MyComponent() {
|
|
72
|
+
return (
|
|
73
|
+
<PageLink href='/about' passHref>
|
|
74
|
+
<Link>About</Link>
|
|
75
|
+
</PageLink>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
To upgrade this component to Next.js 13, you can remove the PageLink component.
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { Link } from '@mui/material'
|
|
84
|
+
|
|
85
|
+
function MyComponent() {
|
|
86
|
+
return <Link href='/about'>About</Link>
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Upgrading a Link that uses next/link props
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import PageLink from 'next/link'
|
|
94
|
+
import { Link } from '@mui/material'
|
|
95
|
+
|
|
96
|
+
function MyComponent() {
|
|
97
|
+
return (
|
|
98
|
+
<PageLink href='/about' passHref prefetch={false}>
|
|
99
|
+
<Link>Link without prefetch</Link>
|
|
100
|
+
</PageLink>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { Link } from '@mui/material'
|
|
107
|
+
import { NextLink } from '@graphcommerce/next-ui'
|
|
108
|
+
|
|
109
|
+
function MyComponent() {
|
|
110
|
+
return (
|
|
111
|
+
<>
|
|
112
|
+
<Link href='/about' component={NextLink} prefetch={false}>
|
|
113
|
+
Link without prefetch
|
|
114
|
+
</Link>
|
|
115
|
+
</>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Further reading
|
|
121
|
+
|
|
122
|
+
-
|
package/magento/readme.md
CHANGED
|
@@ -7,6 +7,49 @@ menu: Overview
|
|
|
7
7
|
To integrate with Magento, most of the functionality should work out-of-the box
|
|
8
8
|
if Magento exposes a working GraphQL API.
|
|
9
9
|
|
|
10
|
+
## Magento configuration
|
|
11
|
+
|
|
12
|
+
### Configure Base Link Url to get emails working
|
|
13
|
+
|
|
14
|
+
Configure the Base Link Url's to match your GraphCommerce frontend URL per
|
|
15
|
+
storeview with the locale included. e.g. `https://graphcommerce.vercel.app/nl/`
|
|
16
|
+
|
|
17
|
+
Unsecure:
|
|
18
|
+
`Stores -> Configuration -> General -> Web -> Base URLs -> Base Link Url`
|
|
19
|
+
|
|
20
|
+
Secure:
|
|
21
|
+
`Stores -> Configuration -> General -> Web -> Base URLs (secure) -> Base Link Url`
|
|
22
|
+
|
|
23
|
+
### Configure Base Link Url with 'Add Store Code to Urls' enabled:
|
|
24
|
+
|
|
25
|
+
If you are including the store code in the URL you can configure the above on
|
|
26
|
+
the website scope without the locale added.
|
|
27
|
+
|
|
28
|
+
To properly redirect to the actual URL used in the fontend add redirects to
|
|
29
|
+
next.config.js:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
/** @type {import('next').NextConfig} */
|
|
33
|
+
const config = {
|
|
34
|
+
async redirects() {
|
|
35
|
+
return [
|
|
36
|
+
{ source: '/b2b_nl/:path*', destination: '/nl/:path*', permanent: false },
|
|
37
|
+
{ source: '/b2b_en/:path*', destination: '/en/:path*', permanent: false },
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Configure the address lines to fix the checkout
|
|
44
|
+
|
|
45
|
+
Set the number of address lines to 3. (default is 2)
|
|
46
|
+
|
|
47
|
+
For Magento Open Source:
|
|
48
|
+
`Stores -> Configuration -> Customers -> Customer Configuration -> Name and address options`
|
|
49
|
+
|
|
50
|
+
For Adobe Commerce:
|
|
51
|
+
`Stores -> Attributes -> Customer Address -> street -> Lines Count`
|
|
52
|
+
|
|
10
53
|
## Optional packages
|
|
11
54
|
|
|
12
55
|
- [Store Pickup / MSI](https://github.com/graphcommerce-org/graphcommerce/tree/main/packages/magento-cart-pickup)
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "@graphcommerce/docs",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/docs",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce/docs",
|
|
5
|
-
"version": "5.2.0-canary.
|
|
5
|
+
"version": "5.2.0-canary.4",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@graphcommerce/prettier-config-pwa": "5.2.0-canary.
|
|
8
|
+
"@graphcommerce/prettier-config-pwa": "5.2.0-canary.4"
|
|
9
9
|
},
|
|
10
10
|
"prettier": "@graphcommerce/prettier-config-pwa"
|
|
11
11
|
}
|