@graphcommerce/next-ui 4.1.4 → 4.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1290](https://github.com/ho-nl/m2-pwa/pull/1290)
8
+ [`47ae012c1`](https://github.com/ho-nl/m2-pwa/commit/47ae012c10f5762f99019ec38409177632377a98)
9
+ Thanks [@paales](https://github.com/paales)! - `withTheme` didn’t apply styles correcty
10
+
11
+ * [#1290](https://github.com/ho-nl/m2-pwa/pull/1290)
12
+ [`39e28a4cd`](https://github.com/ho-nl/m2-pwa/commit/39e28a4cd6cdfaa4fc6dc4500ae86c14f7069150)
13
+ Thanks [@paales](https://github.com/paales)! - Allow background color on header
14
+
15
+ - [#1289](https://github.com/ho-nl/m2-pwa/pull/1289)
16
+ [`ec8026cc5`](https://github.com/ho-nl/m2-pwa/commit/ec8026cc5a5be8d97a6e5dbf208808154fa1d618)
17
+ Thanks [@LaurensFranken](https://github.com/LaurensFranken)! - add sx prop to UspsList component
18
+
19
+ * [#1290](https://github.com/ho-nl/m2-pwa/pull/1290)
20
+ [`35672d8e8`](https://github.com/ho-nl/m2-pwa/commit/35672d8e87011bf4eb049f449e86e851fc91a525)
21
+ Thanks [@paales](https://github.com/paales)! - Footer didn't accept sx prop
22
+
3
23
  ## 4.1.4
4
24
 
5
25
  ### Patch Changes
package/Footer/Footer.tsx CHANGED
@@ -18,39 +18,49 @@ const { classes, selectors } = extendableComponent('Footer', [
18
18
  ] as const)
19
19
 
20
20
  export function Footer(props: FooterProps) {
21
- const { socialLinks, storeSwitcher, customerService, copyright, ...containerProps } = props
21
+ const {
22
+ socialLinks,
23
+ storeSwitcher,
24
+ customerService,
25
+ copyright,
26
+ sx = [],
27
+ ...containerProps
28
+ } = props
22
29
 
23
30
  return (
24
31
  <Container
25
- sx={(theme) => ({
26
- gridTemplateColumns: '5fr 3fr',
27
- borderTop: `1px solid ${theme.palette.divider}`,
28
- display: 'grid',
29
- alignItems: 'center',
32
+ sx={[
33
+ (theme) => ({
34
+ gridTemplateColumns: '5fr 3fr',
35
+ borderTop: `1px solid ${theme.palette.divider}`,
36
+ display: 'grid',
37
+ alignItems: 'center',
30
38
 
31
- padding: `${theme.spacings.lg} ${theme.page.horizontal} ${theme.page.vertical}`,
32
- justifyItems: 'center',
33
- gridTemplateAreas: `
39
+ padding: `${theme.spacings.lg} ${theme.page.horizontal} ${theme.page.vertical}`,
40
+ justifyItems: 'center',
41
+ gridTemplateAreas: `
34
42
  'switcher switcher'
35
43
  'support support'
36
44
  'social social'
37
45
  'links links'
38
46
  `,
39
- gap: theme.spacings.md,
40
- '& > *': { maxWidth: 'max-content' },
47
+ gap: theme.spacings.md,
48
+ '& > *': { maxWidth: 'max-content' },
41
49
 
42
- [theme.breakpoints.up('sm')]: {
43
- gridTemplateAreas: `
50
+ [theme.breakpoints.up('sm')]: {
51
+ gridTemplateAreas: `
44
52
  'social switcher'
45
53
  'links support'
46
54
  `,
47
- justifyItems: 'start',
48
- padding: `${theme.page.vertical} ${theme.page.horizontal}`,
49
- gridTemplateColumns: 'auto auto',
50
- gridTemplateRows: 'auto',
51
- justifyContent: 'space-between',
52
- },
53
- })}
55
+ justifyItems: 'start',
56
+ padding: `${theme.page.vertical} ${theme.page.horizontal}`,
57
+ gridTemplateColumns: 'auto auto',
58
+ gridTemplateRows: 'auto',
59
+ justifyContent: 'space-between',
60
+ },
61
+ }),
62
+ ...(Array.isArray(sx) ? sx : [sx]),
63
+ ]}
54
64
  maxWidth={false}
55
65
  className={classes.root}
56
66
  {...containerProps}
@@ -92,7 +92,7 @@ export function LayoutDefault(props: LayoutDefaultProps) {
92
92
  justifyContent: 'space-between',
93
93
  width: '100%',
94
94
  height: 0,
95
- zIndex: 2,
95
+ zIndex: 'drawer',
96
96
  [theme.breakpoints.up('sm')]: {
97
97
  padding: `0 ${theme.page.horizontal}`,
98
98
  position: 'sticky',
@@ -1,4 +1,7 @@
1
- import { css, Theme, ThemeProvider } from '@mui/material'
1
+ import { SxProps, Theme, ThemeProvider } from '@mui/material'
2
+ import React from 'react'
3
+
4
+ type WithSx = { sx?: SxProps<Theme> }
2
5
 
3
6
  /**
4
7
  * It will provide a theme for the underlying tree and will set the color/font and backgroundColor
@@ -21,22 +24,37 @@ import { css, Theme, ThemeProvider } from '@mui/material'
21
24
  * const MyPage = () => {
22
25
  * return <div>Your regular page content, but now in darkMode</div>
23
26
  * }
24
- *
25
27
  * export default withTheme(MyPage, darkTheme)
26
28
  * ```
29
+ *
30
+ * If you are trying to theme a complete page:
31
+ *
32
+ * ```tsx
33
+ * MyPage.pageOptions = {
34
+ * Layout: withTheme(LayoutFull, darkTheme),
35
+ * } as PageOptions
36
+ * ```
27
37
  */
28
- export function withTheme(Component: React.FC<{ className?: string }>, theme: Theme) {
29
- return (props: Record<string, unknown>) => (
30
- <ThemeProvider theme={theme}>
31
- <Component
32
- {...props}
33
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
34
- css={css({
35
- color: theme.palette.text.primary,
36
- backgroundColor: theme.palette.background.default,
37
- ...(theme.typography.body1 as any),
38
- })}
39
- />
40
- </ThemeProvider>
41
- )
38
+ export function withTheme<T>(
39
+ Component: (value: T & WithSx) => React.ReactElement<any, any> | null,
40
+ theme: Theme,
41
+ ): React.FC<T & WithSx> {
42
+ return (data: T & WithSx) => {
43
+ const sx = data.sx ?? []
44
+ return (
45
+ <ThemeProvider theme={theme}>
46
+ <Component
47
+ {...data}
48
+ sx={[
49
+ {
50
+ typography: 'body1',
51
+ color: theme.palette.text.primary,
52
+ backgroundColor: theme.palette.background.default,
53
+ },
54
+ ...(Array.isArray(sx) ? sx : [sx]),
55
+ ]}
56
+ />
57
+ </ThemeProvider>
58
+ )
59
+ }
42
60
  }
package/UspList/index.tsx CHANGED
@@ -1,8 +1,9 @@
1
- import { Box } from '@mui/material'
1
+ import { Box, SxProps, Theme } from '@mui/material'
2
2
  import { extendableComponent } from '../Styles'
3
3
 
4
4
  export type UspListProps = OwnerState & {
5
5
  children: React.ReactNode
6
+ sx?: SxProps<Theme>
6
7
  }
7
8
 
8
9
  type OwnerState = { size?: 'small' | 'medium' }
@@ -11,24 +12,27 @@ const parts = ['root'] as const
11
12
  const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
12
13
 
13
14
  export function UspList(props: UspListProps) {
14
- const { children, size } = props
15
+ const { children, size, sx = [] } = props
15
16
  const classes = withState({ size })
16
17
 
17
18
  return (
18
19
  <Box
19
20
  component='ul'
20
21
  className={classes.root}
21
- sx={(theme) => ({
22
- listStyleType: 'none',
23
- padding: 0,
24
- margin: 0,
25
- display: 'grid',
26
- alignContent: 'start',
27
- rowGap: theme.spacings.xs,
28
- '&.sizeSmall': {
29
- rowGap: '3px',
30
- },
31
- })}
22
+ sx={[
23
+ (theme) => ({
24
+ listStyleType: 'none',
25
+ padding: 0,
26
+ margin: 0,
27
+ display: 'grid',
28
+ alignContent: 'start',
29
+ rowGap: theme.spacings.xs,
30
+ '&.sizeSmall': {
31
+ rowGap: '3px',
32
+ },
33
+ }),
34
+ ...(Array.isArray(sx) ? sx : [sx]),
35
+ ]}
32
36
  >
33
37
  {children}
34
38
  </Box>
package/icons/index.tsx CHANGED
@@ -38,3 +38,4 @@ export { default as iconEmailOutline } from './envelope-alt.svg'
38
38
  export { default as icon404 } from './explore.svg'
39
39
  export { default as iconSun } from './sun.svg'
40
40
  export { default as iconMoon } from './moon.svg'
41
+ export { default as iconPlay } from './play.svg'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-ui",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.1.4",
5
+ "version": "4.1.5",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,