@graphcommerce/next-ui 3.2.0 → 3.3.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.
@@ -1,9 +1,12 @@
1
1
  import { Scroller, ScrollerButton, ScrollerProvider } from '@graphcommerce/framer-scroller'
2
- import { Link, makeStyles, Theme } from '@material-ui/core'
2
+ import { Link, LinkProps as MuiLinkProps, makeStyles, Theme } from '@material-ui/core'
3
+ import { Variant as ThemeVariant } from '@material-ui/core/styles/createTypography'
3
4
  import clsx from 'clsx'
5
+ import { m } from 'framer-motion'
4
6
  import PageLink from 'next/link'
5
7
  import { useRouter } from 'next/router'
6
8
  import React from 'react'
9
+ import { UseStyles } from '../Styles'
7
10
  import SvgImageSimple from '../SvgImage/SvgImageSimple'
8
11
  import { iconChevronLeft, iconChevronRight } from '../icons'
9
12
  import { MenuProps } from './Menu'
@@ -25,20 +28,33 @@ const useStyles = makeStyles(
25
28
  padding: '0 40px',
26
29
  minHeight: 40,
27
30
  },
28
- prevNext: {
29
- pointerEvents: 'all',
31
+ prevNextBtnWrapper: {
30
32
  position: 'absolute',
31
- background: theme.palette.background.default,
32
- top: 5,
33
- [theme.breakpoints.down('sm')]: { display: 'none' },
34
- boxShadow: 'none',
33
+ top: 0,
35
34
  },
36
- prev: {
35
+ left: {
37
36
  left: 0,
38
37
  },
39
- next: {
38
+ right: {
40
39
  right: 0,
41
40
  },
41
+ prevNextBtn: {
42
+ pointerEvents: 'all',
43
+ background: theme.palette.background.default,
44
+ boxShadow: 'none',
45
+ height: 48,
46
+ [theme.breakpoints.down('sm')]: {
47
+ display: 'none',
48
+ },
49
+ },
50
+ prevBtn: {
51
+ borderTopLeftRadius: 0,
52
+ borderBottomLeftRadius: 0,
53
+ },
54
+ nextBtn: {
55
+ borderTopRightRadius: 0,
56
+ borderBottomRightRadius: 0,
57
+ },
42
58
  link: {
43
59
  whiteSpace: 'nowrap',
44
60
  color: 'black',
@@ -65,11 +81,11 @@ const useStyles = makeStyles(
65
81
  { name: 'DesktopNavBar' },
66
82
  )
67
83
 
68
- export type MenuTabsProps = MenuProps
84
+ export type MenuTabsProps = MenuProps & UseStyles<typeof useStyles> & { LinkProps?: MuiLinkProps }
69
85
 
70
86
  export default function DesktopNavBar(props: MenuTabsProps) {
71
- const { menu } = props
72
- const classes = useStyles()
87
+ const { menu, LinkProps } = props
88
+ const classes = useStyles(props)
73
89
  const router = useRouter()
74
90
 
75
91
  return (
@@ -78,7 +94,7 @@ export default function DesktopNavBar(props: MenuTabsProps) {
78
94
  <Scroller className={classes.scroller} hideScrollbar>
79
95
  {menu.map(({ href, children, ...linkProps }) => (
80
96
  <PageLink key={href.toString()} href={href} {...linkProps} passHref>
81
- <Link className={classes.link} variant='h6'>
97
+ <Link {...LinkProps} className={clsx(classes.link, LinkProps?.className)}>
82
98
  {children}
83
99
  <div
84
100
  className={clsx(
@@ -89,22 +105,44 @@ export default function DesktopNavBar(props: MenuTabsProps) {
89
105
  </Link>
90
106
  </PageLink>
91
107
  ))}
108
+ </Scroller>
109
+
110
+ <m.div className={clsx(classes.prevNextBtnWrapper, classes.left)}>
92
111
  <ScrollerButton
93
112
  direction='left'
94
113
  size='small'
95
- className={clsx(classes.prevNext, classes.prev)}
114
+ classes={{ root: clsx(classes.prevNextBtn, classes.prevBtn) }}
96
115
  >
97
116
  <SvgImageSimple src={iconChevronLeft} />
98
117
  </ScrollerButton>
118
+ </m.div>
119
+
120
+ <m.div className={clsx(classes.prevNextBtnWrapper, classes.right)}>
99
121
  <ScrollerButton
100
122
  direction='right'
101
123
  size='small'
102
- className={clsx(classes.prevNext, classes.next)}
124
+ classes={{ root: clsx(classes.prevNextBtn, classes.nextBtn) }}
103
125
  >
104
126
  <SvgImageSimple src={iconChevronRight} />
105
127
  </ScrollerButton>
106
- </Scroller>
128
+ </m.div>
107
129
  </div>
130
+
131
+ {/* <ScrollerButton
132
+ direction='left'
133
+ size='small'
134
+ className={clsx(classes.prevNext, classes.prev)}
135
+ >
136
+ <SvgImageSimple src={iconChevronLeft} />
137
+ </ScrollerButton>
138
+
139
+ <ScrollerButton
140
+ direction='right'
141
+ size='small'
142
+ className={clsx(classes.prevNext, classes.next)}
143
+ >
144
+ <SvgImageSimple src={iconChevronRight} />
145
+ </ScrollerButton> */}
108
146
  </ScrollerProvider>
109
147
  )
110
148
  }
@@ -91,6 +91,11 @@ export default function MenuFab(props: MenuFabProps) {
91
91
  onClose={() => setOpenEl(null)}
92
92
  classes={{ paper: classes.menu }}
93
93
  disableScrollLock
94
+ transitionDuration={{
95
+ appear: 175,
96
+ enter: 175,
97
+ exit: 175,
98
+ }}
94
99
  >
95
100
  {search && (
96
101
  <List>
package/Button/index.tsx CHANGED
@@ -56,7 +56,7 @@ const useStyles = makeStyles<
56
56
  [theme.breakpoints.up('md')]: {
57
57
  background: theme.palette.secondary.main,
58
58
  color: theme.palette.secondary.contrastText,
59
- boxShadow: theme.shadows[2],
59
+ boxShadow: theme.shadows[6],
60
60
  borderRadius: 25,
61
61
  padding: '6px 16px',
62
62
  fontWeight: theme.typography.fontWeightBold,
package/CHANGELOG.md CHANGED
@@ -3,6 +3,53 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.3.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.2.3...@graphcommerce/next-ui@3.3.0) (2021-10-13)
7
+
8
+
9
+ ### Features
10
+
11
+ * allow styling DesktopNavBar ([12f99a6](https://github.com/ho-nl/m2-pwa/commit/12f99a603d9e9f89e28ec2452823b58abee59c4c))
12
+ * implement extensibility for DesktopNavBar, SearchButton ([5710de8](https://github.com/ho-nl/m2-pwa/commit/5710de8936f59c7d0fcc648978183f0e7fdd26b7))
13
+ * make DesktopNavBar Link variant customizable ([d47172f](https://github.com/ho-nl/m2-pwa/commit/d47172f3ebe0cc0b769e0d17c171ae4bb2045bbb))
14
+
15
+
16
+
17
+
18
+
19
+ ## [3.2.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.2.2...@graphcommerce/next-ui@3.2.3) (2021-10-11)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **desktop-nav-bar:** prev/next button alignment in menu ([c7fabf0](https://github.com/ho-nl/m2-pwa/commit/c7fabf0474100aaf40a7526858fa2b01566b3250))
25
+ * **section-heeader-filter-items:** remove large paddings ([18f4d77](https://github.com/ho-nl/m2-pwa/commit/18f4d77e4eb1b029bf2e5656b753e2f18fde90ab))
26
+
27
+
28
+
29
+
30
+
31
+ ## [3.2.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.2.1...@graphcommerce/next-ui@3.2.2) (2021-10-11)
32
+
33
+
34
+ ### Bug Fixes
35
+
36
+ * **menu-fab:** animation duration ([5b9ece2](https://github.com/ho-nl/m2-pwa/commit/5b9ece293fb7e12663386f9f9cbc99bc4e22aaa9))
37
+
38
+
39
+
40
+
41
+
42
+ ## [3.2.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.2.0...@graphcommerce/next-ui@3.2.1) (2021-10-11)
43
+
44
+
45
+ ### Bug Fixes
46
+
47
+ * **framer-scroller:** dots should have a background ([8f2e1a1](https://github.com/ho-nl/m2-pwa/commit/8f2e1a1ffc9de3369938fe2f9e9f25f592739d8d))
48
+
49
+
50
+
51
+
52
+
6
53
  # [3.2.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.1.7...@graphcommerce/next-ui@3.2.0) (2021-10-09)
7
54
 
8
55
 
@@ -55,6 +55,9 @@ export const useChipMenuStyles = makeStyles(
55
55
  outline: 'none',
56
56
  },
57
57
  },
58
+ sectionHeaderWrapper: {
59
+ marginTop: 10,
60
+ },
58
61
  }),
59
62
  { name: 'ChipMenu' },
60
63
  )
@@ -109,7 +112,6 @@ export default function ChipMenu(props: ChipMenuProps) {
109
112
  selectedAndMenuHidden && classes.chipSelected,
110
113
  )}
111
114
  />
112
-
113
115
  <Menu
114
116
  anchorEl={openEl}
115
117
  open={!!openEl}
@@ -122,7 +124,12 @@ export default function ChipMenu(props: ChipMenuProps) {
122
124
  anchorOrigin={{ horizontal: 'left', vertical: 'bottom' }}
123
125
  classes={{ paper: classes.menuPaper, list: classes.menuList }}
124
126
  >
125
- <SectionHeader labelLeft={label ?? ''} labelRight={labelRight ?? ''} usePadding />
127
+ <SectionHeader
128
+ labelLeft={label ?? ''}
129
+ labelRight={labelRight ?? ''}
130
+ usePadding
131
+ classes={{ sectionHeaderWrapper: classes.sectionHeaderWrapper }}
132
+ />
126
133
  {children}
127
134
  </Menu>
128
135
  </>
@@ -9,7 +9,7 @@ import {
9
9
  ScrollerProvider,
10
10
  } from '@graphcommerce/framer-scroller'
11
11
  import { clientSize, useMotionValueValue } from '@graphcommerce/framer-utils'
12
- import { Fab, makeStyles, Theme, useTheme } from '@material-ui/core'
12
+ import { Fab, makeStyles, Theme, useTheme, alpha } from '@material-ui/core'
13
13
  import clsx from 'clsx'
14
14
  import { m, useDomEvent, useMotionValue } from 'framer-motion'
15
15
  import { useRouter } from 'next/router'
@@ -23,6 +23,7 @@ import { iconChevronLeft, iconChevronRight, iconFullscreen, iconFullscreenExit }
23
23
  type StyleProps = {
24
24
  aspectRatio: [number, number]
25
25
  clientHeight: number
26
+ classes?: Record<string, unknown>
26
27
  }
27
28
 
28
29
  const useStyles = makeStyles(
@@ -131,7 +132,7 @@ const useStyles = makeStyles(
131
132
  },
132
133
  },
133
134
  toggleIcon: {
134
- boxShadow: theme.shadows[2],
135
+ boxShadow: theme.shadows[6],
135
136
  },
136
137
  topRight: {
137
138
  display: 'grid',
@@ -156,6 +157,9 @@ const useStyles = makeStyles(
156
157
  right: theme.spacings.sm,
157
158
  top: `calc(50% - 28px)`,
158
159
  },
160
+ dots: {
161
+ background: alpha(theme.palette.background.highlight, 0.7),
162
+ },
159
163
  }),
160
164
  { name: 'SidebarGallery' },
161
165
  )
@@ -172,7 +176,7 @@ export default function SidebarGallery(props: SidebarGalleryProps) {
172
176
  const router = useRouter()
173
177
  const prevRoute = usePrevPageRouter()
174
178
  const clientHeight = useMotionValueValue(clientSize.y, (y) => y)
175
- const classes = useStyles({ clientHeight, aspectRatio })
179
+ const classes = useStyles({ clientHeight, aspectRatio, classes: props.classes })
176
180
 
177
181
  const route = `#${routeHash}`
178
182
  // We're using the URL to manage the state of the gallery.
@@ -275,7 +279,7 @@ export default function SidebarGallery(props: SidebarGalleryProps) {
275
279
  </div>
276
280
 
277
281
  <div className={classes.bottomCenter}>
278
- <ScrollerDots layout />
282
+ <ScrollerDots layout classes={{ dots: classes.dots }} />
279
283
  </div>
280
284
  </m.div>
281
285
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/next-ui",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "author": "",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -11,11 +11,11 @@
11
11
  "dependencies": {
12
12
  "@apollo/client": "^3.4.16",
13
13
  "@graphcommerce/framer-next-pages": "^2.106.7",
14
- "@graphcommerce/framer-scroller": "^0.2.8",
15
- "@graphcommerce/framer-sheet": "^2.105.6",
14
+ "@graphcommerce/framer-scroller": "^0.2.9",
15
+ "@graphcommerce/framer-sheet": "^2.105.7",
16
16
  "@graphcommerce/framer-utils": "^2.103.6",
17
17
  "@graphcommerce/graphql": "^2.103.5",
18
- "@graphcommerce/image": "^2.104.7",
18
+ "@graphcommerce/image": "^2.104.8",
19
19
  "@graphql-typed-document-node/core": "^3.1.0",
20
20
  "@material-ui/core": "^4.12.3",
21
21
  "@material-ui/lab": "^4.0.0-alpha.60",
@@ -54,6 +54,5 @@
54
54
  "parserOptions": {
55
55
  "project": "./tsconfig.json"
56
56
  }
57
- },
58
- "gitHead": "b3dd4c996ac571874bb03d0a5c16b2c37f41abcb"
57
+ }
59
58
  }