@graphcommerce/next-ui 3.25.3 → 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.
Files changed (138) hide show
  1. package/AnimatedRow/index.tsx +6 -3
  2. package/ApolloError/ApolloErrorAlert.tsx +20 -21
  3. package/ApolloError/ApolloErrorFullPage.tsx +3 -4
  4. package/ApolloError/ApolloErrorSnackbar.tsx +3 -3
  5. package/Blog/BlogAuthor/index.tsx +42 -48
  6. package/Blog/BlogContent/index.tsx +6 -23
  7. package/Blog/BlogHeader/index.tsx +26 -23
  8. package/Blog/BlogList/index.tsx +7 -25
  9. package/Blog/BlogListItem/index.tsx +63 -52
  10. package/Blog/BlogTags/BlogTag.tsx +27 -0
  11. package/Blog/BlogTags/index.tsx +7 -32
  12. package/Blog/BlogTitle/index.tsx +7 -21
  13. package/Button/Button.tsx +5 -0
  14. package/Button/LinkOrButton.tsx +80 -0
  15. package/Button/index.tsx +2 -177
  16. package/CHANGELOG.md +490 -651
  17. package/ChipMenu/index.tsx +71 -77
  18. package/ContainerWithHeader/index.tsx +33 -30
  19. package/FlagAvatar/index.tsx +2 -12
  20. package/Footer/Footer.tsx +105 -88
  21. package/Footer/index.ts +0 -1
  22. package/Form/Form.tsx +35 -0
  23. package/Form/FormActions.tsx +9 -14
  24. package/Form/FormDivider.tsx +8 -13
  25. package/Form/FormHeader.tsx +5 -26
  26. package/Form/FormRow.tsx +8 -13
  27. package/Form/InputCheckmark.tsx +9 -22
  28. package/FramerScroller/SidebarGallery.tsx +340 -0
  29. package/FramerScroller/SidebarSlider.tsx +107 -0
  30. package/FramerScroller/index.ts +2 -0
  31. package/FullPageMessage/index.tsx +52 -48
  32. package/Highlight/index.tsx +1 -1
  33. package/IconHeader/index.tsx +63 -58
  34. package/JsonLd/index.tsx +3 -2
  35. package/Layout/components/LayoutHeader.tsx +75 -82
  36. package/Layout/components/LayoutHeaderBack.tsx +21 -12
  37. package/Layout/components/LayoutHeaderClose.tsx +9 -22
  38. package/Layout/components/LayoutHeaderContent.tsx +190 -154
  39. package/Layout/components/LayoutHeadertypes.ts +1 -1
  40. package/Layout/components/LayoutTitle.tsx +60 -55
  41. package/LayoutDefault/components/LayoutDefault.tsx +96 -85
  42. package/LayoutOverlay/components/LayoutOverlay.tsx +2 -8
  43. package/LayoutOverlay/components/LayoutOverlayBase.tsx +233 -239
  44. package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
  45. package/LayoutParts/DesktopHeaderBadge.tsx +28 -0
  46. package/LayoutParts/DesktopNavActions.tsx +15 -0
  47. package/LayoutParts/DesktopNavBar.tsx +113 -0
  48. package/LayoutParts/DesktopNavBarItem.tsx +44 -0
  49. package/{AppShell → LayoutParts}/GlobalHead.tsx +1 -2
  50. package/LayoutParts/Logo.tsx +77 -0
  51. package/LayoutParts/MenuFab.tsx +131 -0
  52. package/LayoutParts/MenuFabItem.tsx +25 -0
  53. package/LayoutParts/MenuFabSecondaryItem.tsx +37 -0
  54. package/{AppShell/PlaceholderFab/index.tsx → LayoutParts/PlaceholderFab.tsx} +1 -1
  55. package/LayoutParts/StickyBelowHeader.tsx +25 -0
  56. package/LayoutParts/index.ts +12 -0
  57. package/{AppShell → LayoutParts}/useFabAnimation.ts +0 -0
  58. package/Page/CssAndFramerMotionProvider.tsx +21 -0
  59. package/Page/index.ts +2 -0
  60. package/Page/types.ts +2 -8
  61. package/PageLoadIndicator/index.tsx +25 -30
  62. package/PageMeta/index.tsx +1 -1
  63. package/Pagination/index.tsx +37 -54
  64. package/RenderType/index.tsx +1 -1
  65. package/Row/ButtonLinkList/ButtonLinkList.tsx +35 -37
  66. package/Row/ButtonLinkList/ButtonLinkListItem.tsx +16 -33
  67. package/Row/ColumnOne/index.tsx +5 -10
  68. package/Row/ColumnOneBoxed/index.tsx +18 -19
  69. package/Row/ColumnOneCentered/index.tsx +3 -4
  70. package/Row/ColumnThree/index.tsx +62 -57
  71. package/Row/ColumnTwo/index.tsx +37 -32
  72. package/Row/ColumnTwoSpread/index.tsx +28 -37
  73. package/Row/ColumnTwoWithTop/index.tsx +37 -43
  74. package/Row/ContentLinks/index.tsx +24 -25
  75. package/Row/HeroBanner/index.tsx +98 -82
  76. package/Row/IconBlocks/IconBlock/index.tsx +45 -37
  77. package/Row/IconBlocks/index.tsx +29 -44
  78. package/Row/ImageText/index.tsx +71 -67
  79. package/Row/ImageTextBoxed/index.tsx +66 -65
  80. package/Row/ParagraphWithSidebarSlide/index.tsx +80 -76
  81. package/Row/Quote/index.tsx +3 -3
  82. package/Row/SpecialBanner/index.tsx +97 -97
  83. package/Row/index.tsx +4 -9
  84. package/SectionContainer/index.tsx +32 -31
  85. package/SectionHeader/index.tsx +41 -43
  86. package/Separator/index.tsx +19 -18
  87. package/Snackbar/MessageSnackbar.tsx +1 -2
  88. package/Snackbar/MessageSnackbarImpl.tsx +68 -115
  89. package/StarRatingField/index.tsx +24 -25
  90. package/Stepper/Stepper.tsx +34 -32
  91. package/Styles/EmotionProvider.tsx +14 -0
  92. package/Styles/breakpointVal.tsx +16 -10
  93. package/Styles/extendableComponent.ts +70 -0
  94. package/Styles/index.tsx +9 -2
  95. package/Styles/withEmotionCache.tsx +36 -0
  96. package/Styles/withTheme.tsx +15 -24
  97. package/SvgIcon/SvgIcon.tsx +60 -0
  98. package/TextInputNumber/index.tsx +49 -50
  99. package/Theme/MuiButton.ts +128 -0
  100. package/Theme/MuiSlider.ts +28 -0
  101. package/Theme/MuiSnackbar.ts +31 -0
  102. package/Theme/{types.ts → createTheme.ts} +8 -2
  103. package/Theme/index.ts +4 -0
  104. package/Theme/themeDefaults.ts +51 -0
  105. package/TimeAgo/index.tsx +1 -1
  106. package/ToggleButton/index.tsx +43 -49
  107. package/ToggleButtonGroup/index.tsx +39 -39
  108. package/UspList/UspListItem.tsx +56 -46
  109. package/UspList/index.tsx +29 -26
  110. package/docs/building-components.mdx +3 -0
  111. package/docs/components/ComponentBasic.tsx +26 -0
  112. package/docs/components/ComponentChild.tsx +48 -0
  113. package/docs/components/ComponentChildVariant.tsx +54 -0
  114. package/docs/components/ComponentChildVariantExtendable.tsx +62 -0
  115. package/docs/components/ComponentStylable.tsx +32 -0
  116. package/docs/pages/building-components.tsx +62 -0
  117. package/index.ts +27 -81
  118. package/package.json +25 -27
  119. package/types.d.ts +1 -1
  120. package/AppShell/AppShellSticky/index.tsx +0 -38
  121. package/AppShell/DesktopNavActions.tsx +0 -32
  122. package/AppShell/DesktopNavBar.tsx +0 -158
  123. package/AppShell/Logo.tsx +0 -46
  124. package/AppShell/Menu.tsx +0 -7
  125. package/AppShell/MenuFab.tsx +0 -162
  126. package/AppShell/MenuFabSecondaryItem.tsx +0 -32
  127. package/AppShell/index.ts +0 -15
  128. package/AspectRatioContainer/index.tsx +0 -27
  129. package/Footer/SocialIcon.tsx +0 -23
  130. package/Form/index.tsx +0 -67
  131. package/FramerScroller/components/SidebarGallery.tsx +0 -317
  132. package/FramerScroller/components/SidebarSlider.tsx +0 -97
  133. package/Page/App.tsx +0 -17
  134. package/Page/Document.tsx +0 -24
  135. package/StyledBadge/index.tsx +0 -20
  136. package/Styles/classesPicker.ts +0 -41
  137. package/SvgImage/SvgImageSimple.tsx +0 -100
  138. package/SvgImage/index.tsx +0 -74
