@graphcommerce/demo-magento-graphcommerce 9.0.4-canary.8 → 9.0.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 +7 -15
- package/package.json +9 -9
- package/plugins/demo/DemoRecentlyViewedProducts.tsx +3 -3
- package/copy/pages/test/[[...url]].tsx +0 -84
- package/copy/pages/test/buttons.tsx +0 -142
- package/copy/pages/test/form-elements.tsx +0 -164
- package/copy/pages/test/icons.tsx +0 -120
- package/copy/pages/test/minimal-page-shell/[[...url]].tsx +0 -257
- package/copy/pages/test/number-inputs.tsx +0 -106
- package/copy/pages/test/sheet.tsx +0 -128
- package/copy/pages/test/slider.tsx +0 -108
- package/copy/pages/test/typography.tsx +0 -136
- package/copy/pages/test/usebacklink/[[...url]].tsx +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
# @graphcommerce/demo-magento-graphcommerce
|
|
2
2
|
|
|
3
|
-
## 9.0.4
|
|
3
|
+
## 9.0.4
|
|
4
4
|
|
|
5
|
-
## 9.0.
|
|
5
|
+
## 9.0.3
|
|
6
6
|
|
|
7
|
-
## 9.0.
|
|
7
|
+
## 9.0.3-canary.0
|
|
8
8
|
|
|
9
|
-
## 9.0.
|
|
9
|
+
## 9.0.2
|
|
10
10
|
|
|
11
|
-
## 9.0.
|
|
11
|
+
## 9.0.2-canary.0
|
|
12
12
|
|
|
13
|
-
## 9.0.
|
|
13
|
+
## 9.0.1
|
|
14
14
|
|
|
15
|
-
## 9.0.
|
|
16
|
-
|
|
17
|
-
## 9.0.4-canary.1
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- [#2470](https://github.com/graphcommerce-org/graphcommerce/pull/2470) [`f5565b4`](https://github.com/graphcommerce-org/graphcommerce/commit/f5565b47d02c057d888fad94c1430d4e783c5e05) - Moved all test routes files to the demo package so they are out of the example directory. ([@paales](https://github.com/paales))
|
|
22
|
-
|
|
23
|
-
## 9.0.4-canary.0
|
|
15
|
+
## 9.0.1-canary.1
|
|
24
16
|
|
|
25
17
|
## 9.0.0
|
|
26
18
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/demo-magento-graphcommerce",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.0.4
|
|
5
|
+
"version": "9.0.4",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "tsc -W"
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.4
|
|
19
|
-
"@graphcommerce/framer-scroller": "^9.0.4
|
|
20
|
-
"@graphcommerce/magento-product": "^9.0.4
|
|
21
|
-
"@graphcommerce/magento-product-configurable": "^9.0.4
|
|
22
|
-
"@graphcommerce/magento-recently-viewed-products": "^9.0.4
|
|
23
|
-
"@graphcommerce/next-ui": "^9.0.4
|
|
24
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.4
|
|
25
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.4
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.4",
|
|
19
|
+
"@graphcommerce/framer-scroller": "^9.0.4",
|
|
20
|
+
"@graphcommerce/magento-product": "^9.0.4",
|
|
21
|
+
"@graphcommerce/magento-product-configurable": "^9.0.4",
|
|
22
|
+
"@graphcommerce/magento-recently-viewed-products": "^9.0.4",
|
|
23
|
+
"@graphcommerce/next-ui": "^9.0.4",
|
|
24
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.4",
|
|
25
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.4",
|
|
26
26
|
"@mui/material": "^5.10.16",
|
|
27
27
|
"framer-motion": "^11.0.0",
|
|
28
28
|
"next": "*",
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { ProductListItemType } from '@graphcommerce/magento-product'
|
|
2
2
|
import { AddProductsToCartForm } from '@graphcommerce/magento-product'
|
|
3
3
|
import {
|
|
4
|
+
type RecentlyViewedProductsProps,
|
|
4
5
|
useRecentlyViewedProducts,
|
|
5
6
|
useRecentlyViewedSkus,
|
|
6
|
-
type RecentlyViewedProductsProps,
|
|
7
7
|
} from '@graphcommerce/magento-recently-viewed-products'
|
|
8
8
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
9
9
|
import {
|
|
10
|
-
filterNonNullableKeys,
|
|
11
10
|
RenderType,
|
|
12
|
-
responsiveVal,
|
|
13
11
|
SidebarSlider,
|
|
12
|
+
filterNonNullableKeys,
|
|
13
|
+
responsiveVal,
|
|
14
14
|
} from '@graphcommerce/next-ui'
|
|
15
15
|
import { Box, Typography } from '@mui/material'
|
|
16
16
|
import { useInView } from 'framer-motion'
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { cacheFirst } from '@graphcommerce/graphql'
|
|
3
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
4
|
-
import type { GetStaticProps } from '@graphcommerce/next-ui'
|
|
5
|
-
import { LayoutTitle } from '@graphcommerce/next-ui'
|
|
6
|
-
import { i18n } from '@lingui/core'
|
|
7
|
-
import { Container, Divider, Link } from '@mui/material'
|
|
8
|
-
import type { GetStaticPaths } from 'next'
|
|
9
|
-
import type { LayoutNavigationProps } from '../../components'
|
|
10
|
-
import { LayoutDocument, LayoutNavigation } from '../../components'
|
|
11
|
-
import { graphqlSharedClient, graphqlSsrClient } from '../../lib/graphql/graphqlSsrClient'
|
|
12
|
-
import { LayoutDemo } from './minimal-page-shell/[[...url]]'
|
|
13
|
-
|
|
14
|
-
type Props = { url: string }
|
|
15
|
-
type RouteProps = { url: string[] }
|
|
16
|
-
type GetPageStaticPaths = GetStaticPaths<RouteProps>
|
|
17
|
-
type GetPageStaticProps = GetStaticProps<LayoutNavigationProps, Props, RouteProps>
|
|
18
|
-
|
|
19
|
-
function TestOverview() {
|
|
20
|
-
return (
|
|
21
|
-
<Container>
|
|
22
|
-
<LayoutDemo baseUrl='/test' />
|
|
23
|
-
<Divider />
|
|
24
|
-
<LayoutTitle
|
|
25
|
-
sx={(theme) => ({
|
|
26
|
-
'&.gutterBottom': {
|
|
27
|
-
marginBottom: theme.spacings.sm,
|
|
28
|
-
},
|
|
29
|
-
})}
|
|
30
|
-
>
|
|
31
|
-
Links to components
|
|
32
|
-
</LayoutTitle>
|
|
33
|
-
<Container maxWidth='md' sx={{ display: 'grid', gridColumns: '1' }}>
|
|
34
|
-
<Link href='/test/buttons'>Buttons</Link>
|
|
35
|
-
<Link href='/test/icons'>Icons</Link>
|
|
36
|
-
<Link href='/test/slider'>Slider</Link>
|
|
37
|
-
<Link href='/test/typography'>Typography</Link>
|
|
38
|
-
<Link href='/test/number-inputs'>Number-inputs</Link>
|
|
39
|
-
</Container>
|
|
40
|
-
</Container>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
TestOverview.pageOptions = {
|
|
45
|
-
Layout: LayoutNavigation,
|
|
46
|
-
} as PageOptions
|
|
47
|
-
|
|
48
|
-
export default TestOverview
|
|
49
|
-
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
51
|
-
export const getStaticPaths: GetPageStaticPaths = async ({ locales = [] }) => {
|
|
52
|
-
if (process.env.NODE_ENV === 'development') return { paths: [], fallback: 'blocking' }
|
|
53
|
-
|
|
54
|
-
const urls = ['index', 'other']
|
|
55
|
-
|
|
56
|
-
const paths = locales
|
|
57
|
-
.map((locale) => urls.map((url) => ({ params: { url: [url] }, locale })))
|
|
58
|
-
.flat(1)
|
|
59
|
-
|
|
60
|
-
return { paths, fallback: 'blocking' }
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
64
|
-
const { params } = context
|
|
65
|
-
const url = (params?.url ?? ['index']).join('/') ?? ''
|
|
66
|
-
|
|
67
|
-
const client = graphqlSharedClient(context)
|
|
68
|
-
const staticClient = graphqlSsrClient(context)
|
|
69
|
-
|
|
70
|
-
const conf = client.query({ query: StoreConfigDocument })
|
|
71
|
-
const layout = staticClient.query({
|
|
72
|
-
query: LayoutDocument,
|
|
73
|
-
fetchPolicy: cacheFirst(staticClient),
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
return {
|
|
77
|
-
props: {
|
|
78
|
-
url,
|
|
79
|
-
up: url !== 'index' ? { href: '/', title: i18n._(/* i18n */ 'Home') } : null,
|
|
80
|
-
...(await layout).data,
|
|
81
|
-
apolloState: await conf.then(() => client.cache.extract()),
|
|
82
|
-
},
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
3
|
-
import type { ButtonProps, GetStaticProps } from '@graphcommerce/next-ui'
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
iconBox,
|
|
7
|
-
iconChevronRight,
|
|
8
|
-
IconSvg,
|
|
9
|
-
LayoutHeader,
|
|
10
|
-
LayoutTitle,
|
|
11
|
-
responsiveVal,
|
|
12
|
-
} from '@graphcommerce/next-ui'
|
|
13
|
-
import { Box, Container, Divider, styled, Typography } from '@mui/material'
|
|
14
|
-
import React, { useState } from 'react'
|
|
15
|
-
import type { LayoutMinimalProps } from '../../components'
|
|
16
|
-
import { LayoutMinimal } from '../../components'
|
|
17
|
-
import { graphqlSharedClient } from '../../lib/graphql/graphqlSsrClient'
|
|
18
|
-
|
|
19
|
-
const variants = ['text', 'outlined', 'contained', 'pill', 'inline'] as const
|
|
20
|
-
const sizes = ['small', 'medium', 'large'] as const
|
|
21
|
-
const colors = ['inherit', 'primary', 'secondary'] as const
|
|
22
|
-
|
|
23
|
-
const propVariants: Record<string, ButtonProps> = {
|
|
24
|
-
Default: {},
|
|
25
|
-
'With start icon': {
|
|
26
|
-
startIcon: <IconSvg key='icon' src={iconBox} size='inherit' />,
|
|
27
|
-
loadingPosition: 'start',
|
|
28
|
-
},
|
|
29
|
-
'With end icon': {
|
|
30
|
-
endIcon: <IconSvg key='icon' src={iconChevronRight} size='inherit' />,
|
|
31
|
-
loadingPosition: 'end',
|
|
32
|
-
},
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const Grid = styled('div')(({ theme }) => ({
|
|
36
|
-
marginTop: `${5 * 8}px`,
|
|
37
|
-
marginBottom: `${5 * 8}px`,
|
|
38
|
-
display: 'grid',
|
|
39
|
-
gridAutoFlow: 'columns',
|
|
40
|
-
[theme.breakpoints.up('md')]: {
|
|
41
|
-
gridTemplateColumns: 'repeat(3, minmax(180px, 1fr))',
|
|
42
|
-
},
|
|
43
|
-
gap: responsiveVal(20, 40),
|
|
44
|
-
}))
|
|
45
|
-
|
|
46
|
-
function ButtonWithDemoState(props: ButtonProps) {
|
|
47
|
-
const [loading, setLoading] = useState(false)
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<Button
|
|
51
|
-
{...props}
|
|
52
|
-
loading={loading}
|
|
53
|
-
// disabled={loading}
|
|
54
|
-
onClick={() => {
|
|
55
|
-
setLoading(true)
|
|
56
|
-
setTimeout(() => setLoading(false), 2000)
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default function ButtonsPage() {
|
|
63
|
-
return (
|
|
64
|
-
<>
|
|
65
|
-
<LayoutHeader />
|
|
66
|
-
<Container>
|
|
67
|
-
<LayoutTitle variant='h1'>Buttons</LayoutTitle>
|
|
68
|
-
|
|
69
|
-
{Object.entries(propVariants).map(([propVariant, props]) => (
|
|
70
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
71
|
-
<React.Fragment key={propVariant}>
|
|
72
|
-
<Typography variant='h2' sx={{ mt: 8 }}>
|
|
73
|
-
{propVariant}
|
|
74
|
-
</Typography>
|
|
75
|
-
{variants.map((variant) => (
|
|
76
|
-
<React.Fragment key={variant}>
|
|
77
|
-
{/* <Typography variant='h3'>Variant: {variant}</Typography> */}
|
|
78
|
-
<Grid>
|
|
79
|
-
{colors.map((color) => (
|
|
80
|
-
<Typography
|
|
81
|
-
key={color}
|
|
82
|
-
variant='h6'
|
|
83
|
-
sx={{ display: 'inline-flex', alignItems: 'center', columnGap: 1 }}
|
|
84
|
-
>
|
|
85
|
-
Button {variant} {color}
|
|
86
|
-
<Box
|
|
87
|
-
sx={{
|
|
88
|
-
backgroundColor: `${color}.main`,
|
|
89
|
-
width: '1em',
|
|
90
|
-
height: '1em',
|
|
91
|
-
display: 'inline-block',
|
|
92
|
-
}}
|
|
93
|
-
/>
|
|
94
|
-
</Typography>
|
|
95
|
-
))}
|
|
96
|
-
|
|
97
|
-
{sizes.map((size) => (
|
|
98
|
-
<React.Fragment key={size}>
|
|
99
|
-
{colors.map((color) => (
|
|
100
|
-
<div key={color}>
|
|
101
|
-
<ButtonWithDemoState
|
|
102
|
-
variant={variant}
|
|
103
|
-
color={color}
|
|
104
|
-
size={size}
|
|
105
|
-
{...props}
|
|
106
|
-
onClick={() => {}}
|
|
107
|
-
>
|
|
108
|
-
Button
|
|
109
|
-
</ButtonWithDemoState>
|
|
110
|
-
</div>
|
|
111
|
-
))}
|
|
112
|
-
</React.Fragment>
|
|
113
|
-
))}
|
|
114
|
-
</Grid>
|
|
115
|
-
<Divider />
|
|
116
|
-
</React.Fragment>
|
|
117
|
-
))}
|
|
118
|
-
</React.Fragment>
|
|
119
|
-
))}
|
|
120
|
-
</Container>
|
|
121
|
-
</>
|
|
122
|
-
)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const pageOptions: PageOptions<LayoutMinimalProps> = {
|
|
126
|
-
Layout: LayoutMinimal,
|
|
127
|
-
layoutProps: {},
|
|
128
|
-
}
|
|
129
|
-
ButtonsPage.pageOptions = pageOptions
|
|
130
|
-
|
|
131
|
-
type GetPageStaticProps = GetStaticProps<LayoutMinimalProps>
|
|
132
|
-
|
|
133
|
-
export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
134
|
-
const client = graphqlSharedClient(context)
|
|
135
|
-
const conf = client.query({ query: StoreConfigDocument })
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
props: {
|
|
139
|
-
apolloState: await conf.then(() => client.cache.extract()),
|
|
140
|
-
},
|
|
141
|
-
}
|
|
142
|
-
}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ActionCardListForm,
|
|
3
|
-
CheckboxButtonGroup,
|
|
4
|
-
NumberFieldElement,
|
|
5
|
-
RadioButtonGroup,
|
|
6
|
-
SelectElement,
|
|
7
|
-
TextFieldElement,
|
|
8
|
-
} from '@graphcommerce/ecommerce-ui'
|
|
9
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
10
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
11
|
-
import type { GetStaticProps } from '@graphcommerce/next-ui'
|
|
12
|
-
import {
|
|
13
|
-
ActionCard,
|
|
14
|
-
Button,
|
|
15
|
-
Form,
|
|
16
|
-
FormActions,
|
|
17
|
-
FormRow,
|
|
18
|
-
LayoutHeader,
|
|
19
|
-
LayoutTitle,
|
|
20
|
-
} from '@graphcommerce/next-ui'
|
|
21
|
-
import { FormAutoSubmit, FormPersist, useForm } from '@graphcommerce/react-hook-form'
|
|
22
|
-
import { Container, List, ListItem, TextField, Typography } from '@mui/material'
|
|
23
|
-
import type { LayoutMinimalProps } from '../../components'
|
|
24
|
-
import { LayoutMinimal } from '../../components'
|
|
25
|
-
import { graphqlSharedClient } from '../../lib/graphql/graphqlSsrClient'
|
|
26
|
-
|
|
27
|
-
type FormValues = {
|
|
28
|
-
checkboxButtonGroup: string[]
|
|
29
|
-
selectElement: string
|
|
30
|
-
textFieldElement: string
|
|
31
|
-
numberFieldElement: number
|
|
32
|
-
actionCardList: string
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default function IconsPage() {
|
|
36
|
-
const form = useForm<FormValues>()
|
|
37
|
-
const { control, handleSubmit } = form
|
|
38
|
-
|
|
39
|
-
const submit = handleSubmit((data) => {
|
|
40
|
-
console.log(data)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<>
|
|
45
|
-
<LayoutHeader />
|
|
46
|
-
|
|
47
|
-
<LayoutTitle variant='h1'>Form Elements</LayoutTitle>
|
|
48
|
-
|
|
49
|
-
<Container maxWidth='md'>
|
|
50
|
-
<Form onSubmit={submit} contained background='default'>
|
|
51
|
-
<FormRow>
|
|
52
|
-
<CheckboxButtonGroup
|
|
53
|
-
control={control}
|
|
54
|
-
label='Checkbox Button Group'
|
|
55
|
-
name='checkboxButtonGroup'
|
|
56
|
-
options={[
|
|
57
|
-
{ id: 'one', label: 'One' },
|
|
58
|
-
{ id: 'two', label: 'Two' },
|
|
59
|
-
]}
|
|
60
|
-
/>
|
|
61
|
-
</FormRow>
|
|
62
|
-
|
|
63
|
-
<FormRow>
|
|
64
|
-
<SelectElement
|
|
65
|
-
control={control}
|
|
66
|
-
name='selectElement'
|
|
67
|
-
label='Select Element'
|
|
68
|
-
options={[
|
|
69
|
-
{ id: 'one', label: 'One' },
|
|
70
|
-
{ id: 'two', label: 'Two' },
|
|
71
|
-
]}
|
|
72
|
-
/>
|
|
73
|
-
|
|
74
|
-
<SelectElement
|
|
75
|
-
control={control}
|
|
76
|
-
name='selectElement'
|
|
77
|
-
SelectProps={{ native: true }}
|
|
78
|
-
label='Select Element Native'
|
|
79
|
-
options={[
|
|
80
|
-
{ id: 'one', label: 'One' },
|
|
81
|
-
{ id: 'two', label: 'Two' },
|
|
82
|
-
]}
|
|
83
|
-
/>
|
|
84
|
-
</FormRow>
|
|
85
|
-
|
|
86
|
-
<FormRow>
|
|
87
|
-
<RadioButtonGroup
|
|
88
|
-
control={control}
|
|
89
|
-
name='selectElement'
|
|
90
|
-
label='Radio Button Group'
|
|
91
|
-
options={[
|
|
92
|
-
{ id: 'one', label: 'Radio One' },
|
|
93
|
-
{ id: 'two', label: 'Radio Two' },
|
|
94
|
-
]}
|
|
95
|
-
/>
|
|
96
|
-
</FormRow>
|
|
97
|
-
|
|
98
|
-
<FormRow>
|
|
99
|
-
<TextFieldElement control={control} name='textFieldElement' label='TextFieldElement' />
|
|
100
|
-
<NumberFieldElement
|
|
101
|
-
defaultValue={0}
|
|
102
|
-
control={control}
|
|
103
|
-
name='numberFieldElement'
|
|
104
|
-
label='Number'
|
|
105
|
-
variant='standard'
|
|
106
|
-
inputProps={{ min: 1 }}
|
|
107
|
-
InputProps={{ disableUnderline: true }}
|
|
108
|
-
/>
|
|
109
|
-
</FormRow>
|
|
110
|
-
|
|
111
|
-
<Typography variant='h6'>Action Card List</Typography>
|
|
112
|
-
|
|
113
|
-
<FormRow>
|
|
114
|
-
<ActionCardListForm
|
|
115
|
-
control={control}
|
|
116
|
-
name='actionCardList'
|
|
117
|
-
layout='grid'
|
|
118
|
-
items={[
|
|
119
|
-
{ value: 'one', title: 'One' },
|
|
120
|
-
{ value: 'two', title: 'Two' },
|
|
121
|
-
]}
|
|
122
|
-
render={ActionCard}
|
|
123
|
-
/>
|
|
124
|
-
</FormRow>
|
|
125
|
-
|
|
126
|
-
<FormActions>
|
|
127
|
-
<Button type='submit' variant='pill' color='primary' size='large'>
|
|
128
|
-
Submit
|
|
129
|
-
</Button>
|
|
130
|
-
</FormActions>
|
|
131
|
-
|
|
132
|
-
<List>
|
|
133
|
-
<ListItem>Form is persisted with FormPersist</ListItem>
|
|
134
|
-
<ListItem>
|
|
135
|
-
Form is automatically submitted with FormAutoSubmit when the Number field changes
|
|
136
|
-
</ListItem>
|
|
137
|
-
</List>
|
|
138
|
-
|
|
139
|
-
<FormAutoSubmit control={control} submit={submit} name={['numberFieldElement']} />
|
|
140
|
-
<FormPersist<FormValues> form={form} name='form-elements' />
|
|
141
|
-
</Form>
|
|
142
|
-
</Container>
|
|
143
|
-
</>
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const pageOptions: PageOptions<LayoutMinimalProps> = {
|
|
148
|
-
Layout: LayoutMinimal,
|
|
149
|
-
layoutProps: {},
|
|
150
|
-
}
|
|
151
|
-
IconsPage.pageOptions = pageOptions
|
|
152
|
-
|
|
153
|
-
type GetPageStaticProps = GetStaticProps<LayoutMinimalProps>
|
|
154
|
-
|
|
155
|
-
export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
156
|
-
const client = graphqlSharedClient(context)
|
|
157
|
-
const conf = client.query({ query: StoreConfigDocument })
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
props: {
|
|
161
|
-
apolloState: await conf.then(() => client.cache.extract()),
|
|
162
|
-
},
|
|
163
|
-
}
|
|
164
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
3
|
-
import type { GetStaticProps, IconSvgProps } from '@graphcommerce/next-ui'
|
|
4
|
-
import {
|
|
5
|
-
iconPhone,
|
|
6
|
-
IconSvg,
|
|
7
|
-
LayoutHeader,
|
|
8
|
-
LayoutTitle,
|
|
9
|
-
svgIconStrokeWidth,
|
|
10
|
-
} from '@graphcommerce/next-ui'
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
12
|
-
import { Box, Container, Slider, Typography } from '@mui/material'
|
|
13
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
14
|
-
import type { LayoutMinimalProps } from '../../components'
|
|
15
|
-
import { LayoutMinimal } from '../../components'
|
|
16
|
-
import { graphqlSharedClient } from '../../lib/graphql/graphqlSsrClient'
|
|
17
|
-
|
|
18
|
-
const propVariants: Record<string, IconSvgProps> = {
|
|
19
|
-
Default: {
|
|
20
|
-
src: iconPhone,
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default function IconsPage() {
|
|
25
|
-
const [size, setSize] = useState<number>(24)
|
|
26
|
-
const [strokeComputed, setStrokeWidth] = useState<string>()
|
|
27
|
-
const [fontSize, setFontSize] = useState<string>()
|
|
28
|
-
const ref = useRef<SVGSVGElement>(null)
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!ref.current) return
|
|
32
|
-
|
|
33
|
-
setStrokeWidth(getComputedStyle(ref.current).strokeWidth)
|
|
34
|
-
setFontSize(ref.current.style.fontSize)
|
|
35
|
-
}, [size])
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
<LayoutHeader />
|
|
40
|
-
<Container>
|
|
41
|
-
<LayoutTitle variant='h1'>Icons</LayoutTitle>
|
|
42
|
-
|
|
43
|
-
<Slider
|
|
44
|
-
min={5}
|
|
45
|
-
max={150}
|
|
46
|
-
// step={12}
|
|
47
|
-
defaultValue={24}
|
|
48
|
-
onChange={(_, newValue) => setSize(newValue as number)}
|
|
49
|
-
aria-label='Default'
|
|
50
|
-
valueLabelDisplay='auto'
|
|
51
|
-
/>
|
|
52
|
-
|
|
53
|
-
<Box>
|
|
54
|
-
<code style={{ display: 'block' }}>font-size: {fontSize}</code>
|
|
55
|
-
<code style={{ display: 'block' }}>
|
|
56
|
-
stroke-width: {svgIconStrokeWidth(28, 148, 1.4, 0.8)}
|
|
57
|
-
</code>
|
|
58
|
-
<code style={{ display: 'block' }}>computed: {strokeComputed}</code>
|
|
59
|
-
</Box>
|
|
60
|
-
|
|
61
|
-
{Object.entries(propVariants).map(([propVariant, props]) => (
|
|
62
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
63
|
-
<React.Fragment key={propVariant}>
|
|
64
|
-
<IconSvg {...props} style={{ fontSize: size }} ref={ref} />
|
|
65
|
-
|
|
66
|
-
<Typography variant='h1' sx={{ mt: 8 }}>
|
|
67
|
-
{propVariant} <IconSvg {...props} />
|
|
68
|
-
</Typography>
|
|
69
|
-
<Typography variant='h2' sx={{ mt: 8 }}>
|
|
70
|
-
{propVariant}
|
|
71
|
-
<IconSvg {...props} />
|
|
72
|
-
</Typography>
|
|
73
|
-
<Typography variant='h3' sx={{ mt: 8 }}>
|
|
74
|
-
{propVariant} <IconSvg {...props} />
|
|
75
|
-
</Typography>
|
|
76
|
-
<Typography variant='h4' sx={{ mt: 8 }}>
|
|
77
|
-
{propVariant}
|
|
78
|
-
<IconSvg {...props} />
|
|
79
|
-
</Typography>
|
|
80
|
-
<Typography variant='h5' sx={{ mt: 8 }}>
|
|
81
|
-
{propVariant}
|
|
82
|
-
<IconSvg {...props} />
|
|
83
|
-
</Typography>
|
|
84
|
-
<Typography variant='h6' sx={{ mt: 8 }}>
|
|
85
|
-
{propVariant}
|
|
86
|
-
<IconSvg {...props} />
|
|
87
|
-
</Typography>
|
|
88
|
-
<Typography variant='subtitle1' sx={{ mt: 8 }}>
|
|
89
|
-
{propVariant}
|
|
90
|
-
<IconSvg {...props} />
|
|
91
|
-
</Typography>
|
|
92
|
-
<Typography variant='body1'>
|
|
93
|
-
{propVariant}
|
|
94
|
-
<IconSvg {...props} />
|
|
95
|
-
</Typography>
|
|
96
|
-
</React.Fragment>
|
|
97
|
-
))}
|
|
98
|
-
</Container>
|
|
99
|
-
</>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const pageOptions: PageOptions<LayoutMinimalProps> = {
|
|
104
|
-
Layout: LayoutMinimal,
|
|
105
|
-
layoutProps: {},
|
|
106
|
-
}
|
|
107
|
-
IconsPage.pageOptions = pageOptions
|
|
108
|
-
|
|
109
|
-
type GetPageStaticProps = GetStaticProps<LayoutMinimalProps>
|
|
110
|
-
|
|
111
|
-
export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
112
|
-
const client = graphqlSharedClient(context)
|
|
113
|
-
const conf = client.query({ query: StoreConfigDocument })
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
props: {
|
|
117
|
-
apolloState: await conf.then(() => client.cache.extract()),
|
|
118
|
-
},
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { usePageContext } from '@graphcommerce/framer-next-pages'
|
|
3
|
-
import {
|
|
4
|
-
iconPerson,
|
|
5
|
-
LayoutHeader,
|
|
6
|
-
LayoutTitle,
|
|
7
|
-
LinkOrButton,
|
|
8
|
-
NextLink,
|
|
9
|
-
Stepper,
|
|
10
|
-
} from '@graphcommerce/next-ui'
|
|
11
|
-
import { Container, Divider, List, ListItemButton } from '@mui/material'
|
|
12
|
-
import { m } from 'framer-motion'
|
|
13
|
-
import { useRouter } from 'next/router'
|
|
14
|
-
import React, { useState } from 'react'
|
|
15
|
-
import type { LayoutMinimalProps } from '../../../components'
|
|
16
|
-
import { LayoutMinimal } from '../../../components'
|
|
17
|
-
|
|
18
|
-
type LayoutDemoProps = {
|
|
19
|
-
baseUrl: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function LayoutDemo(props: LayoutDemoProps) {
|
|
23
|
-
const { baseUrl } = props
|
|
24
|
-
|
|
25
|
-
const queryParams = useRouter().asPath.split('/')
|
|
26
|
-
const urlParts = queryParams.pop()?.split('-') ?? []
|
|
27
|
-
|
|
28
|
-
const title = urlParts.map((s = '') => `${s.charAt(0).toUpperCase() + s.slice(1)}`).join(' ')
|
|
29
|
-
const [scroll, setScroll] = useState<boolean>(false)
|
|
30
|
-
const { backSteps } = usePageContext()
|
|
31
|
-
|
|
32
|
-
const withPrimary = urlParts.includes('primary')
|
|
33
|
-
const withStepper = urlParts.includes('stepper')
|
|
34
|
-
const step = Number(urlParts[urlParts.length - 1])
|
|
35
|
-
const withIcon = urlParts.includes('icon')
|
|
36
|
-
const withTitle = urlParts.includes('title')
|
|
37
|
-
|
|
38
|
-
const isLeftSidebarDrawer = urlParts.includes('left') || queryParams.includes('left')
|
|
39
|
-
const isSidebarDrawer =
|
|
40
|
-
isLeftSidebarDrawer || urlParts.includes('right') || queryParams.includes('right')
|
|
41
|
-
const isSheet = queryParams.includes('sheet')
|
|
42
|
-
const isMinimal = urlParts.includes('minimal') || queryParams.includes('minimal-page-shell')
|
|
43
|
-
const isMinimalPageShellSubheader =
|
|
44
|
-
urlParts.includes('subheader') || queryParams.includes('minimal-page-shell-subheader')
|
|
45
|
-
const isFullPage = !isSheet && !isMinimal && !isMinimalPageShellSubheader
|
|
46
|
-
|
|
47
|
-
let primaryAction: React.ReactNode
|
|
48
|
-
|
|
49
|
-
if (withPrimary)
|
|
50
|
-
primaryAction = (
|
|
51
|
-
<LinkOrButton
|
|
52
|
-
href={`${baseUrl}/with-primary-navigated`}
|
|
53
|
-
color='secondary'
|
|
54
|
-
button={{ variant: 'pill' }}
|
|
55
|
-
>
|
|
56
|
-
Navigate
|
|
57
|
-
</LinkOrButton>
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
if (withStepper && step < 3) {
|
|
61
|
-
primaryAction = (
|
|
62
|
-
<LinkOrButton
|
|
63
|
-
href={`${baseUrl}/with-stepper-${step + 1}`}
|
|
64
|
-
color='secondary'
|
|
65
|
-
button={{ variant: 'pill' }}
|
|
66
|
-
>
|
|
67
|
-
Navigate
|
|
68
|
-
</LinkOrButton>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let titleComponent = (
|
|
73
|
-
<LayoutTitle size='small' component='span'>
|
|
74
|
-
{title}
|
|
75
|
-
</LayoutTitle>
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
if (withIcon)
|
|
79
|
-
titleComponent = (
|
|
80
|
-
<LayoutTitle icon={iconPerson} size='small' component='span'>
|
|
81
|
-
{title}
|
|
82
|
-
</LayoutTitle>
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<>
|
|
87
|
-
<LayoutTitle>Layout demo</LayoutTitle>
|
|
88
|
-
<LayoutHeader
|
|
89
|
-
primary={primaryAction}
|
|
90
|
-
divider={
|
|
91
|
-
withStepper ? (
|
|
92
|
-
<Container maxWidth={false}>
|
|
93
|
-
<Stepper steps={3} currentStep={step} />
|
|
94
|
-
</Container>
|
|
95
|
-
) : undefined
|
|
96
|
-
}
|
|
97
|
-
floatingMd={isFullPage}
|
|
98
|
-
noAlign={isSheet}
|
|
99
|
-
switchPoint={0}
|
|
100
|
-
>
|
|
101
|
-
{isMinimal || isSheet || withIcon || withTitle ? titleComponent : undefined}
|
|
102
|
-
</LayoutHeader>
|
|
103
|
-
|
|
104
|
-
<Container maxWidth='md' style={{ paddingTop: '50px' }}>
|
|
105
|
-
{/* <LayoutTitle icon={withIcon ? iconPerson : undefined}>{title}</LayoutTitle> */}
|
|
106
|
-
|
|
107
|
-
{/* {isSheet && !primaryAction && (
|
|
108
|
-
<Typography variant='body1' gutterBottom>
|
|
109
|
-
When opening a sheet a close icon is shown at the top right.
|
|
110
|
-
</Typography>
|
|
111
|
-
)}
|
|
112
|
-
|
|
113
|
-
{primaryAction && backSteps === 0 && (
|
|
114
|
-
<Typography variant='body1' gutterBottom>
|
|
115
|
-
When a primary action is present, the close button moves to the left.
|
|
116
|
-
</Typography>
|
|
117
|
-
)}
|
|
118
|
-
|
|
119
|
-
{backSteps > 0 && (
|
|
120
|
-
<Typography variant='body1' gutterBottom>
|
|
121
|
-
When navigated inside the overlay, a backbutton is shown on in the top left.
|
|
122
|
-
</Typography>
|
|
123
|
-
)}
|
|
124
|
-
|
|
125
|
-
{primaryAction && backSteps > 0 && (
|
|
126
|
-
<Typography variant='body1' gutterBottom>
|
|
127
|
-
With a primary action and back button, there is no room for the close button. The close
|
|
128
|
-
button gets ommited
|
|
129
|
-
</Typography>
|
|
130
|
-
)} */}
|
|
131
|
-
|
|
132
|
-
<Divider />
|
|
133
|
-
|
|
134
|
-
<List>
|
|
135
|
-
{primaryAction || backSteps === 0 ? (
|
|
136
|
-
<ListItemButton
|
|
137
|
-
href={`${baseUrl}/navigated`}
|
|
138
|
-
component={NextLink}
|
|
139
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
140
|
-
>
|
|
141
|
-
Navigate
|
|
142
|
-
</ListItemButton>
|
|
143
|
-
) : null}
|
|
144
|
-
|
|
145
|
-
<ListItemButton
|
|
146
|
-
href={`${baseUrl}/with-primary`}
|
|
147
|
-
component={NextLink}
|
|
148
|
-
disabled={!!primaryAction}
|
|
149
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
150
|
-
>
|
|
151
|
-
With primary action
|
|
152
|
-
</ListItemButton>
|
|
153
|
-
|
|
154
|
-
<ListItemButton
|
|
155
|
-
href={`${baseUrl}/with-stepper-1`}
|
|
156
|
-
component={NextLink}
|
|
157
|
-
disabled={withStepper}
|
|
158
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
159
|
-
>
|
|
160
|
-
With stepper
|
|
161
|
-
</ListItemButton>
|
|
162
|
-
|
|
163
|
-
<ListItemButton
|
|
164
|
-
href={`${baseUrl}/with-icon`}
|
|
165
|
-
component={NextLink}
|
|
166
|
-
disabled={withIcon}
|
|
167
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
168
|
-
>
|
|
169
|
-
With icon
|
|
170
|
-
</ListItemButton>
|
|
171
|
-
|
|
172
|
-
<ListItemButton
|
|
173
|
-
href='/test/sheet?sizeMd=full&sizeSm=full&justifyMd=stretch&justifySm=stretch&variantMd=bottom&variantSm=bottom'
|
|
174
|
-
component={NextLink}
|
|
175
|
-
disabled={isSheet && !isSidebarDrawer}
|
|
176
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
177
|
-
>
|
|
178
|
-
Bottom sheet
|
|
179
|
-
</ListItemButton>
|
|
180
|
-
|
|
181
|
-
<ListItemButton
|
|
182
|
-
href='/test/sheet?sizeMd=full&sizeSm=full&justifyMd=start&justifySm=start&variantMd=left&variantSm=left'
|
|
183
|
-
component={NextLink}
|
|
184
|
-
disabled={isLeftSidebarDrawer}
|
|
185
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
186
|
-
>
|
|
187
|
-
Left side sheet
|
|
188
|
-
</ListItemButton>
|
|
189
|
-
|
|
190
|
-
<ListItemButton
|
|
191
|
-
href='/test/sheet?sizeMd=full&sizeSm=full&justifyMd=start&justifySm=start&variantMd=right&variantSm=right'
|
|
192
|
-
component={NextLink}
|
|
193
|
-
disabled={isSidebarDrawer && !isLeftSidebarDrawer}
|
|
194
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
195
|
-
>
|
|
196
|
-
Right side sheet
|
|
197
|
-
</ListItemButton>
|
|
198
|
-
|
|
199
|
-
<ListItemButton
|
|
200
|
-
href='/test/minimal-page-shell'
|
|
201
|
-
component={NextLink}
|
|
202
|
-
disabled={isMinimal}
|
|
203
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
204
|
-
>
|
|
205
|
-
Minimal Page Shell
|
|
206
|
-
</ListItemButton>
|
|
207
|
-
|
|
208
|
-
<ListItemButton
|
|
209
|
-
href='/test'
|
|
210
|
-
component={NextLink}
|
|
211
|
-
disabled={isFullPage}
|
|
212
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
213
|
-
>
|
|
214
|
-
Full Page Shell
|
|
215
|
-
</ListItemButton>
|
|
216
|
-
|
|
217
|
-
<ListItemButton
|
|
218
|
-
href='/test/with-title'
|
|
219
|
-
component={NextLink}
|
|
220
|
-
disabled={withTitle}
|
|
221
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
222
|
-
>
|
|
223
|
-
Full Page Shell + Title
|
|
224
|
-
</ListItemButton>
|
|
225
|
-
|
|
226
|
-
<ListItemButton
|
|
227
|
-
onClick={() => setScroll(!scroll)}
|
|
228
|
-
color='secondary'
|
|
229
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
230
|
-
>
|
|
231
|
-
{scroll ? 'Make unscrollable' : 'Make scrollable'}
|
|
232
|
-
</ListItemButton>
|
|
233
|
-
</List>
|
|
234
|
-
|
|
235
|
-
<div>
|
|
236
|
-
<m.div
|
|
237
|
-
animate={{ height: scroll ? 2000 : 1 }}
|
|
238
|
-
initial={false}
|
|
239
|
-
transition={{ type: 'tween' }}
|
|
240
|
-
style={{ width: '20px', background: '#dedede' }}
|
|
241
|
-
/>
|
|
242
|
-
</div>
|
|
243
|
-
</Container>
|
|
244
|
-
</>
|
|
245
|
-
)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function MinimalPageShellDemo() {
|
|
249
|
-
return <LayoutDemo baseUrl='/test/minimal-page-shell' />
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
const pageOptions: PageOptions<LayoutMinimalProps> = {
|
|
253
|
-
Layout: LayoutMinimal,
|
|
254
|
-
}
|
|
255
|
-
MinimalPageShellDemo.pageOptions = pageOptions
|
|
256
|
-
|
|
257
|
-
export default MinimalPageShellDemo
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { NumberFieldElement, useForm } from '@graphcommerce/ecommerce-ui'
|
|
2
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
3
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
4
|
-
import type { GetStaticProps, TextInputNumberProps } from '@graphcommerce/next-ui'
|
|
5
|
-
import { LayoutHeader, LayoutTitle, responsiveVal, TextInputNumber } from '@graphcommerce/next-ui'
|
|
6
|
-
import { Box, Container, Divider, styled, Typography } from '@mui/material'
|
|
7
|
-
import React from 'react'
|
|
8
|
-
import type { LayoutMinimalProps } from '../../components'
|
|
9
|
-
import { LayoutMinimal } from '../../components'
|
|
10
|
-
import { graphqlSharedClient } from '../../lib/graphql/graphqlSsrClient'
|
|
11
|
-
|
|
12
|
-
const variants = ['outlined', 'standard'] as const
|
|
13
|
-
const sizes = ['small', 'medium'] as const
|
|
14
|
-
const colors = [undefined, 'primary', 'secondary', 'error'] as const
|
|
15
|
-
|
|
16
|
-
const Grid = styled('div')(() => ({
|
|
17
|
-
marginTop: `${5 * 8}px`,
|
|
18
|
-
marginBottom: `${5 * 8}px`,
|
|
19
|
-
display: 'grid',
|
|
20
|
-
gridTemplateColumns: 'repeat(4, minmax(180px, 1fr))',
|
|
21
|
-
gap: responsiveVal(20, 40),
|
|
22
|
-
}))
|
|
23
|
-
|
|
24
|
-
export default function NumberInputsPage(props: TextInputNumberProps) {
|
|
25
|
-
const { control } = useForm()
|
|
26
|
-
return (
|
|
27
|
-
<>
|
|
28
|
-
<LayoutHeader />
|
|
29
|
-
<Container>
|
|
30
|
-
<LayoutTitle variant='h1'>NumberFieldElement inputs</LayoutTitle>
|
|
31
|
-
{variants.map((variant) => (
|
|
32
|
-
<React.Fragment key={variant}>
|
|
33
|
-
<Grid>
|
|
34
|
-
{colors.map((color) => (
|
|
35
|
-
<Box>
|
|
36
|
-
<Box
|
|
37
|
-
sx={{
|
|
38
|
-
backgroundColor: `${color}.main`,
|
|
39
|
-
width: '1em',
|
|
40
|
-
height: '1em',
|
|
41
|
-
display: 'inline-block',
|
|
42
|
-
}}
|
|
43
|
-
/>
|
|
44
|
-
<p />
|
|
45
|
-
<Typography
|
|
46
|
-
key={color}
|
|
47
|
-
variant='h6'
|
|
48
|
-
sx={{
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
columnGap: 1,
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
Input {variant} {color}
|
|
54
|
-
</Typography>
|
|
55
|
-
</Box>
|
|
56
|
-
))}
|
|
57
|
-
|
|
58
|
-
{sizes.map((size) => (
|
|
59
|
-
<React.Fragment key={size}>
|
|
60
|
-
{colors.map((color) => (
|
|
61
|
-
<div key={color}>
|
|
62
|
-
<NumberFieldElement
|
|
63
|
-
variant={variant}
|
|
64
|
-
size={size}
|
|
65
|
-
color={color}
|
|
66
|
-
{...props}
|
|
67
|
-
inputProps={{ min: 1 }}
|
|
68
|
-
defaultValue={1}
|
|
69
|
-
control={control}
|
|
70
|
-
InputProps={{ disableUnderline: true }}
|
|
71
|
-
name='test'
|
|
72
|
-
sx={{
|
|
73
|
-
marginBottom: '10px',
|
|
74
|
-
}}
|
|
75
|
-
/>
|
|
76
|
-
</div>
|
|
77
|
-
))}
|
|
78
|
-
</React.Fragment>
|
|
79
|
-
))}
|
|
80
|
-
</Grid>
|
|
81
|
-
<Divider />
|
|
82
|
-
</React.Fragment>
|
|
83
|
-
))}
|
|
84
|
-
</Container>
|
|
85
|
-
</>
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const pageOptions: PageOptions<LayoutMinimalProps> = {
|
|
90
|
-
Layout: LayoutMinimal,
|
|
91
|
-
layoutProps: {},
|
|
92
|
-
}
|
|
93
|
-
NumberInputsPage.pageOptions = pageOptions
|
|
94
|
-
|
|
95
|
-
type GetPageStaticProps = GetStaticProps<LayoutMinimalProps>
|
|
96
|
-
|
|
97
|
-
export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
98
|
-
const client = graphqlSharedClient(context)
|
|
99
|
-
const conf = client.query({ query: StoreConfigDocument })
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
props: {
|
|
103
|
-
apolloState: await conf.then(() => client.cache.extract()),
|
|
104
|
-
},
|
|
105
|
-
}
|
|
106
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { FormAutoSubmit, useForm } from '@graphcommerce/ecommerce-ui'
|
|
2
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
3
|
-
import { LayoutOverlayHeader, LayoutTitle, responsiveVal } from '@graphcommerce/next-ui'
|
|
4
|
-
import type { LayoutOverlayState } from '@graphcommerce/next-ui/LayoutOverlay/test/LayoutOverlayDemo'
|
|
5
|
-
import {
|
|
6
|
-
LayoutOverlayDemo,
|
|
7
|
-
useLayoutState,
|
|
8
|
-
} from '@graphcommerce/next-ui/LayoutOverlay/test/LayoutOverlayDemo'
|
|
9
|
-
import { capitalize, Container, Hidden, ListItemButton, Typography } from '@mui/material'
|
|
10
|
-
import { m } from 'framer-motion'
|
|
11
|
-
import { useState } from 'react'
|
|
12
|
-
|
|
13
|
-
type Size = 'Sm' | 'Md'
|
|
14
|
-
|
|
15
|
-
const sizes: Size[] = ['Sm', 'Md']
|
|
16
|
-
|
|
17
|
-
function SheetDemo() {
|
|
18
|
-
const [layout, setLayout] = useLayoutState()
|
|
19
|
-
|
|
20
|
-
const form = useForm<LayoutOverlayState>({ defaultValues: layout, mode: 'onChange' })
|
|
21
|
-
const { register } = form
|
|
22
|
-
const [scroll, setScroll] = useState<boolean>(false)
|
|
23
|
-
|
|
24
|
-
const { variantMd, variantSm, justifyMd, justifySm, sizeMd, sizeSm } = layout
|
|
25
|
-
|
|
26
|
-
const submit = form.handleSubmit(setLayout)
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
<FormAutoSubmit control={form.control} submit={submit} wait={0} />
|
|
31
|
-
<LayoutOverlayHeader>
|
|
32
|
-
<LayoutTitle size='small'>
|
|
33
|
-
<Hidden mdDown>
|
|
34
|
-
Overlay Md {variantMd} {justifyMd} {sizeMd}
|
|
35
|
-
</Hidden>
|
|
36
|
-
<Hidden smUp>
|
|
37
|
-
Overlay Sm {variantSm} {justifySm} {sizeSm}
|
|
38
|
-
</Hidden>
|
|
39
|
-
</LayoutTitle>
|
|
40
|
-
</LayoutOverlayHeader>
|
|
41
|
-
|
|
42
|
-
<LayoutTitle>
|
|
43
|
-
<Hidden mdDown>
|
|
44
|
-
Overlay Md {variantMd} {justifyMd} {sizeMd}
|
|
45
|
-
</Hidden>
|
|
46
|
-
<Hidden smUp>
|
|
47
|
-
Overlay Sm {variantSm} {justifySm} {sizeSm}
|
|
48
|
-
</Hidden>
|
|
49
|
-
</LayoutTitle>
|
|
50
|
-
<Container maxWidth={false} sx={{ minWidth: responsiveVal(250, 500) }}>
|
|
51
|
-
<form style={{ paddingTop: '100px' }} onSubmit={submit}>
|
|
52
|
-
{sizes.map((size) => (
|
|
53
|
-
<div key={size}>
|
|
54
|
-
<Typography variant='subtitle1'>{size}</Typography>
|
|
55
|
-
|
|
56
|
-
<input type='text' value='should be selectable' readOnly />
|
|
57
|
-
|
|
58
|
-
<div>
|
|
59
|
-
Variant:
|
|
60
|
-
{(['left', 'bottom', 'right'] as const).map((value) => {
|
|
61
|
-
const name: `variant${Size}` = `variant${size}`
|
|
62
|
-
const id = `${name}-${value}`
|
|
63
|
-
return (
|
|
64
|
-
<label key={id} htmlFor={id}>
|
|
65
|
-
<input {...register(name)} id={id} type='radio' value={value} />
|
|
66
|
-
{capitalize(value)}
|
|
67
|
-
</label>
|
|
68
|
-
)
|
|
69
|
-
})}
|
|
70
|
-
</div>
|
|
71
|
-
|
|
72
|
-
<div>
|
|
73
|
-
Size:
|
|
74
|
-
{(['floating', 'minimal', 'full'] as const).map((value) => {
|
|
75
|
-
const name: `size${Size}` = `size${size}`
|
|
76
|
-
const id = `${name}-${value}`
|
|
77
|
-
return (
|
|
78
|
-
<label key={id} htmlFor={id}>
|
|
79
|
-
<input {...register(name)} id={id} type='radio' value={value} />
|
|
80
|
-
{capitalize(value)}
|
|
81
|
-
</label>
|
|
82
|
-
)
|
|
83
|
-
})}
|
|
84
|
-
</div>
|
|
85
|
-
|
|
86
|
-
<div>
|
|
87
|
-
Justify:
|
|
88
|
-
{(['start', 'end', 'center', 'stretch'] as const).map((value) => {
|
|
89
|
-
const name: `justify${Size}` = `justify${size}`
|
|
90
|
-
const id = `${name}-${value}`
|
|
91
|
-
return (
|
|
92
|
-
<label key={id} htmlFor={id}>
|
|
93
|
-
<input {...register(name)} id={id} type='radio' value={value} />
|
|
94
|
-
{capitalize(value)}
|
|
95
|
-
</label>
|
|
96
|
-
)
|
|
97
|
-
})}
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
))}
|
|
101
|
-
</form>
|
|
102
|
-
|
|
103
|
-
<ListItemButton
|
|
104
|
-
onClick={() => setScroll(!scroll)}
|
|
105
|
-
color='secondary'
|
|
106
|
-
style={{ paddingLeft: 0, paddingRight: 0 }}
|
|
107
|
-
>
|
|
108
|
-
{scroll ? 'Make unscrollable' : 'Make scrollable'}
|
|
109
|
-
</ListItemButton>
|
|
110
|
-
<div>
|
|
111
|
-
<m.div
|
|
112
|
-
animate={{ height: scroll ? 2000 : 1 }}
|
|
113
|
-
initial={false}
|
|
114
|
-
transition={{ type: 'tween' }}
|
|
115
|
-
style={{ width: '20px', background: '#dedede' }}
|
|
116
|
-
/>
|
|
117
|
-
</div>
|
|
118
|
-
</Container>
|
|
119
|
-
</>
|
|
120
|
-
)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const pageOptions: PageOptions = {
|
|
124
|
-
overlayGroup: 'test',
|
|
125
|
-
Layout: LayoutOverlayDemo,
|
|
126
|
-
}
|
|
127
|
-
SheetDemo.pageOptions = pageOptions
|
|
128
|
-
export default SheetDemo
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import type { ProductListQuery } from '@graphcommerce/magento-product'
|
|
3
|
-
import { ProductListDocument } from '@graphcommerce/magento-product'
|
|
4
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
5
|
-
import type { GetStaticProps } from '@graphcommerce/next-ui'
|
|
6
|
-
import { LayoutHeader, LayoutTitle, SidebarGallery } from '@graphcommerce/next-ui'
|
|
7
|
-
import { i18n } from '@lingui/core'
|
|
8
|
-
import type { LayoutNavigationProps } from '../../components'
|
|
9
|
-
import { LayoutNavigation } from '../../components'
|
|
10
|
-
import { graphqlSharedClient, graphqlSsrClient } from '../../lib/graphql/graphqlSsrClient'
|
|
11
|
-
|
|
12
|
-
type Props = ProductListQuery
|
|
13
|
-
type GetPageStaticProps = GetStaticProps<LayoutNavigationProps, Props>
|
|
14
|
-
|
|
15
|
-
function TestSlider({ products }: Props) {
|
|
16
|
-
if (!products?.items?.length) return null
|
|
17
|
-
return (
|
|
18
|
-
<>
|
|
19
|
-
<LayoutHeader>
|
|
20
|
-
<LayoutTitle size='small' component='span'>
|
|
21
|
-
Product title
|
|
22
|
-
</LayoutTitle>
|
|
23
|
-
</LayoutHeader>
|
|
24
|
-
|
|
25
|
-
<SidebarGallery
|
|
26
|
-
sidebar={
|
|
27
|
-
<>
|
|
28
|
-
<LayoutTitle variant='h2' gutterTop={false}>
|
|
29
|
-
Product Title
|
|
30
|
-
</LayoutTitle>
|
|
31
|
-
<ul>
|
|
32
|
-
<li>Some product details</li>
|
|
33
|
-
<li>Or other information</li>
|
|
34
|
-
<li>Can be displayed here</li>
|
|
35
|
-
</ul>
|
|
36
|
-
</>
|
|
37
|
-
}
|
|
38
|
-
images={
|
|
39
|
-
products?.items?.map((item) => ({
|
|
40
|
-
src: item?.small_image?.url ?? '',
|
|
41
|
-
width: 1532,
|
|
42
|
-
height: 1678,
|
|
43
|
-
})) ?? []
|
|
44
|
-
}
|
|
45
|
-
/>
|
|
46
|
-
|
|
47
|
-
<br />
|
|
48
|
-
<br />
|
|
49
|
-
<br />
|
|
50
|
-
<br />
|
|
51
|
-
<br />
|
|
52
|
-
<br />
|
|
53
|
-
<br />
|
|
54
|
-
<br />
|
|
55
|
-
<br />
|
|
56
|
-
<br />
|
|
57
|
-
<br />
|
|
58
|
-
<br />
|
|
59
|
-
<br />
|
|
60
|
-
<br />
|
|
61
|
-
<br />
|
|
62
|
-
<br />
|
|
63
|
-
<br />
|
|
64
|
-
|
|
65
|
-
{/* <Container>
|
|
66
|
-
<m.div layout>
|
|
67
|
-
<Typography variant='h2' style={{ textAlign: 'center' }}>
|
|
68
|
-
Multi item slider
|
|
69
|
-
</Typography>
|
|
70
|
-
</m.div>
|
|
71
|
-
<Multi />
|
|
72
|
-
|
|
73
|
-
<m.div layout>
|
|
74
|
-
<Typography variant='h2' style={{ textAlign: 'center' }}>
|
|
75
|
-
Single item Slider
|
|
76
|
-
</Typography>
|
|
77
|
-
</m.div>
|
|
78
|
-
<Single />
|
|
79
|
-
</Container> */}
|
|
80
|
-
</>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
TestSlider.pageOptions = {
|
|
85
|
-
Layout: LayoutNavigation,
|
|
86
|
-
} as PageOptions
|
|
87
|
-
export default TestSlider
|
|
88
|
-
|
|
89
|
-
export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
90
|
-
const client = graphqlSharedClient(context)
|
|
91
|
-
const staticClient = graphqlSsrClient(context)
|
|
92
|
-
|
|
93
|
-
const conf = client.query({ query: StoreConfigDocument })
|
|
94
|
-
|
|
95
|
-
// todo(paales): Remove when https://github.com/Urigo/graphql-mesh/issues/1257 is resolved
|
|
96
|
-
const productList = staticClient.query({
|
|
97
|
-
query: ProductListDocument,
|
|
98
|
-
variables: { onlyItems: true, pageSize: 8, filters: { category_uid: { eq: 'MTAy' } } },
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
props: {
|
|
103
|
-
...(await productList).data,
|
|
104
|
-
up: { href: '/', title: i18n._(/* i18n */ 'Home') },
|
|
105
|
-
apolloState: await conf.then(() => client.cache.extract()),
|
|
106
|
-
},
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { cacheFirst } from '@graphcommerce/graphql'
|
|
3
|
-
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
4
|
-
import { LayoutHeader, LayoutTitle } from '@graphcommerce/next-ui'
|
|
5
|
-
import type { GetStaticProps } from '@graphcommerce/next-ui/Page/types'
|
|
6
|
-
import { i18n } from '@lingui/core'
|
|
7
|
-
import { Container, Typography } from '@mui/material'
|
|
8
|
-
import { useEffect, useRef, useState } from 'react'
|
|
9
|
-
import type { LayoutMinimalProps } from '../../components'
|
|
10
|
-
import { LayoutDocument, LayoutMinimal } from '../../components'
|
|
11
|
-
import { graphqlSharedClient, graphqlSsrClient } from '../../lib/graphql/graphqlSsrClient'
|
|
12
|
-
|
|
13
|
-
type Props = Record<string, unknown>
|
|
14
|
-
type GetPageStaticProps = GetStaticProps<LayoutMinimalProps, Props>
|
|
15
|
-
|
|
16
|
-
function useRenderedSize() {
|
|
17
|
-
const [size, setSize] = useState<string>()
|
|
18
|
-
const ref = useRef<HTMLElement>(null)
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!ref.current?.parentElement) return () => {}
|
|
22
|
-
const ro = new ResizeObserver(([entry]) => {
|
|
23
|
-
setSize(getComputedStyle(entry.target).fontSize)
|
|
24
|
-
})
|
|
25
|
-
ro.observe(ref.current.parentElement)
|
|
26
|
-
return () => ro.disconnect()
|
|
27
|
-
}, [])
|
|
28
|
-
|
|
29
|
-
return <span ref={ref}>{size}</span>
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function TypographyOverview() {
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
<LayoutHeader>
|
|
36
|
-
<LayoutTitle size='small'>Typography</LayoutTitle>
|
|
37
|
-
</LayoutHeader>
|
|
38
|
-
|
|
39
|
-
<LayoutTitle>Typography</LayoutTitle>
|
|
40
|
-
|
|
41
|
-
<Container>
|
|
42
|
-
<Typography variant='h1' display='block' gutterBottom>
|
|
43
|
-
Headline 1 {useRenderedSize()}
|
|
44
|
-
</Typography>
|
|
45
|
-
|
|
46
|
-
<Typography variant='h2' display='block' gutterBottom>
|
|
47
|
-
Headline 2 {useRenderedSize()}
|
|
48
|
-
</Typography>
|
|
49
|
-
|
|
50
|
-
<Typography variant='h3' display='block' gutterBottom>
|
|
51
|
-
Headline 3 {useRenderedSize()}
|
|
52
|
-
</Typography>
|
|
53
|
-
|
|
54
|
-
<Typography variant='h4' display='block' paragraph gutterBottom>
|
|
55
|
-
Headline 4 — Maecenas efficitur velit a metus.
|
|
56
|
-
{useRenderedSize()}
|
|
57
|
-
</Typography>
|
|
58
|
-
|
|
59
|
-
<Typography variant='h5' display='block' gutterBottom>
|
|
60
|
-
Headline 5 — Morbi posuere nunc diam {useRenderedSize()}
|
|
61
|
-
</Typography>
|
|
62
|
-
|
|
63
|
-
<Typography variant='h6' display='block' gutterBottom>
|
|
64
|
-
Headline 6 — Ut luctus mi ante {useRenderedSize()}
|
|
65
|
-
</Typography>
|
|
66
|
-
|
|
67
|
-
<Typography variant='subtitle1' display='block' paragraph gutterBottom>
|
|
68
|
-
Subtitle 1 — In dictum velit quis lorem dignissim volutpat. {useRenderedSize()}
|
|
69
|
-
</Typography>
|
|
70
|
-
|
|
71
|
-
<Typography variant='body1' display='block' paragraph gutterBottom>
|
|
72
|
-
Body1 — Maecenas efficitur velit a metus feugiat egestas. Donec sit amet maximus sapien,
|
|
73
|
-
in malesuada mi. Duis eget finibus urna, vitae suscipit felis. Duis aliquet tortor a
|
|
74
|
-
turpis euismod gravida. Nunc eu hendrerit leo. Integer dapibus dapibus augue, sit amet
|
|
75
|
-
semper lacus. Sed sed enim et quam tincidunt sollicitudin. Curabitur eget dignissim lorem.
|
|
76
|
-
Interdum et malesuada fames ac ante ipsum primis in faucibus. Integer maximus ex at
|
|
77
|
-
placerat egestas. Vivamus vehicula nisl urna, nec congue nisl ultricies nec.{' '}
|
|
78
|
-
{useRenderedSize()}
|
|
79
|
-
</Typography>
|
|
80
|
-
|
|
81
|
-
<Typography variant='subtitle2' display='block' gutterBottom>
|
|
82
|
-
Subtitle 2 — Nunc eu hendrerit leo {useRenderedSize()}
|
|
83
|
-
</Typography>
|
|
84
|
-
|
|
85
|
-
<Typography variant='body2' display='block' paragraph gutterBottom>
|
|
86
|
-
Body2 — Suspendisse nec consectetur massa. Proin mollis ante lorem, a lacinia orci
|
|
87
|
-
pellentesque ut. Donec porta fringilla commodo. In hac habitasse platea dictumst. Donec
|
|
88
|
-
quis elementum mauris. Cras rutrum lectus et magna convallis, vitae dignissim elit
|
|
89
|
-
euismod. Aliquam leo felis, viverra eget auctor sed, dictum vitae metus. Nullam tincidunt
|
|
90
|
-
ultricies convallis. Donec pretium, dolor sed dapibus gravida, magna metus posuere sem,
|
|
91
|
-
nec tincidunt erat eros vel erat. Ut eu quam sit amet magna condimentum aliquet. Nulla
|
|
92
|
-
facilisis est nec quam mollis porta. Nullam mattis pulvinar purus eu gravida. Nullam
|
|
93
|
-
interdum malesuada sodales. Maecenas aliquam pulvinar libero non consectetur.{' '}
|
|
94
|
-
{useRenderedSize()}
|
|
95
|
-
</Typography>
|
|
96
|
-
|
|
97
|
-
<Typography variant='button' display='block' gutterBottom>
|
|
98
|
-
Button: Sed laoreet {useRenderedSize()}
|
|
99
|
-
</Typography>
|
|
100
|
-
|
|
101
|
-
<Typography variant='caption' display='block' gutterBottom>
|
|
102
|
-
Caption: vitae enim quis cursus. {useRenderedSize()}
|
|
103
|
-
</Typography>
|
|
104
|
-
|
|
105
|
-
<Typography variant='overline' display='block' gutterBottom>
|
|
106
|
-
Overline: Nunc scelerisque at massa nec imperdiet {useRenderedSize()}
|
|
107
|
-
</Typography>
|
|
108
|
-
</Container>
|
|
109
|
-
</>
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
TypographyOverview.pageOptions = {
|
|
114
|
-
Layout: LayoutMinimal,
|
|
115
|
-
} as PageOptions
|
|
116
|
-
|
|
117
|
-
export default TypographyOverview
|
|
118
|
-
|
|
119
|
-
export const getStaticProps: GetPageStaticProps = async (context) => {
|
|
120
|
-
const client = graphqlSharedClient(context)
|
|
121
|
-
const staticClient = graphqlSsrClient(context)
|
|
122
|
-
|
|
123
|
-
const conf = client.query({ query: StoreConfigDocument })
|
|
124
|
-
const layout = staticClient.query({
|
|
125
|
-
query: LayoutDocument,
|
|
126
|
-
fetchPolicy: cacheFirst(staticClient),
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
props: {
|
|
131
|
-
...(await layout).data,
|
|
132
|
-
up: { href: '/', title: i18n._(/* i18n */ 'Home') },
|
|
133
|
-
apolloState: await conf.then(() => client.cache.extract()),
|
|
134
|
-
},
|
|
135
|
-
}
|
|
136
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { PageOptions } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { useHistoryLink } from '@graphcommerce/framer-next-pages'
|
|
3
|
-
import { Link } from '@mui/material'
|
|
4
|
-
import type { LayoutMinimalProps } from '../../../components'
|
|
5
|
-
import { LayoutMinimal } from '../../../components'
|
|
6
|
-
|
|
7
|
-
function BackLinkDemo() {
|
|
8
|
-
const { href, onClick } = useHistoryLink({ href: '/test/usebacklink/cart' })
|
|
9
|
-
const { href: hrefb, onClick: onClickB } = useHistoryLink({ href: '/test/usebacklink/shipping' })
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<>
|
|
13
|
-
<div>
|
|
14
|
-
<Link href={href} onClick={onClick} color='primary' underline='hover'>
|
|
15
|
-
Cart
|
|
16
|
-
</Link>
|
|
17
|
-
</div>
|
|
18
|
-
<div>
|
|
19
|
-
<Link href={hrefb} color='primary' onClick={onClickB} underline='hover'>
|
|
20
|
-
Shipping
|
|
21
|
-
</Link>
|
|
22
|
-
</div>
|
|
23
|
-
</>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const pageOptions: PageOptions<LayoutMinimalProps> = {
|
|
28
|
-
Layout: LayoutMinimal,
|
|
29
|
-
}
|
|
30
|
-
BackLinkDemo.pageOptions = pageOptions
|
|
31
|
-
|
|
32
|
-
export default BackLinkDemo
|