@graphcommerce/next-ui 8.0.0-canary.79 → 8.0.0-canary.80

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,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.0.0-canary.80
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2138](https://github.com/graphcommerce-org/graphcommerce/pull/2138) [`a057d62`](https://github.com/graphcommerce-org/graphcommerce/commit/a057d6274e1d427e631ab3fad7a16078315103b8) - Wrap the logo in a div on the homepage to prevent redirection.
8
+ ([@carlocarels90](https://github.com/carlocarels90))
9
+
3
10
  ## 8.0.0-canary.79
4
11
 
5
12
  ### Patch Changes
@@ -5,6 +5,7 @@ import {
5
5
  SxProps,
6
6
  Theme,
7
7
  unstable_composeClasses as composeClasses,
8
+ Box,
8
9
  } from '@mui/material'
9
10
  import { useRouter } from 'next/router'
10
11
  import { forwardRef } from 'react'
@@ -22,12 +23,7 @@ const getLogoUtilityClass = (slot: string) => generateUtilityClass(name, slot)
22
23
  const useUtilityClasses = ({ classes }: LogoClassProps) =>
23
24
  composeClasses({ logo: ['logo'], parent: ['parent'] }, getLogoUtilityClass, classes)
24
25
 
25
- /** Creating styled components */
26
- const LogoContainer = styled(NextLink, {
27
- name,
28
- slot: 'parent',
29
- overridesResolver: (_props, styles) => styles.parent,
30
- })(({ theme }) => ({
26
+ const commonLogoStyles: SxProps<Theme> = {
31
27
  height: '100%',
32
28
  width: 'max-content',
33
29
  display: 'flex',
@@ -35,12 +31,13 @@ const LogoContainer = styled(NextLink, {
35
31
  margin: '0 auto',
36
32
  justifyContent: 'center',
37
33
  pointerEvents: 'all',
38
- [theme.breakpoints.up('md')]: {
39
- display: 'flex',
40
- margin: 'unset',
41
- justifyContent: 'left',
42
- },
43
- }))
34
+ }
35
+
36
+ const LogoContainer = styled(NextLink, {
37
+ name,
38
+ slot: 'parent',
39
+ overridesResolver: (_props, styles) => styles.parent,
40
+ })()
44
41
 
45
42
  export type LogoProps = {
46
43
  href?: `/${string}`
@@ -51,7 +48,6 @@ export type LogoProps = {
51
48
  export const Logo = forwardRef<HTMLAnchorElement, LogoProps>((props, ref) => {
52
49
  const { href = '/', image, sx } = props
53
50
  const router = useRouter()
54
-
55
51
  const classes = useUtilityClasses(props)
56
52
 
57
53
  const img = (
@@ -63,13 +59,17 @@ export const Logo = forwardRef<HTMLAnchorElement, LogoProps>((props, ref) => {
63
59
  />
64
60
  )
65
61
 
66
- return router.asPath.split('?')[0] === '/' ? (
67
- <LogoContainer ref={ref} sx={sx} className={classes.parent}>
68
- {img}
69
- </LogoContainer>
70
- ) : (
71
- <LogoContainer href={href} ref={ref} sx={sx} className={classes.parent}>
62
+ const shouldRedirect = router.asPath.split('?')[0] !== href
63
+
64
+ return (
65
+ <Box
66
+ component={shouldRedirect ? LogoContainer : 'div'}
67
+ href={shouldRedirect ? href : undefined}
68
+ ref={ref}
69
+ sx={[...(Array.isArray(sx) ? sx : [sx]), commonLogoStyles]}
70
+ className={classes.parent}
71
+ >
72
72
  {img}
73
- </LogoContainer>
73
+ </Box>
74
74
  )
75
75
  })
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": "8.0.0-canary.79",
5
+ "version": "8.0.0-canary.80",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -26,14 +26,14 @@
26
26
  "typescript": "5.3.3"
27
27
  },
28
28
  "peerDependencies": {
29
- "@graphcommerce/eslint-config-pwa": "^8.0.0-canary.79",
30
- "@graphcommerce/framer-next-pages": "^8.0.0-canary.79",
31
- "@graphcommerce/framer-scroller": "^8.0.0-canary.79",
32
- "@graphcommerce/framer-utils": "^8.0.0-canary.79",
33
- "@graphcommerce/image": "^8.0.0-canary.79",
34
- "@graphcommerce/lingui-next": "^8.0.0-canary.79",
35
- "@graphcommerce/prettier-config-pwa": "^8.0.0-canary.79",
36
- "@graphcommerce/typescript-config-pwa": "^8.0.0-canary.79",
29
+ "@graphcommerce/eslint-config-pwa": "^8.0.0-canary.80",
30
+ "@graphcommerce/framer-next-pages": "^8.0.0-canary.80",
31
+ "@graphcommerce/framer-scroller": "^8.0.0-canary.80",
32
+ "@graphcommerce/framer-utils": "^8.0.0-canary.80",
33
+ "@graphcommerce/image": "^8.0.0-canary.80",
34
+ "@graphcommerce/lingui-next": "^8.0.0-canary.80",
35
+ "@graphcommerce/prettier-config-pwa": "^8.0.0-canary.80",
36
+ "@graphcommerce/typescript-config-pwa": "^8.0.0-canary.80",
37
37
  "@lingui/core": "^4.2.1",
38
38
  "@lingui/macro": "^4.2.1",
39
39
  "@lingui/react": "^4.2.1",