@graphcommerce/next-ui 4.2.3 → 4.3.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 → AnimatedRow.tsx} +0 -0
- package/Blog/BlogAuthor/{index.tsx → BlogAuthor.tsx} +2 -2
- package/Blog/BlogContent/{index.tsx → BlogContent.tsx} +0 -0
- package/Blog/BlogHeader/{index.tsx → BlogHeader.tsx} +0 -0
- package/Blog/BlogList/{index.tsx → BlogList.tsx} +1 -1
- package/Blog/BlogListItem/{index.tsx → BlogListItem.tsx} +0 -0
- package/Blog/BlogTags/BlogTag.tsx +2 -2
- package/Blog/BlogTags/{index.tsx → BlogTags.tsx} +0 -0
- package/Blog/BlogTitle/{index.tsx → BlogTitle.tsx} +0 -0
- package/Button/LinkOrButton.tsx +23 -11
- package/Button/{index.tsx → index.ts} +0 -0
- package/CHANGELOG.md +753 -1450
- package/ChipMenu/{index.tsx → ChipMenu.tsx} +13 -28
- package/ContainerWithHeader/{index.tsx → ContainerWithHeader.tsx} +1 -1
- package/FlagAvatar/{index.tsx → FlagAvatar.tsx} +0 -0
- package/Footer/Footer.tsx +9 -10
- package/FramerScroller/SidebarGallery.tsx +1 -1
- package/FramerScroller/SidebarSlider.tsx +1 -1
- package/FullPageMessage/{index.tsx → FullPageMessage.tsx} +0 -0
- package/Highlight/{index.tsx → Highlight.tsx} +0 -0
- package/IconHeader/{index.tsx → IconHeader.tsx} +0 -0
- package/JsonLd/{index.tsx → JsonLd.tsx} +0 -0
- package/Layout/components/LayoutHeader.tsx +3 -3
- package/Layout/components/LayoutHeaderBack.tsx +18 -4
- package/Layout/components/LayoutHeaderClose.tsx +1 -1
- package/Layout/components/LayoutHeaderContent.tsx +1 -1
- package/Layout/components/LayoutProvider.tsx +2 -2
- package/Layout/context/layoutContext.tsx +1 -3
- package/Layout/hooks/useScrollY.tsx +1 -1
- package/LayoutDefault/components/LayoutDefault.tsx +14 -4
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +2 -2
- package/LayoutParts/DesktopHeaderBadge.tsx +1 -1
- package/LayoutParts/MenuFab.tsx +47 -10
- package/Page/types.ts +1 -0
- package/PageLoadIndicator/{index.tsx → PageLoadIndicator.tsx} +0 -0
- package/PageMeta/{index.tsx → PageMeta.tsx} +11 -2
- package/Pagination/{index.tsx → Pagination.tsx} +0 -0
- package/RenderType/{index.tsx → RenderType.tsx} +0 -0
- package/Row/ButtonLinkList/ButtonLinkList.tsx +2 -2
- package/Row/ColumnOne/{index.tsx → ColumnOne.tsx} +0 -0
- package/Row/ColumnOneBoxed/{index.tsx → ColumnOneBoxed.tsx} +1 -1
- package/Row/ColumnOneCentered/{index.tsx → ColumnOneCentered.tsx} +1 -1
- package/Row/ColumnThree/{index.tsx → ColumnThree.tsx} +1 -1
- package/Row/ColumnTwo/{index.tsx → ColumnTwo.tsx} +1 -1
- package/Row/ColumnTwoSpread/{index.tsx → ColumnTwoSpread.tsx} +1 -1
- package/Row/ColumnTwoWithTop/{index.tsx → ColumnTwoWithTop.tsx} +1 -1
- package/Row/ContentLinks/{index.tsx → ContentLinks.tsx} +0 -0
- package/Row/HeroBanner/{index.tsx → HeroBanner.tsx} +1 -1
- package/Row/IconBlocks/{IconBlock/index.tsx → IconBlock.tsx} +1 -1
- package/Row/IconBlocks/{index.tsx → IconBlocks.tsx} +1 -1
- package/Row/ImageText/{index.tsx → ImageText.tsx} +2 -2
- package/Row/ImageTextBoxed/{index.tsx → ImageTextBoxed.tsx} +1 -1
- package/Row/ParagraphWithSidebarSlide/{index.tsx → ParagraphWithSidebarSlide.tsx} +1 -1
- package/Row/Quote/{index.tsx → Quote.tsx} +1 -1
- package/Row/{index.tsx → Row.tsx} +0 -0
- package/Row/SpecialBanner/{index.tsx → SpecialBanner.tsx} +1 -1
- package/Row/index.ts +18 -0
- package/SectionContainer/{index.tsx → SectionContainer.tsx} +1 -1
- package/SectionHeader/{index.tsx → SectionHeader.tsx} +0 -0
- package/Separator/{index.tsx → Separator.tsx} +0 -0
- package/Snackbar/MessageSnackbarImpl.tsx +2 -1
- package/StarRatingField/{index.tsx → StarRatingField.tsx} +4 -4
- package/Styles/{index.tsx → index.ts} +0 -9
- package/Styles/withTheme.tsx +1 -0
- package/TextInputNumber/{index.tsx → TextInputNumber.tsx} +1 -5
- package/Theme/MuiButton.ts +2 -2
- package/Theme/MuiChip.ts +86 -0
- package/Theme/MuiFab.ts +21 -0
- package/Theme/MuiSlider.ts +41 -26
- package/Theme/index.ts +4 -3
- package/Theme/themeDefaults.ts +1 -1
- package/TimeAgo/{index.tsx → TimeAgo.tsx} +0 -0
- package/ToggleButton/{index.tsx → ToggleButton.tsx} +1 -0
- package/ToggleButtonGroup/{index.tsx → ToggleButtonGroup.tsx} +8 -6
- package/UspList/{index.tsx → UspList.tsx} +0 -0
- package/docs/components/ComponentChild.tsx +1 -0
- package/docs/components/ComponentChildVariant.tsx +1 -0
- package/docs/components/ComponentChildVariantExtendable.tsx +1 -0
- package/icons/{index.tsx → index.ts} +0 -0
- package/index.ts +28 -45
- package/package.json +10 -11
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { Chip, ChipProps, Menu, MenuProps, menuClasses, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import React, { PropsWithChildren, useState } from 'react'
|
|
3
3
|
import { IconSvg } from '../IconSvg'
|
|
4
|
-
import { SectionHeader } from '../SectionHeader'
|
|
5
|
-
import { extendableComponent } from '../Styles'
|
|
4
|
+
import { SectionHeader } from '../SectionHeader/SectionHeader'
|
|
6
5
|
import { responsiveVal } from '../Styles/responsiveVal'
|
|
7
6
|
import { iconChevronDown, iconChevronUp, iconCancelAlt } from '../icons'
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export type ChipMenuProps = PropsWithChildren<
|
|
9
|
+
Omit<ChipProps<'button'>, 'children' | 'component'>
|
|
10
|
+
> & {
|
|
12
11
|
selectedLabel?: React.ReactNode
|
|
13
12
|
selected: boolean
|
|
14
13
|
onClose?: () => void
|
|
@@ -41,33 +40,21 @@ export function ChipMenu(props: ChipMenuProps) {
|
|
|
41
40
|
return (
|
|
42
41
|
<>
|
|
43
42
|
<Chip
|
|
44
|
-
|
|
43
|
+
component='button'
|
|
44
|
+
size='responsive'
|
|
45
|
+
color={selectedAndMenuHidden ? 'primary' : 'default'}
|
|
45
46
|
clickable
|
|
46
|
-
onDelete={
|
|
47
|
-
|
|
47
|
+
onDelete={
|
|
48
|
+
onDelete ||
|
|
49
|
+
((event: React.MouseEvent<HTMLButtonElement>) =>
|
|
50
|
+
setOpenEl(event.currentTarget.parentElement))
|
|
51
|
+
}
|
|
52
|
+
onClick={(event: React.MouseEvent<HTMLButtonElement>) => {
|
|
48
53
|
setOpenEl(event.currentTarget)
|
|
49
54
|
}}
|
|
50
55
|
deleteIcon={deleteIcon}
|
|
51
56
|
{...chipProps}
|
|
52
57
|
label={selectedLabel ?? label}
|
|
53
|
-
className={`${classes.chip} ${chipProps.className ?? ''} ${
|
|
54
|
-
selectedAndMenuHidden ? 'MuiChip-selected' : ''
|
|
55
|
-
}`}
|
|
56
|
-
sx={[
|
|
57
|
-
{ bgcolor: 'background.default' },
|
|
58
|
-
selectedAndMenuHidden &&
|
|
59
|
-
((theme) => ({
|
|
60
|
-
borderColor: 'text.primary',
|
|
61
|
-
color: 'text.primary',
|
|
62
|
-
'&:hover': {
|
|
63
|
-
background: `${theme.palette.background.default} !important`,
|
|
64
|
-
borderColor: `${theme.palette.divider} !important`,
|
|
65
|
-
},
|
|
66
|
-
'&:focus': {
|
|
67
|
-
background: `${theme.palette.background.paper} !important`,
|
|
68
|
-
},
|
|
69
|
-
})),
|
|
70
|
-
]}
|
|
71
58
|
/>
|
|
72
59
|
|
|
73
60
|
<Menu
|
|
@@ -110,5 +97,3 @@ export function ChipMenu(props: ChipMenuProps) {
|
|
|
110
97
|
</>
|
|
111
98
|
)
|
|
112
99
|
}
|
|
113
|
-
|
|
114
|
-
ChipMenu.selectors = selectors
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, SxProps, Theme, Typography } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Row } from '../Row'
|
|
3
|
+
import { Row } from '../Row/Row'
|
|
4
4
|
import { extendableComponent } from '../Styles'
|
|
5
5
|
|
|
6
6
|
const { selectors, classes } = extendableComponent('ContainerWithHeader', [
|
|
File without changes
|
package/Footer/Footer.tsx
CHANGED
|
@@ -35,23 +35,22 @@ export function Footer(props: FooterProps) {
|
|
|
35
35
|
borderTop: `1px solid ${theme.palette.divider}`,
|
|
36
36
|
display: 'grid',
|
|
37
37
|
alignItems: 'center',
|
|
38
|
-
|
|
39
38
|
padding: `${theme.spacings.lg} ${theme.page.horizontal} ${theme.page.vertical}`,
|
|
40
39
|
justifyItems: 'center',
|
|
41
40
|
gridTemplateAreas: `
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
gap: theme.spacings.
|
|
41
|
+
'switcher switcher'
|
|
42
|
+
'support support'
|
|
43
|
+
'social social'
|
|
44
|
+
'links links'
|
|
45
|
+
`,
|
|
46
|
+
gap: theme.spacings.sm,
|
|
48
47
|
'& > *': { maxWidth: 'max-content' },
|
|
49
48
|
|
|
50
49
|
[theme.breakpoints.up('sm')]: {
|
|
51
50
|
gridTemplateAreas: `
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
'social switcher'
|
|
52
|
+
'links support'
|
|
53
|
+
`,
|
|
55
54
|
justifyItems: 'start',
|
|
56
55
|
padding: `${theme.page.vertical} ${theme.page.horizontal}`,
|
|
57
56
|
gridTemplateColumns: 'auto auto',
|
|
@@ -13,7 +13,7 @@ import { m, useDomEvent, useMotionValue } from 'framer-motion'
|
|
|
13
13
|
import { useRouter } from 'next/router'
|
|
14
14
|
import React, { useEffect, useRef } from 'react'
|
|
15
15
|
import { IconSvg } from '../IconSvg'
|
|
16
|
-
import { Row } from '../Row'
|
|
16
|
+
import { Row } from '../Row/Row'
|
|
17
17
|
import { extendableComponent } from '../Styles'
|
|
18
18
|
import { responsiveVal } from '../Styles/responsiveVal'
|
|
19
19
|
import { iconChevronLeft, iconChevronRight, iconFullscreen, iconFullscreenExit } from '../icons'
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { Box, SxProps, Theme } from '@mui/material'
|
|
9
9
|
import { ReactNode } from 'react'
|
|
10
10
|
import { IconSvg } from '../IconSvg'
|
|
11
|
-
import { Row } from '../Row'
|
|
11
|
+
import { Row } from '../Row/Row'
|
|
12
12
|
import { extendableComponent } from '../Styles/extendableComponent'
|
|
13
13
|
import { responsiveVal } from '../Styles/responsiveVal'
|
|
14
14
|
import { iconChevronLeft, iconChevronRight } from '../icons'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Box, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { extendableComponent } from '../../Styles'
|
|
4
|
-
import LayoutHeaderBack,
|
|
5
|
-
import LayoutHeaderClose,
|
|
6
|
-
import LayoutHeaderContent,
|
|
4
|
+
import { LayoutHeaderBack, useShowBack } from './LayoutHeaderBack'
|
|
5
|
+
import { LayoutHeaderClose, useShowClose } from './LayoutHeaderClose'
|
|
6
|
+
import { LayoutHeaderContent, LayoutHeaderContentProps } from './LayoutHeaderContent'
|
|
7
7
|
import { FloatingProps } from './LayoutHeadertypes'
|
|
8
8
|
|
|
9
9
|
export type LayoutHeaderProps = FloatingProps &
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useUp, usePrevUp, usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { t } from '@lingui/macro'
|
|
3
|
-
import { Box } from '@mui/material'
|
|
3
|
+
import { Box, SxProps, Theme } from '@mui/material'
|
|
4
4
|
import PageLink from 'next/link'
|
|
5
5
|
import { useRouter } from 'next/router'
|
|
6
6
|
import { LinkOrButton, LinkOrButtonProps } from '../../Button/LinkOrButton'
|
|
7
7
|
import { IconSvg } from '../../IconSvg'
|
|
8
|
+
import { responsiveVal } from '../../Styles'
|
|
8
9
|
import { iconChevronLeft } from '../../icons'
|
|
9
10
|
|
|
10
11
|
export type BackProps = Omit<LinkOrButtonProps, 'onClick' | 'children'>
|
|
@@ -22,7 +23,20 @@ export function useShowBack() {
|
|
|
22
23
|
return false
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
const buttonSx: SxProps<Theme> = (theme) => ({
|
|
27
|
+
'&:not(.Mui-disabled)': { boxShadow: 6 },
|
|
28
|
+
[theme.breakpoints.down('md')]: {
|
|
29
|
+
minWidth: 'auto',
|
|
30
|
+
paddingLeft: responsiveVal(8, 11),
|
|
31
|
+
paddingRight: responsiveVal(8, 11),
|
|
32
|
+
'& .MuiButton-startIcon': {
|
|
33
|
+
marginRight: 0,
|
|
34
|
+
marginLeft: 0,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
export function LayoutHeaderBack(props: BackProps) {
|
|
26
40
|
const router = useRouter()
|
|
27
41
|
const path = router.asPath.split('?')[0]
|
|
28
42
|
const up = useUp()
|
|
@@ -40,7 +54,7 @@ export default function LayoutHeaderBack(props: BackProps) {
|
|
|
40
54
|
return (
|
|
41
55
|
<LinkOrButton
|
|
42
56
|
onClick={() => router.back()}
|
|
43
|
-
button={{ variant: 'pill' }}
|
|
57
|
+
button={{ variant: 'pill', sx: buttonSx }}
|
|
44
58
|
color='inherit'
|
|
45
59
|
startIcon={backIcon}
|
|
46
60
|
aria-label={label}
|
|
@@ -57,7 +71,7 @@ export default function LayoutHeaderBack(props: BackProps) {
|
|
|
57
71
|
return (
|
|
58
72
|
<PageLink href={up.href} passHref>
|
|
59
73
|
<LinkOrButton
|
|
60
|
-
button={{ variant: 'pill' }}
|
|
74
|
+
button={{ variant: 'pill', sx: buttonSx }}
|
|
61
75
|
startIcon={backIcon}
|
|
62
76
|
aria-label={up.title}
|
|
63
77
|
color='inherit'
|
|
@@ -20,7 +20,7 @@ const name = 'LayoutHeaderContent' as const
|
|
|
20
20
|
const parts = ['bg', 'content', 'left', 'center', 'right', 'divider'] as const
|
|
21
21
|
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export function LayoutHeaderContent(props: LayoutHeaderContentProps) {
|
|
24
24
|
const ref = useRef<HTMLDivElement>(null)
|
|
25
25
|
|
|
26
26
|
const {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { MotionValue } from 'framer-motion'
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
|
-
import layoutContext from '../context/layoutContext'
|
|
3
|
+
import { layoutContext } from '../context/layoutContext'
|
|
4
4
|
|
|
5
5
|
export type LayoutProviderProps = {
|
|
6
6
|
children: React.ReactNode
|
|
7
7
|
scroll: MotionValue<number>
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export function LayoutProvider(props: LayoutProviderProps) {
|
|
11
11
|
const { children, scroll } = props
|
|
12
12
|
return (
|
|
13
13
|
<layoutContext.Provider value={useMemo(() => ({ scroll }), [scroll])}>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { LayoutContext } from '../types'
|
|
3
3
|
|
|
4
|
-
const layoutContext = React.createContext(undefined as unknown as LayoutContext)
|
|
4
|
+
export const layoutContext = React.createContext(undefined as unknown as LayoutContext)
|
|
5
5
|
layoutContext.displayName = 'layoutContext'
|
|
6
|
-
|
|
7
|
-
export default layoutContext
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useScrollOffset } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { Box, SxProps, Theme } from '@mui/material'
|
|
3
3
|
import { useTransform, useViewportScroll } from 'framer-motion'
|
|
4
|
-
import LayoutProvider from '../../Layout/components/LayoutProvider'
|
|
5
|
-
import { extendableComponent
|
|
4
|
+
import { LayoutProvider } from '../../Layout/components/LayoutProvider'
|
|
5
|
+
import { extendableComponent } from '../../Styles'
|
|
6
6
|
import { useFabSize } from '../../Theme'
|
|
7
7
|
|
|
8
8
|
export type LayoutDefaultProps = {
|
|
@@ -27,7 +27,17 @@ const { withState } = extendableComponent<OwnerState, 'LayoutDefault', typeof pa
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
export function LayoutDefault(props: LayoutDefaultProps) {
|
|
30
|
-
const {
|
|
30
|
+
const {
|
|
31
|
+
children,
|
|
32
|
+
header,
|
|
33
|
+
beforeHeader,
|
|
34
|
+
footer,
|
|
35
|
+
menuFab,
|
|
36
|
+
cartFab,
|
|
37
|
+
noSticky,
|
|
38
|
+
className,
|
|
39
|
+
sx = [],
|
|
40
|
+
} = props
|
|
31
41
|
|
|
32
42
|
const offset = useScrollOffset().y
|
|
33
43
|
const scrollWithOffset = useTransform(useViewportScroll().scrollY, (y) => y + offset)
|
|
@@ -38,7 +48,7 @@ export function LayoutDefault(props: LayoutDefaultProps) {
|
|
|
38
48
|
|
|
39
49
|
return (
|
|
40
50
|
<Box
|
|
41
|
-
className={classes.root}
|
|
51
|
+
className={`${classes.root} ${className ?? ''}`}
|
|
42
52
|
sx={[
|
|
43
53
|
(theme) => ({
|
|
44
54
|
minHeight: '100vh',
|
|
@@ -4,7 +4,7 @@ import { useElementScroll, useIsomorphicLayoutEffect } from '@graphcommerce/fram
|
|
|
4
4
|
import { Box, styled, SxProps, Theme } from '@mui/material'
|
|
5
5
|
import { m, useDomEvent, useMotionValue, usePresence, useTransform } from 'framer-motion'
|
|
6
6
|
import React, { useCallback, useEffect, useRef } from 'react'
|
|
7
|
-
import LayoutProvider from '../../Layout/components/LayoutProvider'
|
|
7
|
+
import { LayoutProvider } from '../../Layout/components/LayoutProvider'
|
|
8
8
|
import { extendableComponent } from '../../Styles'
|
|
9
9
|
import { useOverlayPosition } from '../hooks/useOverlayPosition'
|
|
10
10
|
|
|
@@ -341,7 +341,7 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
|
|
|
341
341
|
* padding we'll run into the issue that the user can't scroll to the bottom. We
|
|
342
342
|
* can't change this value with JS as that causes much jank
|
|
343
343
|
*/
|
|
344
|
-
'&.sizeSmFull, &.sizeSmMinimal': { paddingBottom:
|
|
344
|
+
'&.sizeSmFull, &.sizeSmMinimal': { paddingBottom: '56px' },
|
|
345
345
|
'&.variantSmBottom.sizeSmFull': {
|
|
346
346
|
minHeight: `calc(100vh - ${theme.appShell.headerHeightSm} * 0.5)`,
|
|
347
347
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Badge, BadgeProps } from '@mui/material'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/** Note: This should _only_ be used on the Desktop, use a standard Badge for other usecases. */
|
|
4
4
|
export function DesktopHeaderBadge(props: BadgeProps) {
|
|
5
5
|
const { sx = false } = props
|
|
6
6
|
return (
|
package/LayoutParts/MenuFab.tsx
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMotionValueValue } from '@graphcommerce/framer-utils'
|
|
2
|
+
import {
|
|
3
|
+
Divider,
|
|
4
|
+
Fab,
|
|
5
|
+
ListItem,
|
|
6
|
+
Menu,
|
|
7
|
+
styled,
|
|
8
|
+
Box,
|
|
9
|
+
SxProps,
|
|
10
|
+
Theme,
|
|
11
|
+
FabProps,
|
|
12
|
+
MenuProps as MenuPropsType,
|
|
13
|
+
} from '@mui/material'
|
|
2
14
|
import { m } from 'framer-motion'
|
|
3
15
|
import { useRouter } from 'next/router'
|
|
4
16
|
import React, { useEffect } from 'react'
|
|
5
17
|
import { IconSvg } from '../IconSvg'
|
|
18
|
+
import { useScrollY } from '../Layout/hooks/useScrollY'
|
|
6
19
|
import { extendableComponent } from '../Styles/extendableComponent'
|
|
7
20
|
import { responsiveVal } from '../Styles/responsiveVal'
|
|
8
21
|
import { useFabSize } from '../Theme'
|
|
@@ -18,21 +31,34 @@ export type MenuFabProps = {
|
|
|
18
31
|
menuIcon?: React.ReactNode
|
|
19
32
|
closeIcon?: React.ReactNode
|
|
20
33
|
sx?: SxProps<Theme>
|
|
34
|
+
MenuProps?: MenuPropsType
|
|
35
|
+
} & Pick<FabProps, 'color' | 'size' | 'variant'>
|
|
36
|
+
|
|
37
|
+
const name = 'MenuFab'
|
|
38
|
+
const parts = ['wrapper', 'fab', 'shadow', 'menu'] as const
|
|
39
|
+
type OwnerState = {
|
|
40
|
+
scrolled: boolean
|
|
21
41
|
}
|
|
22
42
|
|
|
23
|
-
const {
|
|
24
|
-
'wrapper',
|
|
25
|
-
'fab',
|
|
26
|
-
'shadow',
|
|
27
|
-
'menu',
|
|
28
|
-
] as const)
|
|
43
|
+
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
29
44
|
|
|
30
45
|
export function MenuFab(props: MenuFabProps) {
|
|
31
|
-
const {
|
|
46
|
+
const {
|
|
47
|
+
children,
|
|
48
|
+
secondary,
|
|
49
|
+
search,
|
|
50
|
+
menuIcon,
|
|
51
|
+
closeIcon,
|
|
52
|
+
sx = [],
|
|
53
|
+
MenuProps,
|
|
54
|
+
...fabProps
|
|
55
|
+
} = props
|
|
32
56
|
const router = useRouter()
|
|
33
57
|
const [openEl, setOpenEl] = React.useState<null | HTMLElement>(null)
|
|
34
58
|
|
|
35
59
|
const { opacity, scale, shadowOpacity } = useFabAnimation()
|
|
60
|
+
const scrollY = useScrollY()
|
|
61
|
+
const scrolled = useMotionValueValue(scrollY, (y) => y > 10)
|
|
36
62
|
|
|
37
63
|
useEffect(() => {
|
|
38
64
|
const clear = () => setOpenEl(null)
|
|
@@ -41,8 +67,15 @@ export function MenuFab(props: MenuFabProps) {
|
|
|
41
67
|
}, [router])
|
|
42
68
|
const fabIconSize = useFabSize('responsive')
|
|
43
69
|
|
|
70
|
+
const classes = withState({ scrolled })
|
|
71
|
+
|
|
44
72
|
return (
|
|
45
|
-
<Box
|
|
73
|
+
<Box
|
|
74
|
+
sx={[
|
|
75
|
+
{ position: 'relative', width: fabIconSize, height: fabIconSize },
|
|
76
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
77
|
+
]}
|
|
78
|
+
>
|
|
46
79
|
<MotionDiv
|
|
47
80
|
className={classes.wrapper}
|
|
48
81
|
sx={(theme) => ({
|
|
@@ -54,6 +87,8 @@ export function MenuFab(props: MenuFabProps) {
|
|
|
54
87
|
style={{ scale, opacity }}
|
|
55
88
|
>
|
|
56
89
|
<Fab
|
|
90
|
+
// todo: replace color='inverted' and remove styles here when Fab color is extendable
|
|
91
|
+
// https://github.com/mui/material-ui/blob/master/packages/mui-material/src/Fab/Fab.js#L193-L202
|
|
57
92
|
color='inherit'
|
|
58
93
|
aria-label='Open Menu'
|
|
59
94
|
onClick={(event) => setOpenEl(event.currentTarget)}
|
|
@@ -69,6 +104,7 @@ export function MenuFab(props: MenuFabProps) {
|
|
|
69
104
|
color: theme.palette.background.paper,
|
|
70
105
|
})}
|
|
71
106
|
className={classes.fab}
|
|
107
|
+
{...fabProps}
|
|
72
108
|
>
|
|
73
109
|
{closeIcon ?? (
|
|
74
110
|
<IconSvg src={iconClose} size='large' sx={{ display: openEl ? 'block' : 'none' }} />
|
|
@@ -102,6 +138,7 @@ export function MenuFab(props: MenuFabProps) {
|
|
|
102
138
|
PaperProps={{
|
|
103
139
|
sx: (theme) => ({
|
|
104
140
|
backgroundColor: theme.palette.background.paper,
|
|
141
|
+
backgroundImage: 'unset',
|
|
105
142
|
color: theme.palette.text.primary,
|
|
106
143
|
minWidth: responsiveVal(200, 280),
|
|
107
144
|
marginTop: '12px',
|
|
@@ -112,6 +149,7 @@ export function MenuFab(props: MenuFabProps) {
|
|
|
112
149
|
}}
|
|
113
150
|
className={classes.menu}
|
|
114
151
|
MenuListProps={{ dense: true }}
|
|
152
|
+
{...MenuProps}
|
|
115
153
|
>
|
|
116
154
|
{[
|
|
117
155
|
search ? (
|
|
@@ -128,4 +166,3 @@ export function MenuFab(props: MenuFabProps) {
|
|
|
128
166
|
</Box>
|
|
129
167
|
)
|
|
130
168
|
}
|
|
131
|
-
MenuFab.selectors = selectors
|
package/Page/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ParsedUrlQuery } from 'querystring'
|
|
2
2
|
import { UpPage } from '@graphcommerce/framer-next-pages/types'
|
|
3
3
|
// todo: remove references to GraphQL
|
|
4
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
5
|
import { NormalizedCacheObject } from '@graphcommerce/graphql'
|
|
5
6
|
import { GetStaticProps as GetStaticPropsNext } from 'next'
|
|
6
7
|
|
|
File without changes
|
|
@@ -37,7 +37,16 @@ export function useCanonical(incomming?: Canonical) {
|
|
|
37
37
|
|
|
38
38
|
if (!canonical) return canonical
|
|
39
39
|
|
|
40
|
-
if (canonical
|
|
40
|
+
if (!canonical.startsWith('http') && !canonical.startsWith('/')) {
|
|
41
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
42
|
+
console.warn(
|
|
43
|
+
`canonical is relative (${canonical}), a canonical must start with '/', 'http://' or 'https://'`,
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
canonical = `/${canonical}`
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (canonical.startsWith('/')) {
|
|
41
50
|
if (!process.env.NEXT_PUBLIC_SITE_URL) {
|
|
42
51
|
if (process.env.NODE_ENV !== 'production') {
|
|
43
52
|
throw Error('NEXT_PUBLIC_SITE_URL is not defined in .env')
|
|
@@ -59,7 +68,7 @@ export function useCanonical(incomming?: Canonical) {
|
|
|
59
68
|
canonical = `${process.env.NEXT_PUBLIC_SITE_URL}${href}`
|
|
60
69
|
}
|
|
61
70
|
|
|
62
|
-
if (
|
|
71
|
+
if (!canonical.startsWith('http')) {
|
|
63
72
|
if (process.env.NODE_ENV !== 'production') {
|
|
64
73
|
throw new Error(
|
|
65
74
|
`canonical must start with '/', 'http://' or 'https://', '${canonical}' given`,
|
|
File without changes
|
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Box, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import {
|
|
4
|
-
import { SectionContainer } from '../../SectionContainer'
|
|
3
|
+
import { SectionContainer } from '../../SectionContainer/SectionContainer'
|
|
5
4
|
import { extendableComponent } from '../../Styles'
|
|
6
5
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
6
|
+
import { Row } from '../Row'
|
|
7
7
|
|
|
8
8
|
export type ButtonLinkListProps = {
|
|
9
9
|
title: string
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, ContainerProps } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Row } from '..'
|
|
4
3
|
import { extendableComponent } from '../../Styles'
|
|
4
|
+
import { Row } from '../Row'
|
|
5
5
|
|
|
6
6
|
const compName = 'ColumnThree' as const
|
|
7
7
|
const parts = ['root', 'colOne', 'colTwo', 'colThree'] as const
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, ContainerProps } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Row } from '..'
|
|
4
3
|
import { extendableComponent } from '../../Styles'
|
|
4
|
+
import { Row } from '../Row'
|
|
5
5
|
|
|
6
6
|
export type ColumnTwoProps = Omit<ContainerProps, 'children'> & {
|
|
7
7
|
colOneContent: React.ReactNode
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, ContainerProps } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Row } from '..'
|
|
4
3
|
import { extendableComponent } from '../../Styles'
|
|
4
|
+
import { Row } from '../Row'
|
|
5
5
|
|
|
6
6
|
export type ColumnTwoWithTopProps = ContainerProps & {
|
|
7
7
|
top: React.ReactNode
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ContainerProps, useTheme, useMediaQuery, Box, styled } from '@mui/material'
|
|
2
2
|
import { m, useTransform } from 'framer-motion'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { Row } from '..'
|
|
5
4
|
import { useScrollY } from '../../Layout/hooks/useScrollY'
|
|
6
5
|
import { extendableComponent } from '../../Styles'
|
|
7
6
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
7
|
+
import { Row } from '../Row'
|
|
8
8
|
|
|
9
9
|
export type HeroBannerProps = ContainerProps & {
|
|
10
10
|
pageLinks: React.ReactNode
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Box, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Row } from '..'
|
|
4
3
|
import { extendableComponent } from '../../Styles'
|
|
5
4
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
5
|
+
import { Row } from '../Row'
|
|
6
6
|
|
|
7
7
|
export type IconBlocksProps = {
|
|
8
8
|
title: string
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Box, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Row } from '..'
|
|
4
3
|
import { extendableComponent } from '../../Styles'
|
|
5
4
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
5
|
+
import { Row } from '../Row'
|
|
6
6
|
|
|
7
7
|
export type ImageTextProps = {
|
|
8
8
|
item?: React.ReactNode
|
|
@@ -29,7 +29,7 @@ export function ImageText(props: ImageTextProps) {
|
|
|
29
29
|
: theme.palette.background.paper,
|
|
30
30
|
justifyItems: 'center',
|
|
31
31
|
columnGap: theme.spacings.lg,
|
|
32
|
-
|
|
32
|
+
marginTop: theme.spacings.lg,
|
|
33
33
|
paddingBottom: theme.spacings.lg,
|
|
34
34
|
[theme.breakpoints.up('md')]: {
|
|
35
35
|
paddingTop: 0,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Box, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Row } from '..'
|
|
4
3
|
import { extendableComponent } from '../../Styles'
|
|
5
4
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
5
|
+
import { Row } from '../Row'
|
|
6
6
|
|
|
7
7
|
export type ImageTextBoxedProps = {
|
|
8
8
|
children: React.ReactNode
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, ContainerProps } from '@mui/material'
|
|
2
|
-
import { Row } from '..'
|
|
3
2
|
import { extendableComponent } from '../../Styles'
|
|
4
3
|
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
4
|
+
import { Row } from '../Row'
|
|
5
5
|
|
|
6
6
|
export type ParagraphWithSidebarSlideProps = ContainerProps & {
|
|
7
7
|
slidingItems: React.ReactNode
|