@@ -1,70 +1,42 @@
1
- import { makeStyles, Theme, Typography } from '@material-ui/core'
2
- import clsx from 'clsx'
3
- import React from 'react'
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
- title: string
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
- } & Pick<SvgImageProps, 'src' | 'alt'>
15
+ sx?: SxProps<Theme>
16
+ } & Pick<SvgIconProps, 'src'>
53
17
 
54
18
  type IconHeaderHeadings = 'h2' | 'h4' | 'h5'
55
19
 
56
- export default function IconHeader(props: IconHeaderProps) {
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
- title,
32
+ children,
59
33
  size = 'large',
60
34
  stayInline = false,
61
35
  noMargin = false,
62
36
  ellipsis = false,
63
- iconSize,
64
- iconSizeMobile,
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
- <div className={clsx(classes.container, !noMargin && classes.margin)}>
77
- <div className={clsx(classes.innerContainer, !stayInline && classes.breakColumnsDesktop)}>
78
- <SvgImageSimple {...svgImageProps} />
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={clsx(
83
- ellipsis && classes.ellipsis,
84
- size === 'medium' && classes.mediumFontWeight,
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
- {title}
90
+ {children}
88
91
  </Typography>
89
- </div>
90
- </div>
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 default function JsonLd<T extends Thing>(props: JsonLdProps<T>) {
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 { makeStyles, Theme } from '@material-ui/core'
1
+ import { Box, SxProps, Theme } from '@mui/material'
2
2
  import React from 'react'
3
- import { classesPicker } from '../../Styles/classesPicker'
3
+ import { extendableComponent } from '../../Styles'
4
4
  import LayoutHeaderBack, { useShowBack } from './LayoutHeaderBack'
5
5
  import LayoutHeaderClose, { useShowClose } from './LayoutHeaderClose'
6
- import LayoutHeaderContent, { ContentProps } from './LayoutHeaderContent'
6
+ import LayoutHeaderContent, { LayoutHeaderContentProps } from './LayoutHeaderContent'
7
7
  import { FloatingProps } from './LayoutHeadertypes'
8
8
 
9
9
  export type LayoutHeaderProps = FloatingProps &
10
- Omit<ContentProps, 'left' | 'right'> & {
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
- const useStyles = makeStyles(
30
- (theme: Theme) => ({
31
- sticky: {
32
- zIndex: theme.zIndex.appBar,
33
- position: 'sticky',
34
- pointerEvents: 'none',
35
-
36
- [theme.breakpoints.up('md')]: {
37
- top: 0,
38
- height: theme.appShell.appBarHeightMd,
39
- marginTop: `calc((${theme.appShell.appBarHeightMd} - ${theme.appShell.appBarInnerHeightMd}) * -0.5)`,
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 variant={floatingSm ? 'pill' : 'pill-link'} />
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 className = classesPicker(classes, {
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 children ? (
135
- <div {...className('sticky')}>
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
- </div>
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 React from 'react'
6
- import Button, { ButtonProps } from '../../Button'
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<ButtonProps, 'onClick' | 'children'>
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 = <SvgImageSimple src={iconChevronLeft} />
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
- <Button
41
+ <LinkOrButton
40
42
  onClick={() => router.back()}
41
- variant='pill-link'
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
- </Button>
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
- <Button variant='pill-link' startIcon={backIcon} aria-label={up.title} {...props}>
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
- </Button>
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
- <Button
31
- type='button'
17
+ <LinkOrButton
18
+ button={{ type: 'button', variant: 'pill' }}
19
+ color='inherit'
32
20
  onClick={onClick}
33
21
  aria-label='Close'
34
- variant='text'
35
- startIcon={<SvgImageSimple src={iconClose} />}
36
- className={classes.close}
22
+ startIcon={<SvgIcon src={iconClose} />}
23
+ // className={classes.close}
37
24
  >
38
25
  <Trans>Close</Trans>
39
- </Button>
26
+ </LinkOrButton>
40
27
  )
41
28
  }