@graphcommerce/next-ui 3.19.0 → 3.20.2
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/AppShell/AppShellSticky/index.tsx +3 -19
- package/AppShell/DesktopNavActions.tsx +3 -4
- package/AppShell/DesktopNavBar.tsx +2 -3
- package/AppShell/FixedFab.tsx +1 -6
- package/AppShell/GlobalHead.tsx +36 -0
- package/AppShell/Logo.tsx +11 -20
- package/AppShell/MenuFab.tsx +5 -3
- package/AppShell/MenuFabSecondaryItem.tsx +3 -3
- package/AppShell/PlaceholderFab/index.tsx +8 -27
- package/AppShell/index.tsx +19 -0
- package/AppShell/useFabAnimation.tsx +3 -2
- package/AppShell/useFixedFabAnimation.tsx +3 -2
- package/Blog/BlogAuthor/index.tsx +1 -1
- package/Blog/BlogHeader/index.tsx +2 -3
- package/Blog/BlogList/index.tsx +1 -1
- package/Blog/BlogListItem/index.tsx +1 -1
- package/Blog/BlogTitle/index.tsx +5 -5
- package/Button/index.tsx +26 -21
- package/ButtonLink/index.tsx +1 -1
- package/CHANGELOG.md +56 -0
- package/ChipMenu/index.tsx +2 -2
- package/FlagAvatar/index.tsx +3 -3
- package/{AppShell/Footer/index.tsx → Footer/Footer.tsx} +3 -3
- package/{AppShell/Footer → Footer}/SocialIcon.tsx +3 -3
- package/Footer/index.ts +2 -0
- package/Form/InputCheckmark.tsx +3 -3
- package/Form/index.tsx +1 -1
- package/FramerScroller/components/SidebarGallery.tsx +24 -20
- package/FramerScroller/components/SidebarSlider.tsx +1 -3
- package/FullPageMessage/index.tsx +1 -1
- package/IconHeader/index.tsx +2 -15
- package/Layout/components/LayoutHeader.tsx +151 -0
- package/Layout/components/LayoutHeaderBack.tsx +58 -0
- package/Layout/components/LayoutHeaderClose.tsx +27 -0
- package/Layout/components/LayoutHeaderContent.tsx +182 -0
- package/Layout/components/LayoutHeadertypes.ts +10 -0
- package/Layout/components/LayoutProvider.tsx +17 -0
- package/{Title/index.tsx → Layout/components/LayoutTitle.tsx} +24 -15
- package/Layout/context/layoutContext.tsx +7 -0
- package/Layout/hooks/useScrollY.tsx +6 -0
- package/Layout/index.ts +5 -0
- package/Layout/types.ts +5 -0
- package/LayoutDefault/components/LayoutDefault.tsx +90 -0
- package/LayoutDefault/index.ts +1 -0
- package/LayoutOverlay/components/LayoutOverlay.tsx +25 -0
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +354 -0
- package/LayoutOverlay/components/LayoutOverlayHeader.tsx +5 -0
- package/LayoutOverlay/hooks/useOverlayPosition.ts +70 -0
- package/LayoutOverlay/index.ts +2 -0
- package/Page/App.tsx +2 -0
- package/PageMeta/index.tsx +3 -0
- package/Pagination/index.tsx +0 -1
- package/Row/ButtonLinkList/index.tsx +1 -1
- package/Row/ColumnOneBoxed/index.tsx +1 -1
- package/Row/ColumnTwoWithTop/index.tsx +3 -3
- package/Row/ContentLinks/index.tsx +3 -3
- package/Row/HeroBanner/index.tsx +7 -11
- package/Row/IconBlocks/index.tsx +1 -1
- package/Row/ImageText/index.tsx +1 -1
- package/Row/ImageTextBoxed/index.tsx +1 -1
- package/Row/ParagraphWithSidebarSlide/index.tsx +1 -1
- package/Row/SpecialBanner/index.tsx +4 -3
- package/Row/index.tsx +1 -1
- package/Snackbar/MessageSnackbarImpl.tsx +1 -1
- package/StarRatingField/index.tsx +3 -4
- package/Stepper/Stepper.tsx +1 -1
- package/Styles/breakpointVal.tsx +2 -2
- package/Styles/classesPicker.ts +41 -0
- package/Styles/responsiveVal.tsx +1 -1
- package/SvgImage/SvgImageSimple.tsx +9 -8
- package/SvgImage/index.tsx +9 -11
- package/TextInputNumber/index.tsx +3 -4
- package/Theme/types.ts +14 -12
- package/ToggleButton/index.tsx +2 -4
- package/UspList/UspListItem.tsx +1 -1
- package/index.ts +9 -43
- package/package.json +8 -9
- package/AppShell/AppShellHeader/appShellHeaderContext.tsx +0 -11
- package/AppShell/AppShellHeader/index.tsx +0 -439
- package/AppShell/AppShellHeader/useAppShellHeaderContext.tsx +0 -6
- package/AppShell/AppShellProvider/index.tsx +0 -18
- package/AppShell/AppShellTitle/index.tsx +0 -45
- package/AppShell/ForwardButton.tsx +0 -53
- package/AppShell/FullPageShellBase.tsx +0 -82
- package/AppShell/MinimalPageShellBase.tsx +0 -22
- package/AppShell/PageShellHeader/index.tsx +0 -14
- package/AppShell/SheetShellBase/index.tsx +0 -114
- package/AppShell/SheetShellBase/useSheetStyles.ts +0 -18
- package/AppShell/SheetShellDragIndicator/index.tsx +0 -55
- package/AppShell/SheetShellHeader/index.tsx +0 -28
- package/AppShell/ShellBase.tsx +0 -45
- package/Debug/DebugSpacer.tsx +0 -51
- package/FramerNextPagesSlider/Slide.tsx +0 -71
- package/FramerNextPagesSlider/Slider.tsx +0 -39
- package/FramerNextPagesSlider/index.ts +0 -1
- package/FramerNextPagesSlider/types.ts +0 -3
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
export type AppShellHeaderContext = {
|
|
4
|
-
titleRef: React.RefObject<HTMLDivElement>
|
|
5
|
-
contentHeaderRef: React.RefObject<HTMLDivElement>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const appShellHeaderContext = React.createContext(undefined as unknown as AppShellHeaderContext)
|
|
9
|
-
appShellHeaderContext.displayName = 'appShellHeaderContext'
|
|
10
|
-
|
|
11
|
-
export default appShellHeaderContext
|
|
@@ -1,439 +0,0 @@
|
|
|
1
|
-
import { usePageContext, usePageRouter, usePrevUp, useUp } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import { Fab, makeStyles, Theme } from '@material-ui/core'
|
|
3
|
-
import clsx from 'clsx'
|
|
4
|
-
import { m, MotionValue, useMotionValue, useTransform } from 'framer-motion'
|
|
5
|
-
import PageLink from 'next/link'
|
|
6
|
-
import React, { useCallback, useEffect } from 'react'
|
|
7
|
-
import Button from '../../Button'
|
|
8
|
-
import { UseStyles } from '../../Styles'
|
|
9
|
-
import SvgImageSimple from '../../SvgImage/SvgImageSimple'
|
|
10
|
-
import { iconChevronLeft, iconClose } from '../../icons'
|
|
11
|
-
import useAppShellHeaderContext from './useAppShellHeaderContext'
|
|
12
|
-
|
|
13
|
-
export type AppShellHeaderProps = {
|
|
14
|
-
children?: React.ReactNode
|
|
15
|
-
primary?: React.ReactNode
|
|
16
|
-
secondary?: React.ReactNode
|
|
17
|
-
divider?: React.ReactNode
|
|
18
|
-
/* When a logo is given, children should be given too */
|
|
19
|
-
logo?: React.ReactNode
|
|
20
|
-
scrollY: MotionValue<number>
|
|
21
|
-
hideClose?: boolean
|
|
22
|
-
scrolled?: boolean
|
|
23
|
-
dragIndicator?: React.ReactNode
|
|
24
|
-
additional?: React.ReactNode
|
|
25
|
-
fill?: 'both' | 'mobile-only'
|
|
26
|
-
sheet?: boolean
|
|
27
|
-
} & UseStyles<typeof useStyles>
|
|
28
|
-
|
|
29
|
-
// minHeight: x
|
|
30
|
-
// to reserve space for back & primary buttons,
|
|
31
|
-
// even when there is no app shell header on scroll (e.g. on full page shell)
|
|
32
|
-
const minHeight = 40
|
|
33
|
-
const useStyles = makeStyles(
|
|
34
|
-
(theme: Theme) => ({
|
|
35
|
-
divider: {
|
|
36
|
-
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
37
|
-
},
|
|
38
|
-
dividerSpacer: {
|
|
39
|
-
minHeight: 1,
|
|
40
|
-
},
|
|
41
|
-
dividerSheetShell: {
|
|
42
|
-
marginTop: `calc((${theme.page.headerInnerHeight.md} * 0.15))`,
|
|
43
|
-
},
|
|
44
|
-
sheetHeaderContainer: {
|
|
45
|
-
position: 'sticky',
|
|
46
|
-
top: 0,
|
|
47
|
-
zIndex: 98,
|
|
48
|
-
// reserve space in the container even without any buttons added
|
|
49
|
-
minHeight: 58,
|
|
50
|
-
},
|
|
51
|
-
sheetHeaderContainerSheetShell: {
|
|
52
|
-
marginBottom: `calc((${theme.page.headerInnerHeight.md} * 0.15) * -1)`,
|
|
53
|
-
},
|
|
54
|
-
sheetHeader: {
|
|
55
|
-
background: theme.palette.background.default,
|
|
56
|
-
paddingTop: 8,
|
|
57
|
-
paddingBottom: 8,
|
|
58
|
-
minHeight,
|
|
59
|
-
[theme.breakpoints.up('md')]: {
|
|
60
|
-
minHeight: `calc(${minHeight}px + ${theme.spacings.xxs} * 2)`,
|
|
61
|
-
paddingTop: theme.spacings.xxs,
|
|
62
|
-
paddingBottom: theme.spacings.xxs,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
sheetHeaderSheetShell: {
|
|
66
|
-
// The bottom sheets offset top is x% short compared to the page headers height,
|
|
67
|
-
// so we add x% of the header height to padding top of bottomsheet actions bar
|
|
68
|
-
// to keep consistency between app shell buttons.
|
|
69
|
-
paddingTop: `calc(${theme.spacings.xxs} + (${theme.page.headerInnerHeight.md} * 0.15))`,
|
|
70
|
-
paddingBottom: `calc(${theme.spacings.xxs} + (${theme.page.headerInnerHeight.md} * 0.15))`,
|
|
71
|
-
[theme.breakpoints.down('sm')]: {
|
|
72
|
-
paddingTop: 8,
|
|
73
|
-
paddingBottom: 8,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
sheetHeaderScrolled: {
|
|
77
|
-
[theme.breakpoints.up('md')]: {
|
|
78
|
-
marginTop: -60,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
sheetHeaderActions: {
|
|
82
|
-
display: 'grid',
|
|
83
|
-
gridTemplateColumns: `1fr auto 1fr`,
|
|
84
|
-
gridAutoFlow: 'column',
|
|
85
|
-
alignItems: 'center',
|
|
86
|
-
justifyContent: 'space-between',
|
|
87
|
-
padding: `0 calc(${theme.page.horizontal} + 2px) 0`,
|
|
88
|
-
width: '100%',
|
|
89
|
-
minHeight,
|
|
90
|
-
[theme.breakpoints.up('md')]: {
|
|
91
|
-
'& * > a, & * > button': {
|
|
92
|
-
height: minHeight,
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
[theme.breakpoints.down('sm')]: {
|
|
96
|
-
'& div > .MuiFab-sizeSmall': {
|
|
97
|
-
marginLeft: -8,
|
|
98
|
-
marginRight: -8,
|
|
99
|
-
},
|
|
100
|
-
'& div > .MuiButtonBase-root': {
|
|
101
|
-
minWidth: 'unset',
|
|
102
|
-
marginRight: -8,
|
|
103
|
-
marginLeft: -8,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
sheetHeaderActionRight: {
|
|
108
|
-
justifySelf: 'flex-end',
|
|
109
|
-
'& > .Mui-disabled': {
|
|
110
|
-
// color: `${theme.palette.primary.contrastText} !important`,
|
|
111
|
-
[theme.breakpoints.up('sm')]: {
|
|
112
|
-
opacity: 0.25,
|
|
113
|
-
color: `${theme.palette.secondary.contrastText} !important`,
|
|
114
|
-
'& svg': {
|
|
115
|
-
stroke: `${theme.palette.secondary.contrastText} !important`,
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
sheetHeaderNoTitle: {
|
|
121
|
-
pointerEvents: 'none',
|
|
122
|
-
background: 'transparent',
|
|
123
|
-
},
|
|
124
|
-
sheetHeaderNoTitleFillMobileOnly: {
|
|
125
|
-
[theme.breakpoints.up('md')]: {
|
|
126
|
-
pointerEvents: 'none',
|
|
127
|
-
background: 'transparent',
|
|
128
|
-
top: 98,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
sheetHeaderFillMobileOnly: {
|
|
132
|
-
[theme.breakpoints.up('md')]: {
|
|
133
|
-
pointerEvents: 'none',
|
|
134
|
-
position: 'fixed',
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
innerContainer: {
|
|
138
|
-
display: 'grid',
|
|
139
|
-
textAlign: 'center',
|
|
140
|
-
pointerEvents: 'all',
|
|
141
|
-
},
|
|
142
|
-
fab: {
|
|
143
|
-
maxWidth: 38,
|
|
144
|
-
maxHeight: 38,
|
|
145
|
-
[theme.breakpoints.down('sm')]: {
|
|
146
|
-
boxShadow: 'none',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
childs: {
|
|
150
|
-
marginLeft: 12,
|
|
151
|
-
marginRight: 12,
|
|
152
|
-
whiteSpace: 'nowrap',
|
|
153
|
-
overflow: 'hidden',
|
|
154
|
-
textOverflow: 'ellipsis',
|
|
155
|
-
},
|
|
156
|
-
fillMobileOnly: {
|
|
157
|
-
[theme.breakpoints.up('md')]: {
|
|
158
|
-
display: 'none',
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
dividerFillMobileOnly: {
|
|
162
|
-
[theme.breakpoints.up('md')]: {
|
|
163
|
-
visibility: 'hidden',
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
logoContainer: {
|
|
167
|
-
position: 'absolute',
|
|
168
|
-
top: 0,
|
|
169
|
-
left: 0,
|
|
170
|
-
right: 0,
|
|
171
|
-
paddingTop: 8,
|
|
172
|
-
paddingBottom: 8,
|
|
173
|
-
},
|
|
174
|
-
logoInnerContainer: {
|
|
175
|
-
minHeight,
|
|
176
|
-
display: 'flex',
|
|
177
|
-
alignItems: 'center',
|
|
178
|
-
[theme.breakpoints.up('md')]: {
|
|
179
|
-
display: 'none',
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
backButton: {
|
|
183
|
-
background: theme.palette.background.paper,
|
|
184
|
-
color: theme.palette.text.primary,
|
|
185
|
-
'&:hover': {
|
|
186
|
-
background: theme.palette.background.paper,
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
sheetShellActionsFullPage: {
|
|
190
|
-
'& * > a, & * > button': {
|
|
191
|
-
pointerEvents: 'all',
|
|
192
|
-
},
|
|
193
|
-
'& * > button': {
|
|
194
|
-
boxShadow: theme.shadows[6],
|
|
195
|
-
},
|
|
196
|
-
[theme.breakpoints.up('md')]: {
|
|
197
|
-
position: 'fixed',
|
|
198
|
-
top: `calc(${theme.page.headerInnerHeight.md} + ${theme.spacings.xxs})`,
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
sheetShellActionsNoButtonShadow: {
|
|
202
|
-
[theme.breakpoints.down('sm')]: {
|
|
203
|
-
'& * > button': {
|
|
204
|
-
backgroundColor: 'unset',
|
|
205
|
-
boxShadow: 'none',
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
}),
|
|
210
|
-
{ name: 'AppShellHeader' },
|
|
211
|
-
)
|
|
212
|
-
|
|
213
|
-
export default function AppShellHeader(props: AppShellHeaderProps) {
|
|
214
|
-
const {
|
|
215
|
-
children,
|
|
216
|
-
logo,
|
|
217
|
-
divider,
|
|
218
|
-
primary = null,
|
|
219
|
-
secondary = null,
|
|
220
|
-
hideClose,
|
|
221
|
-
scrollY,
|
|
222
|
-
additional,
|
|
223
|
-
dragIndicator,
|
|
224
|
-
scrolled,
|
|
225
|
-
fill = 'both',
|
|
226
|
-
sheet,
|
|
227
|
-
} = props
|
|
228
|
-
|
|
229
|
-
const router = usePageRouter()
|
|
230
|
-
const { closeSteps, backSteps } = usePageContext()
|
|
231
|
-
const classes = useStyles(props)
|
|
232
|
-
const up = useUp()
|
|
233
|
-
const prevUp = usePrevUp()
|
|
234
|
-
const { titleRef, contentHeaderRef } = useAppShellHeaderContext()
|
|
235
|
-
|
|
236
|
-
const noChildren = typeof children === 'undefined' || !children
|
|
237
|
-
|
|
238
|
-
const fillMobileOnly = fill === 'mobile-only'
|
|
239
|
-
|
|
240
|
-
const sheetHeaderHeight = useMotionValue<number>(0)
|
|
241
|
-
const titleOffset = useMotionValue<number>(100)
|
|
242
|
-
const titleHeight = useMotionValue<number>(100)
|
|
243
|
-
|
|
244
|
-
const setOffset = useCallback(
|
|
245
|
-
(offsetTop: number, offsetParent: Element | null, clientHeight: number) => {
|
|
246
|
-
titleHeight.set(clientHeight)
|
|
247
|
-
titleOffset.set(offsetTop)
|
|
248
|
-
},
|
|
249
|
-
[titleHeight, titleOffset],
|
|
250
|
-
)
|
|
251
|
-
|
|
252
|
-
if (titleRef.current) {
|
|
253
|
-
setOffset(
|
|
254
|
-
titleRef.current.offsetTop,
|
|
255
|
-
titleRef.current.offsetParent,
|
|
256
|
-
titleRef.current.clientHeight,
|
|
257
|
-
)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Measure the title sizes so we can animate the opacity
|
|
261
|
-
useEffect(() => {
|
|
262
|
-
if (!titleRef.current) return () => {}
|
|
263
|
-
|
|
264
|
-
const ro = new ResizeObserver(([entry]) => {
|
|
265
|
-
const { offsetTop, offsetParent, clientHeight } = entry.target as HTMLDivElement
|
|
266
|
-
|
|
267
|
-
setOffset(offsetTop, offsetParent, clientHeight)
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
ro.observe(titleRef.current)
|
|
271
|
-
return () => ro.disconnect()
|
|
272
|
-
}, [setOffset, titleHeight, titleOffset, titleRef])
|
|
273
|
-
|
|
274
|
-
// Measure the sheetHeight sizes so we can animate the opacity
|
|
275
|
-
useEffect(() => {
|
|
276
|
-
if (!contentHeaderRef.current) return () => {}
|
|
277
|
-
|
|
278
|
-
const ro = new ResizeObserver(([entry]) =>
|
|
279
|
-
sheetHeaderHeight.set((entry.target as HTMLDivElement).clientHeight),
|
|
280
|
-
)
|
|
281
|
-
|
|
282
|
-
ro.observe(contentHeaderRef.current)
|
|
283
|
-
|
|
284
|
-
return () => ro.disconnect()
|
|
285
|
-
}, [contentHeaderRef, sheetHeaderHeight])
|
|
286
|
-
|
|
287
|
-
const opacityTitle = useTransform(
|
|
288
|
-
[scrollY, sheetHeaderHeight, titleOffset, titleHeight] as MotionValue<number | string>[],
|
|
289
|
-
([scrollYV, sheetHeaderHeightV, titleOffsetV, titleHeigthV]: number[]) =>
|
|
290
|
-
Math.min(
|
|
291
|
-
Math.max(
|
|
292
|
-
0,
|
|
293
|
-
scrolled
|
|
294
|
-
? 1
|
|
295
|
-
: (scrollYV - Math.max(titleOffsetV, 80) + sheetHeaderHeightV) / titleHeigthV,
|
|
296
|
-
),
|
|
297
|
-
1,
|
|
298
|
-
),
|
|
299
|
-
)
|
|
300
|
-
|
|
301
|
-
const pointerEvents = useTransform(opacityTitle, (o) => (o < 0.2 ? 'none' : 'all'))
|
|
302
|
-
const opacityLogo = useTransform(opacityTitle, [0, 1], [1, fillMobileOnly && primary ? 1 : 0])
|
|
303
|
-
const pointerEventsLogo = useTransform(opacityLogo, (o) => (o < 0.2 ? 'none' : 'all'))
|
|
304
|
-
|
|
305
|
-
const close =
|
|
306
|
-
!hideClose &&
|
|
307
|
-
(closeSteps > 0 ? (
|
|
308
|
-
<Fab
|
|
309
|
-
size='small'
|
|
310
|
-
type='button'
|
|
311
|
-
classes={{ root: classes.fab }}
|
|
312
|
-
onClick={() => router.go(closeSteps * -1)}
|
|
313
|
-
aria-label='Close'
|
|
314
|
-
>
|
|
315
|
-
<SvgImageSimple src={iconClose} />
|
|
316
|
-
</Fab>
|
|
317
|
-
) : (
|
|
318
|
-
<PageLink href='/' passHref>
|
|
319
|
-
<Fab size='small' classes={{ root: classes.fab }} aria-label='Close'>
|
|
320
|
-
<SvgImageSimple src={iconClose} />
|
|
321
|
-
</Fab>
|
|
322
|
-
</PageLink>
|
|
323
|
-
))
|
|
324
|
-
|
|
325
|
-
const backIcon = <SvgImageSimple src={iconChevronLeft} />
|
|
326
|
-
|
|
327
|
-
const canClickBack = backSteps > 0 && router.asPath !== prevUp?.href
|
|
328
|
-
let back = canClickBack && (
|
|
329
|
-
<Button
|
|
330
|
-
onClick={() => router.back()}
|
|
331
|
-
variant='pill-link'
|
|
332
|
-
size='small'
|
|
333
|
-
className={classes.backButton}
|
|
334
|
-
startIcon={backIcon}
|
|
335
|
-
aria-label='Back'
|
|
336
|
-
>
|
|
337
|
-
{up?.href === router.asPath ? up?.title : 'Back'}
|
|
338
|
-
</Button>
|
|
339
|
-
)
|
|
340
|
-
|
|
341
|
-
if (!canClickBack && up?.href) {
|
|
342
|
-
back = (
|
|
343
|
-
<PageLink href={up?.href} passHref>
|
|
344
|
-
<Button
|
|
345
|
-
variant='pill-link'
|
|
346
|
-
className={classes.backButton}
|
|
347
|
-
startIcon={backIcon}
|
|
348
|
-
aria-label='Back'
|
|
349
|
-
>
|
|
350
|
-
{up?.title ?? 'Back'}
|
|
351
|
-
</Button>
|
|
352
|
-
</PageLink>
|
|
353
|
-
)
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
let leftAction: React.ReactNode = secondary ?? back
|
|
357
|
-
const rightAction: React.ReactNode = primary ?? close
|
|
358
|
-
if (rightAction !== close && !leftAction) leftAction = close
|
|
359
|
-
if (!leftAction) leftAction = <div />
|
|
360
|
-
|
|
361
|
-
const showDivider = children || (fillMobileOnly && primary)
|
|
362
|
-
|
|
363
|
-
return (
|
|
364
|
-
<div
|
|
365
|
-
className={clsx(
|
|
366
|
-
classes.sheetHeaderContainer,
|
|
367
|
-
noChildren && !primary && classes.sheetHeaderNoTitle,
|
|
368
|
-
fillMobileOnly && classes.sheetHeaderFillMobileOnly,
|
|
369
|
-
sheet && classes.sheetHeaderContainerSheetShell,
|
|
370
|
-
)}
|
|
371
|
-
>
|
|
372
|
-
<div
|
|
373
|
-
className={clsx(
|
|
374
|
-
classes?.sheetHeader,
|
|
375
|
-
sheet && classes.sheetHeaderSheetShell,
|
|
376
|
-
scrolled && classes?.sheetHeaderScrolled,
|
|
377
|
-
noChildren && !primary && classes.sheetHeaderNoTitle,
|
|
378
|
-
fillMobileOnly && noChildren && classes.sheetHeaderNoTitleFillMobileOnly,
|
|
379
|
-
fillMobileOnly && classes.sheetHeaderFillMobileOnly,
|
|
380
|
-
)}
|
|
381
|
-
ref={contentHeaderRef}
|
|
382
|
-
>
|
|
383
|
-
<div className={classes.logoContainer}>
|
|
384
|
-
{logo && (
|
|
385
|
-
<m.div
|
|
386
|
-
style={{
|
|
387
|
-
opacity: opacityLogo,
|
|
388
|
-
pointerEvents: pointerEventsLogo,
|
|
389
|
-
}}
|
|
390
|
-
className={classes.logoInnerContainer}
|
|
391
|
-
>
|
|
392
|
-
{logo}
|
|
393
|
-
</m.div>
|
|
394
|
-
)}
|
|
395
|
-
</div>
|
|
396
|
-
|
|
397
|
-
{dragIndicator}
|
|
398
|
-
|
|
399
|
-
<div
|
|
400
|
-
className={clsx(
|
|
401
|
-
classes.sheetHeaderActions,
|
|
402
|
-
(noChildren || fillMobileOnly) && classes.sheetShellActionsFullPage,
|
|
403
|
-
fillMobileOnly && showDivider && classes.sheetShellActionsNoButtonShadow,
|
|
404
|
-
)}
|
|
405
|
-
>
|
|
406
|
-
{leftAction && <div>{leftAction}</div>}
|
|
407
|
-
<div className={classes.innerContainer}>
|
|
408
|
-
{children && (
|
|
409
|
-
<m.div
|
|
410
|
-
style={{ opacity: opacityTitle, pointerEvents }}
|
|
411
|
-
className={clsx(classes.childs, fillMobileOnly && classes.fillMobileOnly)}
|
|
412
|
-
>
|
|
413
|
-
{children}
|
|
414
|
-
</m.div>
|
|
415
|
-
)}
|
|
416
|
-
</div>
|
|
417
|
-
<div className={classes?.sheetHeaderActionRight}>{rightAction}</div>
|
|
418
|
-
</div>
|
|
419
|
-
{additional && (
|
|
420
|
-
<div className={clsx(fillMobileOnly && classes.fillMobileOnly)}>
|
|
421
|
-
<>{additional}</>
|
|
422
|
-
</div>
|
|
423
|
-
)}
|
|
424
|
-
</div>
|
|
425
|
-
{showDivider &&
|
|
426
|
-
(divider ?? (
|
|
427
|
-
<m.div
|
|
428
|
-
className={clsx(
|
|
429
|
-
classes.dividerSpacer,
|
|
430
|
-
classes.divider,
|
|
431
|
-
fillMobileOnly && classes.dividerFillMobileOnly,
|
|
432
|
-
)}
|
|
433
|
-
style={{ opacity: opacityTitle }}
|
|
434
|
-
/>
|
|
435
|
-
))}
|
|
436
|
-
{!showDivider && <div className={classes.dividerSpacer} />}
|
|
437
|
-
</div>
|
|
438
|
-
)
|
|
439
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useRef } from 'react'
|
|
2
|
-
import appShellHeaderContext, {
|
|
3
|
-
AppShellHeaderContext,
|
|
4
|
-
} from '../AppShellHeader/appShellHeaderContext'
|
|
5
|
-
|
|
6
|
-
type AppShellProviderProps = {
|
|
7
|
-
children: React.ReactNode
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default function AppShellProvider(props: AppShellProviderProps) {
|
|
11
|
-
const { children } = props
|
|
12
|
-
const context: AppShellHeaderContext = {
|
|
13
|
-
titleRef: useRef<HTMLDivElement>(null),
|
|
14
|
-
contentHeaderRef: useRef<HTMLDivElement>(null),
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return <appShellHeaderContext.Provider value={context}>{children}</appShellHeaderContext.Provider>
|
|
18
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { makeStyles, Theme, TypographyProps } from '@material-ui/core'
|
|
2
|
-
import clsx from 'clsx'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { UseStyles } from '../../Styles'
|
|
5
|
-
import Title, { TitleProps } from '../../Title'
|
|
6
|
-
import useAppShellHeaderContext from '../AppShellHeader/useAppShellHeaderContext'
|
|
7
|
-
|
|
8
|
-
type AppShellTitleProps = {
|
|
9
|
-
children: React.ReactNode
|
|
10
|
-
bare?: boolean
|
|
11
|
-
variant?: TypographyProps['variant']
|
|
12
|
-
} & Pick<TitleProps, 'icon'> &
|
|
13
|
-
UseStyles<typeof useStyles>
|
|
14
|
-
|
|
15
|
-
const useStyles = makeStyles(
|
|
16
|
-
(theme: Theme) => ({
|
|
17
|
-
title: {},
|
|
18
|
-
margin: {
|
|
19
|
-
marginTop: theme.spacings.lg,
|
|
20
|
-
marginBottom: theme.spacings.lg,
|
|
21
|
-
},
|
|
22
|
-
}),
|
|
23
|
-
{
|
|
24
|
-
name: 'AppShellTitle',
|
|
25
|
-
},
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export default function AppShellTitle(props: AppShellTitleProps) {
|
|
29
|
-
const { children, icon, bare, variant } = props
|
|
30
|
-
const { titleRef } = useAppShellHeaderContext()
|
|
31
|
-
const classes = useStyles(props)
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Title
|
|
35
|
-
ref={titleRef}
|
|
36
|
-
component='h2'
|
|
37
|
-
size='medium'
|
|
38
|
-
variant={variant}
|
|
39
|
-
icon={icon ?? undefined}
|
|
40
|
-
classes={{ container: clsx(classes.title, !bare && classes.margin) }}
|
|
41
|
-
>
|
|
42
|
-
{children}
|
|
43
|
-
</Title>
|
|
44
|
-
)
|
|
45
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { ButtonProps, makeStyles, Theme } from '@material-ui/core'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { SvgImageSimple } from '..'
|
|
4
|
-
import Button from '../Button'
|
|
5
|
-
import { UseStyles } from '../Styles'
|
|
6
|
-
import { iconChevronRight } from '../icons'
|
|
7
|
-
|
|
8
|
-
const useStyles = makeStyles(
|
|
9
|
-
(theme: Theme) => ({
|
|
10
|
-
root: {
|
|
11
|
-
width: 'min-content',
|
|
12
|
-
pointerEvents: 'all',
|
|
13
|
-
[theme.breakpoints.down('sm')]: {
|
|
14
|
-
height: 40,
|
|
15
|
-
minWidth: 40,
|
|
16
|
-
borderRadius: 20,
|
|
17
|
-
},
|
|
18
|
-
[theme.breakpoints.down('xs')]: {
|
|
19
|
-
boxShadow: 'unset',
|
|
20
|
-
paddingLeft: `12px`,
|
|
21
|
-
paddingRight: `10px`,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
label: {
|
|
25
|
-
whiteSpace: 'nowrap',
|
|
26
|
-
},
|
|
27
|
-
icon: {
|
|
28
|
-
display: 'none',
|
|
29
|
-
[theme.breakpoints.up('sm')]: {
|
|
30
|
-
display: 'unset',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
text: {
|
|
34
|
-
pointerEvents: 'none',
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
{ name: 'ForwardButton' },
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
export type ForwardButtonProps = UseStyles<typeof useStyles> & ButtonProps & { down?: boolean }
|
|
41
|
-
|
|
42
|
-
const ForwardButton = React.forwardRef((props: ForwardButtonProps, ref) => {
|
|
43
|
-
const { text, icon, ...classes } = useStyles(props)
|
|
44
|
-
const { children, down, ...fabProps } = props
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<Button variant='pill' classes={classes} {...fabProps} ref={ref}>
|
|
48
|
-
<span className={text}>{children}</span>
|
|
49
|
-
<SvgImageSimple src={iconChevronRight} size='small' className={classes.root} />
|
|
50
|
-
</Button>
|
|
51
|
-
)
|
|
52
|
-
})
|
|
53
|
-
export default ForwardButton
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { makeStyles, Theme } from '@material-ui/core'
|
|
2
|
-
import clsx from 'clsx'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { UseStyles } from '../Styles'
|
|
5
|
-
import AppShellProvider from './AppShellProvider'
|
|
6
|
-
import ShellBase, { PageLayoutBaseProps } from './ShellBase'
|
|
7
|
-
|
|
8
|
-
const useStyles = makeStyles(
|
|
9
|
-
(theme: Theme) => ({
|
|
10
|
-
root: {
|
|
11
|
-
minHeight: '100vh',
|
|
12
|
-
display: 'grid',
|
|
13
|
-
gridTemplateRows: `auto 1fr auto`,
|
|
14
|
-
gridTemplateColumns: '100%',
|
|
15
|
-
background: theme.palette.background.default,
|
|
16
|
-
},
|
|
17
|
-
hideFabsOnVirtualKeyboardOpen: {
|
|
18
|
-
[theme.breakpoints.down('sm')]: {
|
|
19
|
-
'@media (max-height: 530px)': {
|
|
20
|
-
display: 'none',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
header: {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
alignItems: 'center',
|
|
27
|
-
justifyContent: 'center',
|
|
28
|
-
[theme.breakpoints.up('md')]: {
|
|
29
|
-
padding: `${theme.spacings.xxs} ${theme.page.horizontal} 0`,
|
|
30
|
-
marginBottom: theme.spacings.xxs,
|
|
31
|
-
top: 0,
|
|
32
|
-
display: 'flex',
|
|
33
|
-
pointerEvents: 'none',
|
|
34
|
-
justifyContent: 'left',
|
|
35
|
-
width: '100%',
|
|
36
|
-
height: theme.page.headerInnerHeight.md,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
headerAlwaysShow: {
|
|
40
|
-
[theme.breakpoints.down('sm')]: {
|
|
41
|
-
marginTop: 20,
|
|
42
|
-
marginBottom: 22,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
}),
|
|
46
|
-
{ name: 'FullPageShellBase' },
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
export type FullPageShellBaseProps = {
|
|
50
|
-
header: React.ReactNode
|
|
51
|
-
footer: React.ReactNode
|
|
52
|
-
menuFab?: React.ReactNode
|
|
53
|
-
cartFab?: React.ReactNode
|
|
54
|
-
children?: React.ReactNode
|
|
55
|
-
alwaysShowHeader?: boolean
|
|
56
|
-
} & UseStyles<typeof useStyles> &
|
|
57
|
-
PageLayoutBaseProps
|
|
58
|
-
|
|
59
|
-
export default function FullPageShellBase(props: FullPageShellBaseProps) {
|
|
60
|
-
const { children, header, footer, menuFab, cartFab, name, alwaysShowHeader } = props
|
|
61
|
-
const classes = useStyles(props)
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div className={classes.root}>
|
|
65
|
-
<AppShellProvider>
|
|
66
|
-
<ShellBase name={name}>
|
|
67
|
-
<header className={clsx(classes.header, alwaysShowHeader && classes.headerAlwaysShow)}>
|
|
68
|
-
{header}
|
|
69
|
-
</header>
|
|
70
|
-
<div>
|
|
71
|
-
<div className={classes.hideFabsOnVirtualKeyboardOpen}>
|
|
72
|
-
{menuFab}
|
|
73
|
-
{cartFab}
|
|
74
|
-
</div>
|
|
75
|
-
{children}
|
|
76
|
-
</div>
|
|
77
|
-
<div>{footer}</div>
|
|
78
|
-
</ShellBase>
|
|
79
|
-
</AppShellProvider>
|
|
80
|
-
</div>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { makeStyles, Theme } from '@material-ui/core'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import FullPageShellBase, { FullPageShellBaseProps } from './FullPageShellBase'
|
|
4
|
-
|
|
5
|
-
const useStyles = makeStyles(
|
|
6
|
-
(theme: Theme) => ({
|
|
7
|
-
header: {
|
|
8
|
-
[theme.breakpoints.up('md')]: {
|
|
9
|
-
minHeight: 60,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
}),
|
|
13
|
-
{ name: 'MinimalPageShellBase' },
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
export type MinimalPageShellBaseProps = FullPageShellBaseProps
|
|
17
|
-
|
|
18
|
-
export default function MinimalPageShellBase(props: MinimalPageShellBaseProps) {
|
|
19
|
-
const classes = useStyles(props)
|
|
20
|
-
|
|
21
|
-
return <FullPageShellBase {...props} classes={classes} />
|
|
22
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useViewportScroll } from 'framer-motion'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import AppShellHeader, { AppShellHeaderProps } from '../AppShellHeader'
|
|
4
|
-
|
|
5
|
-
export type PageShellHeaderProps = Omit<
|
|
6
|
-
AppShellHeaderProps,
|
|
7
|
-
'scrollY' | 'hideClose' | 'dragIndicator'
|
|
8
|
-
>
|
|
9
|
-
|
|
10
|
-
export default function PageShellHeader(props: PageShellHeaderProps) {
|
|
11
|
-
const { scrollY } = useViewportScroll()
|
|
12
|
-
|
|
13
|
-
return <AppShellHeader {...props} scrollY={scrollY} hideClose />
|
|
14
|
-
}
|