@graphcommerce/next-ui 3.25.3 → 4.1.0
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/AnimatedRow/index.tsx +6 -3
- package/ApolloError/ApolloErrorAlert.tsx +20 -21
- package/ApolloError/ApolloErrorFullPage.tsx +3 -4
- package/ApolloError/ApolloErrorSnackbar.tsx +3 -3
- package/Blog/BlogAuthor/index.tsx +42 -48
- package/Blog/BlogContent/index.tsx +6 -23
- package/Blog/BlogHeader/index.tsx +26 -23
- package/Blog/BlogList/index.tsx +7 -25
- package/Blog/BlogListItem/index.tsx +63 -52
- package/Blog/BlogTags/BlogTag.tsx +27 -0
- package/Blog/BlogTags/index.tsx +7 -32
- package/Blog/BlogTitle/index.tsx +7 -21
- package/Button/Button.tsx +5 -0
- package/Button/LinkOrButton.tsx +80 -0
- package/Button/index.tsx +2 -177
- package/CHANGELOG.md +524 -645
- package/ChipMenu/index.tsx +71 -77
- package/ContainerWithHeader/index.tsx +33 -30
- package/FlagAvatar/index.tsx +2 -12
- package/Footer/Footer.tsx +105 -88
- package/Footer/index.ts +0 -1
- package/Form/Form.tsx +35 -0
- package/Form/FormActions.tsx +9 -14
- package/Form/FormDivider.tsx +8 -13
- package/Form/FormHeader.tsx +5 -26
- package/Form/FormRow.tsx +8 -13
- package/Form/InputCheckmark.tsx +9 -22
- package/FramerScroller/SidebarGallery.tsx +340 -0
- package/FramerScroller/SidebarSlider.tsx +107 -0
- package/FramerScroller/index.ts +2 -0
- package/FullPageMessage/index.tsx +52 -48
- package/Highlight/index.tsx +1 -1
- package/IconHeader/index.tsx +63 -58
- package/JsonLd/index.tsx +3 -2
- package/Layout/components/LayoutHeader.tsx +75 -82
- package/Layout/components/LayoutHeaderBack.tsx +26 -18
- package/Layout/components/LayoutHeaderClose.tsx +9 -22
- package/Layout/components/LayoutHeaderContent.tsx +190 -154
- package/Layout/components/LayoutHeadertypes.ts +1 -1
- package/Layout/components/LayoutTitle.tsx +60 -55
- package/LayoutDefault/components/LayoutDefault.tsx +96 -85
- package/LayoutOverlay/components/LayoutOverlay.tsx +2 -8
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +233 -239
- package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
- package/LayoutParts/DesktopHeaderBadge.tsx +28 -0
- package/LayoutParts/DesktopNavActions.tsx +15 -0
- package/LayoutParts/DesktopNavBar.tsx +113 -0
- package/LayoutParts/DesktopNavBarItem.tsx +44 -0
- package/{AppShell → LayoutParts}/GlobalHead.tsx +1 -2
- package/LayoutParts/Logo.tsx +77 -0
- package/LayoutParts/MenuFab.tsx +132 -0
- package/LayoutParts/MenuFabItem.tsx +25 -0
- package/LayoutParts/MenuFabSecondaryItem.tsx +37 -0
- package/{AppShell/PlaceholderFab/index.tsx → LayoutParts/PlaceholderFab.tsx} +1 -1
- package/LayoutParts/StickyBelowHeader.tsx +25 -0
- package/LayoutParts/index.ts +12 -0
- package/{AppShell → LayoutParts}/useFabAnimation.ts +0 -0
- package/Page/CssAndFramerMotionProvider.tsx +21 -0
- package/Page/index.ts +2 -0
- package/Page/types.ts +2 -8
- package/PageLoadIndicator/index.tsx +25 -30
- package/PageMeta/index.tsx +1 -1
- package/Pagination/index.tsx +37 -54
- package/RenderType/index.tsx +1 -1
- package/Row/ButtonLinkList/ButtonLinkList.tsx +35 -37
- package/Row/ButtonLinkList/ButtonLinkListItem.tsx +16 -33
- package/Row/ColumnOne/index.tsx +5 -10
- package/Row/ColumnOneBoxed/index.tsx +18 -19
- package/Row/ColumnOneCentered/index.tsx +3 -4
- package/Row/ColumnThree/index.tsx +62 -57
- package/Row/ColumnTwo/index.tsx +37 -32
- package/Row/ColumnTwoSpread/index.tsx +28 -37
- package/Row/ColumnTwoWithTop/index.tsx +37 -43
- package/Row/ContentLinks/index.tsx +24 -25
- package/Row/HeroBanner/index.tsx +98 -82
- package/Row/IconBlocks/IconBlock/index.tsx +45 -37
- package/Row/IconBlocks/index.tsx +29 -44
- package/Row/ImageText/index.tsx +71 -67
- package/Row/ImageTextBoxed/index.tsx +66 -65
- package/Row/ParagraphWithSidebarSlide/index.tsx +80 -76
- package/Row/Quote/index.tsx +3 -3
- package/Row/SpecialBanner/index.tsx +97 -97
- package/Row/index.tsx +4 -9
- package/SectionContainer/index.tsx +32 -31
- package/SectionHeader/index.tsx +41 -43
- package/Separator/index.tsx +19 -18
- package/Snackbar/MessageSnackbar.tsx +1 -2
- package/Snackbar/MessageSnackbarImpl.tsx +68 -115
- package/StarRatingField/index.tsx +24 -25
- package/Stepper/Stepper.tsx +34 -32
- package/Styles/EmotionProvider.tsx +14 -0
- package/Styles/breakpointVal.tsx +16 -10
- package/Styles/extendableComponent.ts +70 -0
- package/Styles/index.tsx +9 -2
- package/Styles/withEmotionCache.tsx +36 -0
- package/Styles/withTheme.tsx +15 -24
- package/SvgIcon/SvgIcon.tsx +60 -0
- package/TextInputNumber/index.tsx +49 -50
- package/Theme/DarkLightModeThemeProvider.tsx +119 -0
- package/Theme/MuiButton.ts +128 -0
- package/Theme/MuiSlider.ts +28 -0
- package/Theme/MuiSnackbar.ts +31 -0
- package/Theme/{types.ts → createTheme.ts} +8 -2
- package/Theme/index.ts +5 -0
- package/Theme/themeDefaults.ts +51 -0
- package/TimeAgo/index.tsx +1 -1
- package/ToggleButton/index.tsx +43 -49
- package/ToggleButtonGroup/index.tsx +39 -39
- package/UspList/UspListItem.tsx +56 -46
- package/UspList/index.tsx +29 -26
- package/docs/building-components.mdx +3 -0
- package/docs/components/ComponentBasic.tsx +26 -0
- package/docs/components/ComponentChild.tsx +48 -0
- package/docs/components/ComponentChildVariant.tsx +54 -0
- package/docs/components/ComponentChildVariantExtendable.tsx +62 -0
- package/docs/components/ComponentStylable.tsx +32 -0
- package/docs/pages/building-components.tsx +62 -0
- package/icons/index.tsx +2 -0
- package/index.ts +27 -81
- package/package.json +27 -27
- package/types.d.ts +1 -1
- package/AppShell/AppShellSticky/index.tsx +0 -38
- package/AppShell/DesktopNavActions.tsx +0 -32
- package/AppShell/DesktopNavBar.tsx +0 -158
- package/AppShell/Logo.tsx +0 -46
- package/AppShell/Menu.tsx +0 -7
- package/AppShell/MenuFab.tsx +0 -162
- package/AppShell/MenuFabSecondaryItem.tsx +0 -32
- package/AppShell/index.ts +0 -15
- package/AspectRatioContainer/index.tsx +0 -27
- package/Footer/SocialIcon.tsx +0 -23
- package/Form/index.tsx +0 -67
- package/FramerScroller/components/SidebarGallery.tsx +0 -317
- package/FramerScroller/components/SidebarSlider.tsx +0 -97
- package/Page/App.tsx +0 -17
- package/Page/Document.tsx +0 -24
- package/StyledBadge/index.tsx +0 -20
- package/Styles/classesPicker.ts +0 -41
- package/SvgImage/SvgImageSimple.tsx +0 -100
- package/SvgImage/index.tsx +0 -74
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import { usePrevPageRouter } from '@graphcommerce/framer-next-pages/hooks/usePrevPageRouter'
|
|
2
|
-
import {
|
|
3
|
-
MotionImageAspect,
|
|
4
|
-
MotionImageAspectProps,
|
|
5
|
-
Scroller,
|
|
6
|
-
ScrollerButton,
|
|
7
|
-
ScrollerDots,
|
|
8
|
-
ScrollerProvider,
|
|
9
|
-
} from '@graphcommerce/framer-scroller'
|
|
10
|
-
import { clientSize, useMotionValueValue } from '@graphcommerce/framer-utils'
|
|
11
|
-
import { Fab, makeStyles, Theme, useTheme, alpha } from '@material-ui/core'
|
|
12
|
-
import { m, useDomEvent, useMotionValue } from 'framer-motion'
|
|
13
|
-
import { useRouter } from 'next/router'
|
|
14
|
-
import React, { useEffect, useRef } from 'react'
|
|
15
|
-
import Row from '../../Row'
|
|
16
|
-
import { UseStyles } from '../../Styles'
|
|
17
|
-
import { classesPicker } from '../../Styles/classesPicker'
|
|
18
|
-
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
19
|
-
import SvgImageSimple from '../../SvgImage/SvgImageSimple'
|
|
20
|
-
import { iconChevronLeft, iconChevronRight, iconFullscreen, iconFullscreenExit } from '../../icons'
|
|
21
|
-
|
|
22
|
-
type StyleProps = {
|
|
23
|
-
aspectRatio: [number, number]
|
|
24
|
-
clientHeight: number
|
|
25
|
-
classes?: Record<string, unknown>
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const useStyles = makeStyles(
|
|
29
|
-
(theme: Theme) => ({
|
|
30
|
-
root: {
|
|
31
|
-
willChange: 'transform',
|
|
32
|
-
display: 'grid',
|
|
33
|
-
[theme.breakpoints.up('md')]: {
|
|
34
|
-
gridTemplateColumns: '1fr auto',
|
|
35
|
-
},
|
|
36
|
-
background:
|
|
37
|
-
theme.palette.type === 'light'
|
|
38
|
-
? theme.palette.background.image
|
|
39
|
-
: theme.palette.background.paper,
|
|
40
|
-
paddingRight: `calc((100% - ${theme.breakpoints.values.lg}px) / 2)`,
|
|
41
|
-
},
|
|
42
|
-
rootZoomed: {
|
|
43
|
-
position: 'relative',
|
|
44
|
-
zIndex: theme.zIndex.modal,
|
|
45
|
-
marginTop: `calc(${theme.appShell.headerHeightSm} * -1)`,
|
|
46
|
-
[theme.breakpoints.up('md')]: {
|
|
47
|
-
marginTop: `calc(${theme.appShell.headerHeightMd} * -1 - ${theme.spacings.lg})`,
|
|
48
|
-
},
|
|
49
|
-
paddingRight: 0,
|
|
50
|
-
},
|
|
51
|
-
scrollerContainer: ({ aspectRatio: [width, height] }: StyleProps) => {
|
|
52
|
-
const headerHeight = `${theme.appShell.headerHeightSm} - ${theme.spacings.sm} * 2`
|
|
53
|
-
const galleryMargin = theme.spacings.lg
|
|
54
|
-
const extraSpacing = theme.spacings.md
|
|
55
|
-
|
|
56
|
-
const maxHeight = `calc(100vh - ${headerHeight} - ${galleryMargin} - ${extraSpacing})`
|
|
57
|
-
const ratio = `calc(${height} / ${width} * 100%)`
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
willChange: 'transform',
|
|
61
|
-
height: 0, // https://stackoverflow.com/questions/44770074/css-grid-row-height-safari-bug
|
|
62
|
-
backgroundColor: theme.palette.background.image,
|
|
63
|
-
position: 'relative',
|
|
64
|
-
minHeight: '100%',
|
|
65
|
-
paddingTop: `min(${ratio}, ${maxHeight})`,
|
|
66
|
-
[theme.breakpoints.down('sm')]: {
|
|
67
|
-
width: '100vw',
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
scrollerContainerZoomed: ({ clientHeight }: StyleProps) => ({
|
|
72
|
-
paddingTop: clientHeight,
|
|
73
|
-
}),
|
|
74
|
-
scroller: {
|
|
75
|
-
willChange: 'transform',
|
|
76
|
-
position: 'absolute',
|
|
77
|
-
top: 0,
|
|
78
|
-
width: '100%',
|
|
79
|
-
height: '100%',
|
|
80
|
-
gridAutoColumns: `100%`,
|
|
81
|
-
gridTemplateRows: `100%`,
|
|
82
|
-
cursor: 'zoom-in',
|
|
83
|
-
},
|
|
84
|
-
scrollerZoomed: ({ clientHeight }: StyleProps) => ({
|
|
85
|
-
height: clientHeight,
|
|
86
|
-
cursor: 'inherit',
|
|
87
|
-
}),
|
|
88
|
-
sidebarWrapper: {
|
|
89
|
-
boxSizing: 'content-box',
|
|
90
|
-
display: 'grid',
|
|
91
|
-
justifyItems: 'start',
|
|
92
|
-
alignContent: 'center',
|
|
93
|
-
position: 'relative',
|
|
94
|
-
[theme.breakpoints.up('md')]: {
|
|
95
|
-
width: `calc(${responsiveVal(300, 500, theme.breakpoints.values.lg)} + ${
|
|
96
|
-
theme.page.horizontal
|
|
97
|
-
} * 2)`,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
sidebarWrapperZoomed: {
|
|
101
|
-
[theme.breakpoints.up('md')]: {
|
|
102
|
-
marginLeft: `calc((${responsiveVal(300, 500, theme.breakpoints.values.lg)} + ${
|
|
103
|
-
theme.page.horizontal
|
|
104
|
-
} * 2) * -1)`,
|
|
105
|
-
left: `calc(${responsiveVal(300, 500, theme.breakpoints.values.lg)} + ${
|
|
106
|
-
theme.page.horizontal
|
|
107
|
-
} * 2)`,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
sidebar: {
|
|
111
|
-
boxSizing: 'border-box',
|
|
112
|
-
width: '100%',
|
|
113
|
-
padding: `${theme.spacings.lg} ${theme.page.horizontal}`,
|
|
114
|
-
[theme.breakpoints.up('md')]: {
|
|
115
|
-
paddingLeft: theme.spacings.lg,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
bottomCenter: {
|
|
119
|
-
display: 'grid',
|
|
120
|
-
gridAutoFlow: 'column',
|
|
121
|
-
gap: theme.spacings.xxs,
|
|
122
|
-
position: 'absolute',
|
|
123
|
-
bottom: theme.spacings.xxs,
|
|
124
|
-
justifyContent: 'center',
|
|
125
|
-
width: '100%',
|
|
126
|
-
pointerEvents: 'none',
|
|
127
|
-
'& > *': {
|
|
128
|
-
pointerEvents: 'all',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
sliderButtons: {
|
|
132
|
-
[theme.breakpoints.down('sm')]: {
|
|
133
|
-
display: 'none',
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
toggleIcon: {
|
|
137
|
-
boxShadow: theme.shadows[6],
|
|
138
|
-
},
|
|
139
|
-
topRight: {
|
|
140
|
-
display: 'grid',
|
|
141
|
-
gridAutoFlow: 'column',
|
|
142
|
-
top: theme.spacings.sm,
|
|
143
|
-
gap: theme.spacings.xxs,
|
|
144
|
-
position: 'absolute',
|
|
145
|
-
right: theme.spacings.sm,
|
|
146
|
-
},
|
|
147
|
-
centerLeft: {
|
|
148
|
-
display: 'grid',
|
|
149
|
-
gridAutoFlow: 'row',
|
|
150
|
-
gap: theme.spacings.xxs,
|
|
151
|
-
position: 'absolute',
|
|
152
|
-
left: theme.spacings.sm,
|
|
153
|
-
top: `calc(50% - 28px)`,
|
|
154
|
-
},
|
|
155
|
-
centerRight: {
|
|
156
|
-
display: 'grid',
|
|
157
|
-
gap: theme.spacings.xxs,
|
|
158
|
-
position: 'absolute',
|
|
159
|
-
right: theme.spacings.sm,
|
|
160
|
-
top: `calc(50% - 28px)`,
|
|
161
|
-
},
|
|
162
|
-
dots: {
|
|
163
|
-
background: alpha(theme.palette.background.paper, 1),
|
|
164
|
-
boxShadow: theme.shadows[6],
|
|
165
|
-
},
|
|
166
|
-
}),
|
|
167
|
-
{ name: 'SidebarGallery' },
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
export type SidebarGalleryProps = {
|
|
171
|
-
sidebar: React.ReactNode
|
|
172
|
-
images: MotionImageAspectProps[]
|
|
173
|
-
aspectRatio?: [number, number]
|
|
174
|
-
routeHash?: string
|
|
175
|
-
} & UseStyles<typeof useStyles>
|
|
176
|
-
|
|
177
|
-
export default function SidebarGallery(props: SidebarGalleryProps) {
|
|
178
|
-
const {
|
|
179
|
-
sidebar,
|
|
180
|
-
images,
|
|
181
|
-
aspectRatio = [1, 1],
|
|
182
|
-
routeHash = 'gallery',
|
|
183
|
-
classes: classesBase,
|
|
184
|
-
} = props
|
|
185
|
-
|
|
186
|
-
const router = useRouter()
|
|
187
|
-
const prevRoute = usePrevPageRouter()
|
|
188
|
-
const clientHeight = useMotionValueValue(clientSize.y, (y) => y)
|
|
189
|
-
const classes = useStyles({ clientHeight, aspectRatio, classes: classesBase })
|
|
190
|
-
|
|
191
|
-
const route = `#${routeHash}`
|
|
192
|
-
// We're using the URL to manage the state of the gallery.
|
|
193
|
-
const zoomed = router.asPath.endsWith(route)
|
|
194
|
-
|
|
195
|
-
// cleanup if someone enters the page with #gallery
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
if (!prevRoute?.pathname && zoomed) {
|
|
198
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
199
|
-
router.replace(router.asPath.replace(route, ''))
|
|
200
|
-
}
|
|
201
|
-
}, [prevRoute?.pathname, route, router, zoomed])
|
|
202
|
-
|
|
203
|
-
const toggle = () => {
|
|
204
|
-
if (!zoomed) {
|
|
205
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
206
|
-
router.push(route, undefined, { shallow: true })
|
|
207
|
-
document.body.style.overflow = 'hidden'
|
|
208
|
-
window.scrollTo({ top: 0, behavior: 'smooth' })
|
|
209
|
-
} else {
|
|
210
|
-
router.back()
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const className = classesPicker(classes, { zoomed })
|
|
215
|
-
const theme = useTheme()
|
|
216
|
-
const windowRef = useRef(typeof window !== 'undefined' ? window : null)
|
|
217
|
-
|
|
218
|
-
const handleEscapeKey = (e: KeyboardEvent | Event) => {
|
|
219
|
-
if (zoomed && (e as KeyboardEvent)?.key === 'Escape') toggle()
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const dragStart = useMotionValue<number>(0)
|
|
223
|
-
const onMouseDownScroller: React.MouseEventHandler<HTMLDivElement> = (e) => {
|
|
224
|
-
if (dragStart.get() === e.clientX) return
|
|
225
|
-
dragStart.set(e.clientX)
|
|
226
|
-
}
|
|
227
|
-
const onMouseUpScroller: React.MouseEventHandler<HTMLDivElement> = (e) => {
|
|
228
|
-
const currentDragLoc = e.clientX
|
|
229
|
-
if (Math.abs(currentDragLoc - dragStart.get()) < 8) toggle()
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
useDomEvent(windowRef, 'keyup', handleEscapeKey, { passive: true })
|
|
233
|
-
|
|
234
|
-
return (
|
|
235
|
-
<ScrollerProvider scrollSnapAlign='center'>
|
|
236
|
-
<Row maxWidth={false} disableGutters>
|
|
237
|
-
<m.div layout {...className('root')}>
|
|
238
|
-
<m.div
|
|
239
|
-
layout
|
|
240
|
-
{...className('scrollerContainer')}
|
|
241
|
-
onLayoutAnimationComplete={() => {
|
|
242
|
-
if (!zoomed) document.body.style.overflow = ''
|
|
243
|
-
}}
|
|
244
|
-
>
|
|
245
|
-
<Scroller
|
|
246
|
-
{...className('scroller')}
|
|
247
|
-
hideScrollbar
|
|
248
|
-
onMouseDown={onMouseDownScroller}
|
|
249
|
-
onMouseUp={onMouseUpScroller}
|
|
250
|
-
>
|
|
251
|
-
{images.map((image, idx) => (
|
|
252
|
-
<MotionImageAspect
|
|
253
|
-
key={typeof image.src === 'string' ? image.src : idx}
|
|
254
|
-
layout
|
|
255
|
-
src={image.src}
|
|
256
|
-
width={image.width}
|
|
257
|
-
height={image.height}
|
|
258
|
-
loading={idx === 0 ? 'eager' : 'lazy'}
|
|
259
|
-
sizes={{
|
|
260
|
-
0: '100vw',
|
|
261
|
-
[theme.breakpoints.values.md]: zoomed ? '100vw' : '60vw',
|
|
262
|
-
}}
|
|
263
|
-
alt={image.alt || `Product Image ${idx}` || undefined}
|
|
264
|
-
dontReportWronglySizedImages
|
|
265
|
-
/>
|
|
266
|
-
))}
|
|
267
|
-
</Scroller>
|
|
268
|
-
<m.div layout className={classes.topRight}>
|
|
269
|
-
<Fab
|
|
270
|
-
size='small'
|
|
271
|
-
className={classes.toggleIcon}
|
|
272
|
-
onMouseUp={toggle}
|
|
273
|
-
aria-label='Toggle Fullscreen'
|
|
274
|
-
>
|
|
275
|
-
{!zoomed ? (
|
|
276
|
-
<SvgImageSimple src={iconFullscreen} />
|
|
277
|
-
) : (
|
|
278
|
-
<SvgImageSimple src={iconFullscreenExit} />
|
|
279
|
-
)}
|
|
280
|
-
</Fab>
|
|
281
|
-
</m.div>
|
|
282
|
-
<div className={classes.centerLeft}>
|
|
283
|
-
<ScrollerButton
|
|
284
|
-
layout
|
|
285
|
-
direction='left'
|
|
286
|
-
size='small'
|
|
287
|
-
className={classes.sliderButtons}
|
|
288
|
-
>
|
|
289
|
-
<SvgImageSimple src={iconChevronLeft} />
|
|
290
|
-
</ScrollerButton>
|
|
291
|
-
</div>
|
|
292
|
-
<div className={classes.centerRight}>
|
|
293
|
-
<ScrollerButton
|
|
294
|
-
layout
|
|
295
|
-
direction='right'
|
|
296
|
-
size='small'
|
|
297
|
-
className={classes.sliderButtons}
|
|
298
|
-
>
|
|
299
|
-
<SvgImageSimple src={iconChevronRight} />
|
|
300
|
-
</ScrollerButton>
|
|
301
|
-
</div>
|
|
302
|
-
|
|
303
|
-
<div className={classes.bottomCenter}>
|
|
304
|
-
<ScrollerDots layout classes={{ dots: classes.dots }} />
|
|
305
|
-
</div>
|
|
306
|
-
</m.div>
|
|
307
|
-
|
|
308
|
-
<div {...className('sidebarWrapper')}>
|
|
309
|
-
<m.div layout {...className('sidebar')}>
|
|
310
|
-
{sidebar}
|
|
311
|
-
</m.div>
|
|
312
|
-
</div>
|
|
313
|
-
</m.div>
|
|
314
|
-
</Row>
|
|
315
|
-
</ScrollerProvider>
|
|
316
|
-
)
|
|
317
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Scroller,
|
|
3
|
-
ScrollerButton,
|
|
4
|
-
ScrollerPageCounter,
|
|
5
|
-
ScrollerProvider,
|
|
6
|
-
} from '@graphcommerce/framer-scroller'
|
|
7
|
-
import { Theme, makeStyles } from '@material-ui/core'
|
|
8
|
-
import React, { ReactNode } from 'react'
|
|
9
|
-
import Row from '../../Row'
|
|
10
|
-
import { UseStyles } from '../../Styles'
|
|
11
|
-
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
12
|
-
import SvgImageSimple from '../../SvgImage/SvgImageSimple'
|
|
13
|
-
import { iconChevronLeft, iconChevronRight } from '../../icons'
|
|
14
|
-
|
|
15
|
-
const useStyles = makeStyles(
|
|
16
|
-
(theme: Theme) => ({
|
|
17
|
-
root: {
|
|
18
|
-
display: 'grid',
|
|
19
|
-
gridTemplateColumns: 'minmax(150px, 25%) 1fr',
|
|
20
|
-
maxWidth: '100%',
|
|
21
|
-
},
|
|
22
|
-
sidebar: {
|
|
23
|
-
display: 'grid',
|
|
24
|
-
alignContent: 'space-between',
|
|
25
|
-
padding: `0 ${theme.spacings.lg} 0 ${theme.page.horizontal}`,
|
|
26
|
-
},
|
|
27
|
-
scrollerContainer: {
|
|
28
|
-
position: 'relative',
|
|
29
|
-
minWidth: 1,
|
|
30
|
-
},
|
|
31
|
-
scroller: {
|
|
32
|
-
gridColumnGap: theme.spacings.md,
|
|
33
|
-
gridRowGap: theme.spacings.lg,
|
|
34
|
-
paddingRight: theme.page.horizontal,
|
|
35
|
-
gridAutoColumns: responsiveVal(200, 400),
|
|
36
|
-
},
|
|
37
|
-
sliderButtons: {
|
|
38
|
-
[theme.breakpoints.down('sm')]: {
|
|
39
|
-
display: 'none',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
centerLeft: {
|
|
43
|
-
display: 'grid',
|
|
44
|
-
gridAutoFlow: 'row',
|
|
45
|
-
gap: theme.spacings.xxs,
|
|
46
|
-
position: 'absolute',
|
|
47
|
-
left: theme.spacings.sm,
|
|
48
|
-
top: `calc(50% - 28px)`,
|
|
49
|
-
},
|
|
50
|
-
centerRight: {
|
|
51
|
-
display: 'grid',
|
|
52
|
-
gap: theme.spacings.xxs,
|
|
53
|
-
position: 'absolute',
|
|
54
|
-
right: theme.spacings.sm,
|
|
55
|
-
top: `calc(50% - 28px)`,
|
|
56
|
-
},
|
|
57
|
-
}),
|
|
58
|
-
{ name: 'SidebarSlider' },
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
export type SidebarSliderProps = { children: ReactNode; sidebar: ReactNode } & UseStyles<
|
|
62
|
-
typeof useStyles
|
|
63
|
-
>
|
|
64
|
-
|
|
65
|
-
export default function SidebarSlider(props: SidebarSliderProps) {
|
|
66
|
-
const { children, sidebar } = props
|
|
67
|
-
const classes = useStyles(props)
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<Row maxWidth={false} disableGutters>
|
|
71
|
-
<ScrollerProvider scrollSnapAlign='start'>
|
|
72
|
-
<div className={classes.root}>
|
|
73
|
-
<div className={classes.sidebar}>
|
|
74
|
-
<div>{sidebar}</div>
|
|
75
|
-
<ScrollerPageCounter />
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<div className={classes.scrollerContainer}>
|
|
79
|
-
<Scroller className={classes.scroller} hideScrollbar>
|
|
80
|
-
{children}
|
|
81
|
-
</Scroller>
|
|
82
|
-
<div className={classes.centerLeft}>
|
|
83
|
-
<ScrollerButton direction='left' className={classes.sliderButtons}>
|
|
84
|
-
<SvgImageSimple src={iconChevronLeft} />
|
|
85
|
-
</ScrollerButton>
|
|
86
|
-
</div>
|
|
87
|
-
<div className={classes.centerRight}>
|
|
88
|
-
<ScrollerButton direction='right' className={classes.sliderButtons}>
|
|
89
|
-
<SvgImageSimple src={iconChevronRight} />
|
|
90
|
-
</ScrollerButton>
|
|
91
|
-
</div>
|
|
92
|
-
</div>
|
|
93
|
-
</div>
|
|
94
|
-
</ScrollerProvider>
|
|
95
|
-
</Row>
|
|
96
|
-
)
|
|
97
|
-
}
|
package/Page/App.tsx
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FramerNextPages } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { LazyMotion } from 'framer-motion'
|
|
3
|
-
import { AppPropsType } from 'next/dist/shared/lib/utils'
|
|
4
|
-
import React, { useEffect } from 'react'
|
|
5
|
-
import PageLoadIndicator from '../PageLoadIndicator'
|
|
6
|
-
import { AppProps } from './types'
|
|
7
|
-
|
|
8
|
-
export default function App(props: AppProps & AppPropsType) {
|
|
9
|
-
useEffect(() => document.getElementById('jss-server-side')?.remove())
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<LazyMotion features={async () => (await import('./framerFeatures')).default} strict>
|
|
13
|
-
<PageLoadIndicator />
|
|
14
|
-
<FramerNextPages {...props} />
|
|
15
|
-
</LazyMotion>
|
|
16
|
-
)
|
|
17
|
-
}
|
package/Page/Document.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ServerStyleSheets } from '@material-ui/core/styles'
|
|
2
|
-
// eslint-disable-next-line @next/next/no-document-import-in-page
|
|
3
|
-
import NextDocument, { DocumentContext, DocumentInitialProps } from 'next/document'
|
|
4
|
-
import React from 'react'
|
|
5
|
-
|
|
6
|
-
export default class Document extends NextDocument {
|
|
7
|
-
static getInitialProps = async (ctx: DocumentContext): Promise<DocumentInitialProps> => {
|
|
8
|
-
const sheets = new ServerStyleSheets()
|
|
9
|
-
const originalRenderPage = ctx.renderPage
|
|
10
|
-
|
|
11
|
-
ctx.renderPage = () =>
|
|
12
|
-
originalRenderPage({
|
|
13
|
-
enhanceApp: (App) => (props) => sheets.collect(<App {...props} />),
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
const initialProps = await NextDocument.getInitialProps(ctx)
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
...initialProps,
|
|
20
|
-
// Styles fragment is rendered after the app and page rendering finish.
|
|
21
|
-
styles: [...React.Children.toArray(initialProps.styles), sheets.getStyleElement()],
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
package/StyledBadge/index.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Badge, withStyles } from '@material-ui/core'
|
|
2
|
-
|
|
3
|
-
const StyledBadge = withStyles((theme) => ({
|
|
4
|
-
colorError: {},
|
|
5
|
-
badge: {
|
|
6
|
-
...theme.typography.caption,
|
|
7
|
-
right: 6,
|
|
8
|
-
top: 6,
|
|
9
|
-
padding: 3,
|
|
10
|
-
color: '#FFF',
|
|
11
|
-
borderRadius: '100%',
|
|
12
|
-
[theme.breakpoints.up('md')]: {
|
|
13
|
-
padding: 6,
|
|
14
|
-
right: 8,
|
|
15
|
-
top: 8,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
}))(Badge)
|
|
19
|
-
|
|
20
|
-
export default StyledBadge
|
package/Styles/classesPicker.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { capitalize } from '@material-ui/core'
|
|
2
|
-
import clsx from 'clsx'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This will pick classNames from the classes object based on the given value object.sf
|
|
6
|
-
*
|
|
7
|
-
* Example:
|
|
8
|
-
*
|
|
9
|
-
* ```tsx
|
|
10
|
-
* const classes = makeStyles({
|
|
11
|
-
* root: {},
|
|
12
|
-
* rootColorRed: { color: 'red' }
|
|
13
|
-
* rootFloating: { display: 'inline-block' }
|
|
14
|
-
* })
|
|
15
|
-
*
|
|
16
|
-
* function MyComponent() {
|
|
17
|
-
* const classes = useStyles(props)
|
|
18
|
-
* const classNames = pickClasses(classes, { color: 'red', floating: true })
|
|
19
|
-
*
|
|
20
|
-
* return <div {...className('root')}>Hello</div>
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export function classesPicker<K extends string>(
|
|
25
|
-
classes: Record<string, string>,
|
|
26
|
-
values: Record<string, boolean | string | undefined>,
|
|
27
|
-
) {
|
|
28
|
-
return (className: K, addClassName?: string) => {
|
|
29
|
-
const mapped: Record<string, string> = Object.fromEntries(
|
|
30
|
-
Object.entries(values)
|
|
31
|
-
.map(([key, value]) =>
|
|
32
|
-
typeof value === 'boolean' || typeof value === 'undefined'
|
|
33
|
-
? [classes[`${className}${capitalize(key)}`], !!value]
|
|
34
|
-
: [classes[`${className}${capitalize(key)}${capitalize(value)}`], true],
|
|
35
|
-
)
|
|
36
|
-
.filter((v) => !!v[0] && v[1]),
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
return { className: clsx(classes[className], mapped, addClassName) }
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { ImageProps, isStaticImport, isStaticRequire } from '@graphcommerce/image'
|
|
2
|
-
import { makeStyles, capitalize } from '@material-ui/core'
|
|
3
|
-
import clsx from 'clsx'
|
|
4
|
-
import { forwardRef } from 'react'
|
|
5
|
-
import { responsiveVal } from '../Styles/responsiveVal'
|
|
6
|
-
|
|
7
|
-
export type SvgImageShade = 'muted' | 'default' | 'inverted'
|
|
8
|
-
|
|
9
|
-
const useStyles = makeStyles(
|
|
10
|
-
{
|
|
11
|
-
image: {
|
|
12
|
-
userSelect: 'none',
|
|
13
|
-
width: responsiveVal(22, 24),
|
|
14
|
-
height: responsiveVal(22, 24),
|
|
15
|
-
strokeWidth: 1.8,
|
|
16
|
-
strokeLinecap: 'square',
|
|
17
|
-
strokeLinejoin: 'miter',
|
|
18
|
-
fill: 'none',
|
|
19
|
-
stroke: 'currentColor',
|
|
20
|
-
},
|
|
21
|
-
sizeInherit: {
|
|
22
|
-
fontSize: 'inherit',
|
|
23
|
-
},
|
|
24
|
-
sizeXs: {
|
|
25
|
-
width: responsiveVal(11, 13),
|
|
26
|
-
height: responsiveVal(11, 13),
|
|
27
|
-
strokeWidth: 2.1,
|
|
28
|
-
},
|
|
29
|
-
sizeSmall: {
|
|
30
|
-
width: responsiveVal(12, 16),
|
|
31
|
-
height: responsiveVal(12, 16),
|
|
32
|
-
strokeWidth: 2.1,
|
|
33
|
-
},
|
|
34
|
-
sizeLarge: {
|
|
35
|
-
width: responsiveVal(24, 28),
|
|
36
|
-
height: responsiveVal(24, 28),
|
|
37
|
-
strokeWidth: 1.4,
|
|
38
|
-
},
|
|
39
|
-
sizeXl: {
|
|
40
|
-
width: responsiveVal(38, 62),
|
|
41
|
-
height: responsiveVal(38, 62),
|
|
42
|
-
strokeWidth: 1.4,
|
|
43
|
-
},
|
|
44
|
-
sizeXxl: {
|
|
45
|
-
width: responsiveVal(96, 148),
|
|
46
|
-
height: responsiveVal(96, 148),
|
|
47
|
-
strokeWidth: 0.8,
|
|
48
|
-
},
|
|
49
|
-
muted: {},
|
|
50
|
-
inverted: {},
|
|
51
|
-
},
|
|
52
|
-
{ name: 'SvgImageSimple' },
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
type SvgImageSimpleProps = Omit<ImageProps, 'fixed'> & {
|
|
56
|
-
/** The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size. */
|
|
57
|
-
size?: 'default' | 'inherit' | 'xxl' | 'xl' | 'large' | 'medium' | 'small' | 'xs'
|
|
58
|
-
fill?: boolean
|
|
59
|
-
muted?: boolean
|
|
60
|
-
inverted?: boolean
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const SvgImageSimple = forwardRef<SVGSVGElement, SvgImageSimpleProps>((props, ref) => {
|
|
64
|
-
const {
|
|
65
|
-
style,
|
|
66
|
-
className,
|
|
67
|
-
size = 'medium',
|
|
68
|
-
muted,
|
|
69
|
-
inverted,
|
|
70
|
-
fill,
|
|
71
|
-
layout = 'fixed',
|
|
72
|
-
...imageProps
|
|
73
|
-
} = props
|
|
74
|
-
const classes = useStyles()
|
|
75
|
-
|
|
76
|
-
let { src } = imageProps
|
|
77
|
-
let staticSrc = ''
|
|
78
|
-
if (isStaticImport(src)) staticSrc = (isStaticRequire(src) ? src.default : src).src
|
|
79
|
-
src = typeof src === 'string' ? src : staticSrc
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<svg
|
|
83
|
-
ref={ref}
|
|
84
|
-
className={clsx(
|
|
85
|
-
className,
|
|
86
|
-
classes.image,
|
|
87
|
-
classes?.[`size${capitalize(size)}`],
|
|
88
|
-
muted && classes.muted,
|
|
89
|
-
inverted && classes.inverted,
|
|
90
|
-
)}
|
|
91
|
-
aria-hidden='true'
|
|
92
|
-
style={style}
|
|
93
|
-
>
|
|
94
|
-
<use href={`${src}#icon`} />
|
|
95
|
-
</svg>
|
|
96
|
-
)
|
|
97
|
-
})
|
|
98
|
-
SvgImageSimple.displayName = 'SvgImageSimple'
|
|
99
|
-
|
|
100
|
-
export default SvgImageSimple
|
package/SvgImage/index.tsx
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Image, ImageProps } from '@graphcommerce/image'
|
|
2
|
-
import { makeStyles, Theme } from '@material-ui/core'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { UseStyles } from '../Styles'
|
|
5
|
-
|
|
6
|
-
// TODO: fix hot reloading issues when modifying implementations of this component
|
|
7
|
-
export type SvgImageSize = 'small' | 'medium' | 'large' | 'extralarge'
|
|
8
|
-
|
|
9
|
-
export type SvgImageProps = ImageProps & {
|
|
10
|
-
size?: SvgImageSize | number
|
|
11
|
-
mobileSize?: SvgImageSize | number
|
|
12
|
-
shade?: SvgImageShade
|
|
13
|
-
} & UseStyles<typeof useStyles>
|
|
14
|
-
|
|
15
|
-
export type SvgImageShade = 'muted' | 'default' | 'inverted'
|
|
16
|
-
|
|
17
|
-
export const SvgImageShades: Record<SvgImageShade, number> = {
|
|
18
|
-
muted: 75,
|
|
19
|
-
default: 0,
|
|
20
|
-
inverted: 100,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type UseStylesProps = { shade: number; baseSize: number; mobileSize: number }
|
|
24
|
-
|
|
25
|
-
const useStyles = makeStyles(
|
|
26
|
-
(theme: Theme) => ({
|
|
27
|
-
root: ({ shade, baseSize, mobileSize }: UseStylesProps) => ({
|
|
28
|
-
filter: shade > 0 ? `invert(${shade}%)` : undefined,
|
|
29
|
-
objectFit: 'contain',
|
|
30
|
-
width: mobileSize ?? Math.round(baseSize * 0.75),
|
|
31
|
-
height: mobileSize ?? Math.round(baseSize * 0.75),
|
|
32
|
-
[theme.breakpoints.up('md')]: {
|
|
33
|
-
width: baseSize,
|
|
34
|
-
height: baseSize,
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
}),
|
|
38
|
-
{ name: 'SvgImage' },
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
export default function SvgImage(props: SvgImageProps) {
|
|
42
|
-
const { src, size = 'medium', mobileSize, shade = 'default', ...imageProps } = props
|
|
43
|
-
|
|
44
|
-
// if (isStaticImageData(src)) {
|
|
45
|
-
// console.log(src.height)
|
|
46
|
-
// console.log(src.width)
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
|
-
const baseSizes = {
|
|
50
|
-
small: 24,
|
|
51
|
-
medium: 32,
|
|
52
|
-
large: 48,
|
|
53
|
-
extralarge: 64,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const classes = useStyles({
|
|
57
|
-
...props,
|
|
58
|
-
mobileSize: baseSizes[mobileSize ?? ''] ?? mobileSize,
|
|
59
|
-
baseSize: baseSizes[size ?? ''] ?? size,
|
|
60
|
-
shade: SvgImageShades[shade],
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<Image
|
|
65
|
-
layout='fixed'
|
|
66
|
-
unoptimized
|
|
67
|
-
src={src}
|
|
68
|
-
className={classes.root}
|
|
69
|
-
// height={24}
|
|
70
|
-
// width={24}
|
|
71
|
-
{...imageProps}
|
|
72
|
-
/>
|
|
73
|
-
)
|
|
74
|
-
}
|