@graphcommerce/demo-magento-graphcommerce 4.14.0-canary.7
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 +9 -0
- package/README.md +19 -0
- package/graphql/demo/DemoProductPageItem.graphql +6 -0
- package/package.json +33 -0
- package/plugins/demo/DemoProductListItem.tsx +22 -0
- package/plugins/demo/DemoProductListItemConfigurable.tsx +12 -0
- package/plugins/demo/DemoProductListItemsBase.tsx +30 -0
- package/tsconfig.json +5 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @graphcommerce/demo-magento-graphcommerce
|
|
2
|
+
|
|
3
|
+
## 4.14.0-canary.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1738](https://github.com/graphcommerce-org/graphcommerce/pull/1738) [`bd3a30438`](https://github.com/graphcommerce-org/graphcommerce/commit/bd3a30438cf6b69cd37a191406c8190a20e572cc) - Created directive @env(if: String!) on FRAGMENT_DEFINITION to conditionally include a fragment ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
9
|
+
- [#1738](https://github.com/graphcommerce-org/graphcommerce/pull/1738) [`6171ad02c`](https://github.com/graphcommerce-org/graphcommerce/commit/6171ad02c19782b1e1f0eb00ea25ea6b764250b5) - Added topological sorting to plugins and added ifEnv export to plugins to conditionally load plugins ([@paales](https://github.com/paales))
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# demo-magento-graphcommerce
|
|
2
|
+
|
|
3
|
+
There are specifc configurations for the backend used in the demo. Take a look
|
|
4
|
+
at the graphql and plugins directory to see what is changed for the demo.
|
|
5
|
+
|
|
6
|
+
To start with a complete copy of the demo as used on
|
|
7
|
+
https://graphcommerce.vercel.app:
|
|
8
|
+
|
|
9
|
+
1. Copy the [graphql](./graphql/) directory to your local project.
|
|
10
|
+
2. Copy the [plugins](./plugins/) directory to your local project.
|
|
11
|
+
3. Copy the [package.json](./package.json) `{ dependencies: { ... } }` to your
|
|
12
|
+
package.
|
|
13
|
+
4. `yarn install`
|
|
14
|
+
5. `yarn codegen`
|
|
15
|
+
6. `yarn dev`
|
|
16
|
+
|
|
17
|
+
## Demo usage
|
|
18
|
+
|
|
19
|
+
DEMO_MAGENTO_GRAPHCOMMERCE="1"
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@graphcommerce/demo-magento-graphcommerce",
|
|
3
|
+
"homepage": "https://www.graphcommerce.org/",
|
|
4
|
+
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
+
"version": "4.14.0-canary.7",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "tsc -W"
|
|
9
|
+
},
|
|
10
|
+
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
11
|
+
"eslintConfig": {
|
|
12
|
+
"extends": "@graphcommerce/eslint-config-pwa",
|
|
13
|
+
"parserOptions": {
|
|
14
|
+
"project": "./tsconfig.json"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.11",
|
|
19
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.7",
|
|
20
|
+
"@graphcommerce/typescript-config-pwa": "^4.0.5",
|
|
21
|
+
"@playwright/test": "^1.21.1"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@mui/material": "5.5.3",
|
|
25
|
+
"next": "^12.1.2",
|
|
26
|
+
"react": "^18.0.0",
|
|
27
|
+
"react-dom": "^18.0.0"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@graphcommerce/magento-product": "4.14.0-canary.7",
|
|
31
|
+
"@graphcommerce/magento-product-configurable": "4.14.0-canary.7"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ProductListItemProps } from '@graphcommerce/magento-product'
|
|
2
|
+
import type { PluginProps } from '@graphcommerce/next-config'
|
|
3
|
+
import { Typography } from '@mui/material'
|
|
4
|
+
|
|
5
|
+
export const component = 'ProductListItem'
|
|
6
|
+
export const exported = '@graphcommerce/magento-product'
|
|
7
|
+
export const ifEnv = 'DEMO_MAGENTO_GRAPHCOMMERCE'
|
|
8
|
+
|
|
9
|
+
function DemoProductListItem(props: PluginProps<ProductListItemProps>) {
|
|
10
|
+
const { Prev, ...rest } = props
|
|
11
|
+
return (
|
|
12
|
+
<Prev
|
|
13
|
+
{...rest}
|
|
14
|
+
subTitle={
|
|
15
|
+
<Typography component='span' variant='caption'>
|
|
16
|
+
BY GC
|
|
17
|
+
</Typography>
|
|
18
|
+
}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
export const Plugin = DemoProductListItem
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProdustListItemConfigurableProps } from '@graphcommerce/magento-product-configurable'
|
|
2
|
+
import type { PluginProps } from '@graphcommerce/next-config'
|
|
3
|
+
|
|
4
|
+
export const component = 'ProductListItemConfigurable'
|
|
5
|
+
export const exported = '@graphcommerce/magento-product-configurable'
|
|
6
|
+
export const ifEnv = 'DEMO_MAGENTO_GRAPHCOMMERCE'
|
|
7
|
+
|
|
8
|
+
function DemoProductListItemConfigurable(props: PluginProps<ProdustListItemConfigurableProps>) {
|
|
9
|
+
const { Prev, ...rest } = props
|
|
10
|
+
return <Prev {...rest} swatchLocations={{ bottomRight: ['dominant_color'] }} />
|
|
11
|
+
}
|
|
12
|
+
export const Plugin = DemoProductListItemConfigurable
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ProductItemsGridProps } from '@graphcommerce/magento-product'
|
|
2
|
+
import type { PluginProps } from '@graphcommerce/next-config'
|
|
3
|
+
import { Theme } from '@mui/material'
|
|
4
|
+
|
|
5
|
+
export const component = 'ProductListItemsBase'
|
|
6
|
+
export const exported = '@graphcommerce/magento-product'
|
|
7
|
+
export const ifEnv = 'DEMO_MAGENTO_GRAPHCOMMERCE'
|
|
8
|
+
|
|
9
|
+
export const sxLargeItem = (theme: Theme) => ({
|
|
10
|
+
[theme.breakpoints.up('xl')]: {
|
|
11
|
+
'& > :nth-of-type(7n + 3)': {
|
|
12
|
+
gridColumn: 'span 2',
|
|
13
|
+
gridRow: 'span 2',
|
|
14
|
+
display: 'grid',
|
|
15
|
+
gridAutoFlow: 'row',
|
|
16
|
+
gridTemplateColumns: '100%',
|
|
17
|
+
gridTemplateRows: '1fr auto',
|
|
18
|
+
'& > div:first-of-type': {
|
|
19
|
+
position: 'relative',
|
|
20
|
+
height: '100%',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
function DemoProductListItemsBase(props: PluginProps<ProductItemsGridProps>) {
|
|
27
|
+
const { Prev, ...rest } = props
|
|
28
|
+
return <Prev {...rest} sx={sxLargeItem} />
|
|
29
|
+
}
|
|
30
|
+
export const Plugin = DemoProductListItemsBase
|