@graphcommerce/next-ui 4.25.0 → 4.26.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.26.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1651](https://github.com/graphcommerce-org/graphcommerce/pull/1651) [`42e7fac75`](https://github.com/graphcommerce-org/graphcommerce/commit/42e7fac75712f9bda7a6b919ede14b3c75d07771) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Correct component usage in /service
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @graphcommerce/framer-scroller@2.1.38
13
+
3
14
  ## 4.25.0
4
15
 
5
16
  ### Minor Changes
@@ -1,29 +1,36 @@
1
- import { Button, ButtonProps, styled } from '@mui/material'
1
+ import { ListItemButtonProps, ListItemButton, ListItemIcon, ListItemText } from '@mui/material'
2
2
  import PageLink from 'next/link'
3
3
  import React from 'react'
4
4
  import { IconSvg } from '../../IconSvg'
5
5
  import { iconChevronRight } from '../../icons'
6
6
 
7
- export type ButtonLinkListItemProps = { url: string; endIcon?: React.ReactNode } & ButtonProps
8
-
9
- const ButtonItem = styled(Button)(({ theme }) => ({
10
- color: theme.palette.text.primary,
11
- textDecoration: 'none',
12
- padding: `${theme.spacings.xs} 0`,
13
- borderBottom: `1px solid ${theme.palette.divider}`,
14
- borderRadius: 0,
15
- justifyContent: 'space-between',
16
- typography: 'body1',
17
- }))
7
+ export type ButtonLinkListItemProps = {
8
+ url: string
9
+ endIcon?: React.ReactNode
10
+ } & ListItemButtonProps
18
11
 
19
12
  export function ButtonLinkListItem(props: ButtonLinkListItemProps) {
20
- const { children, url, endIcon = <IconSvg src={iconChevronRight} />, ...buttonProps } = props
13
+ const {
14
+ children,
15
+ url,
16
+ endIcon = <IconSvg src={iconChevronRight} />,
17
+ ...ButtonLinkListItemProps
18
+ } = props
21
19
 
22
20
  return (
23
21
  <PageLink href={url} passHref>
24
- <ButtonItem {...buttonProps} endIcon={endIcon} LinkComponent='h3'>
25
- {children}
26
- </ButtonItem>
22
+ <ListItemButton
23
+ LinkComponent='a'
24
+ sx={(theme) => ({
25
+ padding: `${theme.spacings.xxs} 0`,
26
+ borderBottom: `1px solid ${theme.palette.divider}`,
27
+ justifyContent: 'space-between',
28
+ })}
29
+ {...ButtonLinkListItemProps}
30
+ >
31
+ <ListItemText>{children}</ListItemText>
32
+ <ListItemIcon>{endIcon}</ListItemIcon>
33
+ </ListItemButton>
27
34
  </PageLink>
28
35
  )
29
36
  }
@@ -1,4 +1,4 @@
1
- import { Typography, Button, SxProps, Theme, Box } from '@mui/material'
1
+ import { Typography, Button, SxProps, Theme, Box, ButtonProps } from '@mui/material'
2
2
  import React from 'react'
3
3
  import { extendableComponent } from '../../Styles'
4
4
 
@@ -8,65 +8,43 @@ export type IconBlockProps = {
8
8
  children: React.ReactNode
9
9
  href?: string
10
10
  sx?: SxProps<Theme>
11
- }
11
+ } & ButtonProps
12
12
 
13
13
  const name = 'IconBlock' as const
14
14
  const parts = ['block', 'link', 'title'] as const
15
15
  const { classes } = extendableComponent(name, parts)
16
16
 
17
17
  export const IconBlock = React.forwardRef<HTMLAnchorElement, IconBlockProps>((props, ref) => {
18
- const { title, children, icon, href, sx = [] } = props
19
-
20
- const content = (
21
- <>
22
- {icon}
23
- <Typography
24
- variant='subtitle1'
25
- className={classes.title}
26
- sx={(theme) => ({ fontWeight: theme.typography.fontWeightBold })}
27
- component='span'
28
- >
29
- {title}
30
- </Typography>
31
- {children}
32
- </>
33
- )
34
-
35
- const blockSx: SxProps<Theme> = [
36
- (theme) => ({
37
- border: `1px solid ${theme.palette.divider}`,
38
- padding: `${theme.spacings.sm}`,
39
- borderRadius: '6px',
40
- textAlign: 'center',
41
- color: theme.palette.text.primary,
42
- '& > *': {
43
- display: 'grid',
44
- gridAutoFlow: 'row',
45
- justifyItems: 'center',
46
- gap: `${theme.spacings.xxs}`,
47
- },
48
- }),
49
- ...(Array.isArray(sx) ? sx : [sx]),
50
- ]
51
-
52
- if (href) {
53
- return (
54
- <Button
55
- href={href}
56
- variant='text'
57
- color='primary'
58
- className={classes.block}
59
- ref={ref}
60
- sx={blockSx}
61
- >
62
- <div>{content}</div>
63
- </Button>
64
- )
65
- }
18
+ const { title, children, icon, href = '#', sx = [], ...buttonProps } = props
66
19
 
67
20
  return (
68
- <Box className={classes.block} sx={blockSx}>
69
- {content}
70
- </Box>
21
+ <Button
22
+ href={href}
23
+ variant='outlined'
24
+ color='primary'
25
+ className={classes.block}
26
+ {...buttonProps}
27
+ sx={[
28
+ (theme) => ({
29
+ padding: `${theme.spacings.sm}`,
30
+ textAlign: 'center',
31
+ '& > *': {
32
+ display: 'grid',
33
+ gridAutoFlow: 'row',
34
+ justifyItems: 'center',
35
+ gap: `${theme.spacings.xxs}`,
36
+ },
37
+ }),
38
+ ...(Array.isArray(sx) ? sx : [sx]),
39
+ ]}
40
+ >
41
+ <Box>
42
+ {icon}
43
+ <Typography variant='subtitle1' className={classes.title} component='span'>
44
+ {title}
45
+ </Typography>
46
+ {children}
47
+ </Box>
48
+ </Button>
71
49
  )
72
50
  })
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.25.0",
5
+ "version": "4.26.0",
6
6
  "author": "",
7
7
  "license": "MIT",
8
8
  "sideEffects": false,
@@ -20,7 +20,7 @@
20
20
  "@emotion/server": "^11.4.0",
21
21
  "@emotion/styled": "^11.9.3",
22
22
  "@graphcommerce/framer-next-pages": "3.3.0",
23
- "@graphcommerce/framer-scroller": "2.1.37",
23
+ "@graphcommerce/framer-scroller": "2.1.38",
24
24
  "@graphcommerce/framer-utils": "3.2.0",
25
25
  "@graphcommerce/image": "3.1.9",
26
26
  "cookie": "^0.5.0",