@graphcommerce/next-ui 3.25.1 → 4.0.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 +497 -636
- 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 +21 -12
- 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 +131 -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 -35
- 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/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 +4 -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/index.ts +27 -81
- package/package.json +25 -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
package/IconHeader/index.tsx
CHANGED
|
@@ -1,70 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { SvgImageProps } from '../SvgImage'
|
|
5
|
-
import SvgImageSimple from '../SvgImage/SvgImageSimple'
|
|
1
|
+
import { Box, SxProps, Theme, Typography } from '@mui/material'
|
|
2
|
+
import { extendableComponent } from '../Styles'
|
|
3
|
+
import { SvgIcon, SvgIconProps } from '../SvgIcon/SvgIcon'
|
|
6
4
|
|
|
7
5
|
// TODO: remove all occurrences. deprecated component
|
|
8
6
|
|
|
9
|
-
const useStyles = makeStyles(
|
|
10
|
-
(theme: Theme) => ({
|
|
11
|
-
container: {
|
|
12
|
-
...theme.typography.subtitle1,
|
|
13
|
-
textAlign: 'center',
|
|
14
|
-
},
|
|
15
|
-
innerContainer: {
|
|
16
|
-
display: 'flex',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
justifyContent: 'center',
|
|
19
|
-
gap: 4,
|
|
20
|
-
},
|
|
21
|
-
breakColumnsDesktop: {
|
|
22
|
-
[theme.breakpoints.up('md')]: {
|
|
23
|
-
display: 'unset',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
margin: {
|
|
27
|
-
marginTop: theme.spacings.sm,
|
|
28
|
-
marginBottom: theme.spacings.sm,
|
|
29
|
-
},
|
|
30
|
-
ellipsis: {
|
|
31
|
-
whiteSpace: 'nowrap',
|
|
32
|
-
overflow: 'hidden',
|
|
33
|
-
textOverflow: 'ellipsis',
|
|
34
|
-
},
|
|
35
|
-
mediumFontWeight: {
|
|
36
|
-
fontWeight: 700,
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
{ name: 'IconHeader' },
|
|
40
|
-
)
|
|
41
|
-
|
|
42
7
|
export type IconHeaderSize = 'small' | 'medium' | 'large'
|
|
43
8
|
|
|
44
9
|
type IconHeaderProps = {
|
|
45
|
-
|
|
10
|
+
children: React.ReactNode
|
|
46
11
|
size?: IconHeaderSize
|
|
47
|
-
iconSize?: number
|
|
48
|
-
iconSizeMobile?: number
|
|
49
12
|
noMargin?: boolean
|
|
50
13
|
stayInline?: boolean
|
|
51
14
|
ellipsis?: boolean
|
|
52
|
-
|
|
15
|
+
sx?: SxProps<Theme>
|
|
16
|
+
} & Pick<SvgIconProps, 'src'>
|
|
53
17
|
|
|
54
18
|
type IconHeaderHeadings = 'h2' | 'h4' | 'h5'
|
|
55
19
|
|
|
56
|
-
|
|
20
|
+
const { classes, selectors } = extendableComponent('IconHeader', [
|
|
21
|
+
'root',
|
|
22
|
+
'container',
|
|
23
|
+
'innerContainer',
|
|
24
|
+
'breakColumnsDesktop',
|
|
25
|
+
'margin',
|
|
26
|
+
'ellipsis',
|
|
27
|
+
'mediumFontWeight',
|
|
28
|
+
] as const)
|
|
29
|
+
|
|
30
|
+
export function IconHeader(props: IconHeaderProps) {
|
|
57
31
|
const {
|
|
58
|
-
|
|
32
|
+
children,
|
|
59
33
|
size = 'large',
|
|
60
34
|
stayInline = false,
|
|
61
35
|
noMargin = false,
|
|
62
36
|
ellipsis = false,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
...svgImageProps
|
|
37
|
+
src,
|
|
38
|
+
sx = [],
|
|
66
39
|
} = props
|
|
67
|
-
const classes = useStyles()
|
|
68
40
|
|
|
69
41
|
const variants: Record<IconHeaderSize, IconHeaderHeadings> = {
|
|
70
42
|
small: 'h5',
|
|
@@ -73,20 +45,53 @@ export default function IconHeader(props: IconHeaderProps) {
|
|
|
73
45
|
}
|
|
74
46
|
|
|
75
47
|
return (
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
48
|
+
<Box
|
|
49
|
+
className={classes.root}
|
|
50
|
+
sx={[
|
|
51
|
+
{
|
|
52
|
+
typography: 'subtitle1',
|
|
53
|
+
textAlign: 'center',
|
|
54
|
+
},
|
|
55
|
+
!noMargin &&
|
|
56
|
+
((theme) => ({
|
|
57
|
+
marginTop: theme.spacings.sm,
|
|
58
|
+
marginBottom: theme.spacings.sm,
|
|
59
|
+
})),
|
|
60
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
61
|
+
]}
|
|
62
|
+
>
|
|
63
|
+
<Box
|
|
64
|
+
className={`${classes.innerContainer} ${!stayInline ? classes.breakColumnsDesktop : ''}`}
|
|
65
|
+
sx={[
|
|
66
|
+
{
|
|
67
|
+
display: { xs: 'flex', md: stayInline ? 'flex' : 'unset' },
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
gap: 4,
|
|
71
|
+
},
|
|
72
|
+
]}
|
|
73
|
+
>
|
|
74
|
+
<SvgIcon src={src} />
|
|
79
75
|
<Typography
|
|
80
76
|
variant={variants[size]}
|
|
81
77
|
component='h2'
|
|
82
|
-
className={
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
className={`${ellipsis ? classes.ellipsis : ''} ${
|
|
79
|
+
size === 'medium' ? classes.mediumFontWeight : ''
|
|
80
|
+
}`}
|
|
81
|
+
sx={[
|
|
82
|
+
ellipsis && {
|
|
83
|
+
whiteSpace: 'nowrap',
|
|
84
|
+
overflow: 'hidden',
|
|
85
|
+
textOverflow: 'ellipsis',
|
|
86
|
+
},
|
|
87
|
+
size === 'medium' && { fontWeight: 'bold' },
|
|
88
|
+
]}
|
|
86
89
|
>
|
|
87
|
-
{
|
|
90
|
+
{children}
|
|
88
91
|
</Typography>
|
|
89
|
-
</
|
|
90
|
-
</
|
|
92
|
+
</Box>
|
|
93
|
+
</Box>
|
|
91
94
|
)
|
|
92
95
|
}
|
|
96
|
+
|
|
97
|
+
IconHeader.selectors = selectors
|
package/JsonLd/index.tsx
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import Head from 'next/head'
|
|
2
|
-
import React from 'react'
|
|
3
2
|
import { jsonLdScriptProps } from 'react-schemaorg'
|
|
4
3
|
import { Thing, WithContext } from 'schema-dts'
|
|
5
4
|
|
|
5
|
+
export * as SchemaDts from 'schema-dts'
|
|
6
|
+
|
|
6
7
|
export type JsonLdProps<T extends Thing> = {
|
|
7
8
|
item: WithContext<T>
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export
|
|
11
|
+
export function JsonLd<T extends Thing>(props: JsonLdProps<T>) {
|
|
11
12
|
const { item } = props
|
|
12
13
|
|
|
13
14
|
return (
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Box, SxProps, Theme } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import { extendableComponent } from '../../Styles'
|
|
4
4
|
import LayoutHeaderBack, { useShowBack } from './LayoutHeaderBack'
|
|
5
5
|
import LayoutHeaderClose, { useShowClose } from './LayoutHeaderClose'
|
|
6
|
-
import LayoutHeaderContent, {
|
|
6
|
+
import LayoutHeaderContent, { LayoutHeaderContentProps } from './LayoutHeaderContent'
|
|
7
7
|
import { FloatingProps } from './LayoutHeadertypes'
|
|
8
8
|
|
|
9
9
|
export type LayoutHeaderProps = FloatingProps &
|
|
10
|
-
Omit<
|
|
10
|
+
Omit<LayoutHeaderContentProps, 'left' | 'right'> & {
|
|
11
11
|
/**
|
|
12
12
|
* Button to display on the left side of the title
|
|
13
13
|
*
|
|
@@ -24,79 +24,25 @@ export type LayoutHeaderProps = FloatingProps &
|
|
|
24
24
|
secondary?: React.ReactNode
|
|
25
25
|
|
|
26
26
|
noAlign?: boolean
|
|
27
|
+
|
|
28
|
+
sx?: SxProps<Theme>
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
marginBottom: `calc(${theme.appShell.appBarHeightMd} * -1 - calc((${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * -0.5))`,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
stickyNoChildren: {
|
|
44
|
-
zIndex: theme.zIndex.appBar - 2,
|
|
45
|
-
},
|
|
46
|
-
stickyVisibleSm: {
|
|
47
|
-
[theme.breakpoints.down('sm')]: {
|
|
48
|
-
top: 0,
|
|
49
|
-
marginTop: `calc(${theme.appShell.headerHeightSm} * -1)`,
|
|
50
|
-
height: theme.appShell.headerHeightSm,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
stickyFloatingSm: {
|
|
54
|
-
[theme.breakpoints.down('sm')]: {
|
|
55
|
-
top: 0,
|
|
56
|
-
marginTop: `calc(${theme.appShell.headerHeightSm} * -1)`,
|
|
57
|
-
height: theme.appShell.headerHeightSm,
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
stickyFloatingMd: {
|
|
61
|
-
[theme.breakpoints.up('md')]: {
|
|
62
|
-
top: `calc(${theme.appShell.headerHeightMd} + calc((${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * -0.5))`,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
stickyNoAlign: {
|
|
66
|
-
[theme.breakpoints.down('sm')]: {
|
|
67
|
-
position: 'sticky',
|
|
68
|
-
left: 0,
|
|
69
|
-
right: 0,
|
|
70
|
-
top: 0,
|
|
71
|
-
marginTop: 0,
|
|
72
|
-
height: theme.appShell.headerHeightSm,
|
|
73
|
-
marginBottom: `calc(${theme.appShell.headerHeightSm} * -1)`,
|
|
74
|
-
},
|
|
75
|
-
[theme.breakpoints.up('md')]: {
|
|
76
|
-
position: 'sticky',
|
|
77
|
-
left: 0,
|
|
78
|
-
right: 0,
|
|
79
|
-
top: 0,
|
|
80
|
-
marginTop: 0,
|
|
81
|
-
height: theme.appShell.appBarHeightMd,
|
|
82
|
-
marginBottom: `calc(${theme.appShell.appBarHeightMd} * -1)`,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
stickyDivider: {
|
|
86
|
-
[theme.breakpoints.down('sm')]: {
|
|
87
|
-
marginBottom: 0,
|
|
88
|
-
},
|
|
89
|
-
[theme.breakpoints.up('md')]: {
|
|
90
|
-
marginBottom: 0,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
}),
|
|
94
|
-
{ name: 'LayoutHeader' },
|
|
31
|
+
type ComponentStyleProps = {
|
|
32
|
+
noAlign: boolean
|
|
33
|
+
divider: boolean
|
|
34
|
+
children: boolean
|
|
35
|
+
floatingSm: boolean
|
|
36
|
+
floatingMd: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { selectors, withState } = extendableComponent<ComponentStyleProps, 'LayoutHeader'>(
|
|
40
|
+
'LayoutHeader',
|
|
41
|
+
['root'] as const,
|
|
95
42
|
)
|
|
96
43
|
|
|
97
44
|
export function LayoutHeader(props: LayoutHeaderProps) {
|
|
98
|
-
const { children, divider, primary, secondary, noAlign, switchPoint } = props
|
|
99
|
-
const classes = useStyles(props)
|
|
45
|
+
const { children, divider, primary, secondary, noAlign = false, switchPoint, sx = [] } = props
|
|
100
46
|
const showBack = useShowBack()
|
|
101
47
|
const showClose = useShowClose()
|
|
102
48
|
|
|
@@ -109,7 +55,7 @@ export function LayoutHeader(props: LayoutHeaderProps) {
|
|
|
109
55
|
if (divider || primary || secondary) floatingSm = false
|
|
110
56
|
|
|
111
57
|
const close = showClose && <LayoutHeaderClose />
|
|
112
|
-
const back = showBack && <LayoutHeaderBack
|
|
58
|
+
const back = showBack && <LayoutHeaderBack breakpoint={floatingSm ? 'xs' : undefined} />
|
|
113
59
|
|
|
114
60
|
let left = secondary
|
|
115
61
|
let right = primary
|
|
@@ -121,18 +67,66 @@ export function LayoutHeader(props: LayoutHeaderProps) {
|
|
|
121
67
|
|
|
122
68
|
if (!left && !right && !children) return null
|
|
123
69
|
|
|
124
|
-
const
|
|
70
|
+
const classes = withState({
|
|
125
71
|
floatingSm,
|
|
126
72
|
floatingMd,
|
|
127
|
-
visibleSm: !floatingSm,
|
|
128
|
-
visibleMd: !floatingMd,
|
|
129
|
-
noChildren: !children,
|
|
130
73
|
noAlign,
|
|
74
|
+
children: !!children,
|
|
131
75
|
divider: !!divider,
|
|
132
76
|
})
|
|
133
77
|
|
|
134
|
-
return
|
|
135
|
-
<
|
|
78
|
+
return (
|
|
79
|
+
<Box
|
|
80
|
+
className={classes.root}
|
|
81
|
+
sx={[
|
|
82
|
+
(theme) => ({
|
|
83
|
+
zIndex: children ? theme.zIndex.appBar : theme.zIndex.appBar - 2,
|
|
84
|
+
position: 'sticky',
|
|
85
|
+
pointerEvents: 'none',
|
|
86
|
+
|
|
87
|
+
[theme.breakpoints.down('md')]: {
|
|
88
|
+
top: 0,
|
|
89
|
+
marginTop: `calc(${theme.appShell.headerHeightSm} * -1)`,
|
|
90
|
+
height: theme.appShell.headerHeightSm,
|
|
91
|
+
'&.noAlign': {
|
|
92
|
+
position: 'sticky',
|
|
93
|
+
left: 0,
|
|
94
|
+
right: 0,
|
|
95
|
+
top: 0,
|
|
96
|
+
marginTop: 0,
|
|
97
|
+
height: theme.appShell.headerHeightSm,
|
|
98
|
+
marginBottom: `calc(${theme.appShell.headerHeightSm} * -1)`,
|
|
99
|
+
},
|
|
100
|
+
'&.divider': {
|
|
101
|
+
marginBottom: 0,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
[theme.breakpoints.up('md')]: {
|
|
106
|
+
top: 0,
|
|
107
|
+
height: theme.appShell.appBarHeightMd,
|
|
108
|
+
marginTop: `calc((${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * -0.5)`,
|
|
109
|
+
marginBottom: `calc(${theme.appShell.appBarHeightMd} * -1 - calc((${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * -0.5))`,
|
|
110
|
+
'&.floatingMd': {
|
|
111
|
+
top: `calc(${theme.appShell.headerHeightMd} + calc((${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * -0.5))`,
|
|
112
|
+
},
|
|
113
|
+
'&.noAlign': {
|
|
114
|
+
position: 'sticky',
|
|
115
|
+
left: 0,
|
|
116
|
+
right: 0,
|
|
117
|
+
top: 0,
|
|
118
|
+
marginTop: 0,
|
|
119
|
+
height: theme.appShell.appBarHeightMd,
|
|
120
|
+
marginBottom: `calc(${theme.appShell.appBarHeightMd} * -1)`,
|
|
121
|
+
},
|
|
122
|
+
'&.divider': {
|
|
123
|
+
marginBottom: 0,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
128
|
+
]}
|
|
129
|
+
>
|
|
136
130
|
<LayoutHeaderContent
|
|
137
131
|
left={left}
|
|
138
132
|
right={right}
|
|
@@ -143,8 +137,7 @@ export function LayoutHeader(props: LayoutHeaderProps) {
|
|
|
143
137
|
>
|
|
144
138
|
{children}
|
|
145
139
|
</LayoutHeaderContent>
|
|
146
|
-
</
|
|
147
|
-
) : (
|
|
148
|
-
<></>
|
|
140
|
+
</Box>
|
|
149
141
|
)
|
|
150
142
|
}
|
|
143
|
+
LayoutHeader.selectors = selectors
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { useUp, usePrevUp, usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
|
+
import { usePrevPageRouter } from '@graphcommerce/framer-next-pages/hooks/usePrevPageRouter'
|
|
2
3
|
import { t } from '@lingui/macro'
|
|
3
4
|
import PageLink from 'next/link'
|
|
4
5
|
import { useRouter } from 'next/router'
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import SvgImageSimple from '../../SvgImage/SvgImageSimple'
|
|
6
|
+
import { LinkOrButton, LinkOrButtonProps } from '../../Button/LinkOrButton'
|
|
7
|
+
import { SvgIcon } from '../../SvgIcon/SvgIcon'
|
|
8
8
|
import { iconChevronLeft } from '../../icons'
|
|
9
|
-
import { usePrevPageRouter } from '@graphcommerce/framer-next-pages/hooks/usePrevPageRouter'
|
|
10
9
|
|
|
11
|
-
export type BackProps = Omit<
|
|
10
|
+
export type BackProps = Omit<LinkOrButtonProps, 'onClick' | 'children'>
|
|
12
11
|
|
|
13
12
|
export function useShowBack() {
|
|
14
13
|
const router = useRouter()
|
|
@@ -30,30 +29,40 @@ export default function LayoutHeaderBack(props: BackProps) {
|
|
|
30
29
|
const prevUp = usePrevUp()
|
|
31
30
|
const { backSteps } = usePageContext()
|
|
32
31
|
|
|
33
|
-
const backIcon = <
|
|
32
|
+
const backIcon = <SvgIcon src={iconChevronLeft} size='medium' />
|
|
34
33
|
const canClickBack = backSteps > 0 && router.asPath !== prevUp?.href
|
|
35
34
|
|
|
35
|
+
let label = t`Back`
|
|
36
|
+
if (up?.href === prevRouter?.asPath && up?.title) label = up.title
|
|
37
|
+
if (prevUp?.href === prevRouter?.asPath && prevUp?.title) label = prevUp.title
|
|
38
|
+
|
|
36
39
|
if (canClickBack) {
|
|
37
|
-
const label = up?.href === prevRouter?.asPath ? up?.title : t`Back`
|
|
38
40
|
return (
|
|
39
|
-
<
|
|
41
|
+
<LinkOrButton
|
|
40
42
|
onClick={() => router.back()}
|
|
41
|
-
variant
|
|
43
|
+
button={{ variant: 'pill' }}
|
|
44
|
+
color='inherit'
|
|
42
45
|
startIcon={backIcon}
|
|
43
46
|
aria-label={label}
|
|
44
47
|
{...props}
|
|
45
48
|
>
|
|
46
49
|
{label}
|
|
47
|
-
</
|
|
50
|
+
</LinkOrButton>
|
|
48
51
|
)
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
if (up?.href && up.href !== router.asPath)
|
|
52
55
|
return (
|
|
53
56
|
<PageLink href={up.href} passHref>
|
|
54
|
-
<
|
|
57
|
+
<LinkOrButton
|
|
58
|
+
button={{ variant: 'pill' }}
|
|
59
|
+
startIcon={backIcon}
|
|
60
|
+
aria-label={up.title}
|
|
61
|
+
color='inherit'
|
|
62
|
+
{...props}
|
|
63
|
+
>
|
|
55
64
|
{up.title}
|
|
56
|
-
</
|
|
65
|
+
</LinkOrButton>
|
|
57
66
|
</PageLink>
|
|
58
67
|
)
|
|
59
68
|
|
|
@@ -1,41 +1,28 @@
|
|
|
1
1
|
import { useGo, usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import Button from '../../Button'
|
|
4
|
-
import SvgImageSimple from '../../SvgImage/SvgImageSimple'
|
|
5
|
-
import { iconClose } from '../../icons'
|
|
6
|
-
import { makeStyles, Theme } from '@material-ui/core'
|
|
7
|
-
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
8
2
|
import { Trans } from '@lingui/macro'
|
|
3
|
+
import { LinkOrButton } from '../../Button/LinkOrButton'
|
|
4
|
+
import { SvgIcon } from '../../SvgIcon/SvgIcon'
|
|
5
|
+
import { iconClose } from '../../icons'
|
|
9
6
|
|
|
10
7
|
export function useShowClose() {
|
|
11
8
|
const { overlayGroup } = usePageContext()
|
|
12
9
|
return !!overlayGroup
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
const useStyles = makeStyles((theme: Theme) => ({
|
|
16
|
-
close: {
|
|
17
|
-
[theme.breakpoints.up('md')]: {
|
|
18
|
-
marginLeft: `calc(${responsiveVal(12, 22)} * -1)`,
|
|
19
|
-
marginRight: `calc(${responsiveVal(12, 22)} * -1)`,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}))
|
|
23
|
-
|
|
24
12
|
export default function LayoutHeaderClose() {
|
|
25
13
|
const { closeSteps } = usePageContext()
|
|
26
14
|
const onClick = useGo(closeSteps * -1)
|
|
27
|
-
const classes = useStyles()
|
|
28
15
|
|
|
29
16
|
return (
|
|
30
|
-
<
|
|
31
|
-
type
|
|
17
|
+
<LinkOrButton
|
|
18
|
+
button={{ type: 'button', variant: 'pill' }}
|
|
19
|
+
color='inherit'
|
|
32
20
|
onClick={onClick}
|
|
33
21
|
aria-label='Close'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
className={classes.close}
|
|
22
|
+
startIcon={<SvgIcon src={iconClose} />}
|
|
23
|
+
// className={classes.close}
|
|
37
24
|
>
|
|
38
25
|
<Trans>Close</Trans>
|
|
39
|
-
</
|
|
26
|
+
</LinkOrButton>
|
|
40
27
|
)
|
|
41
28
|
}
|