@graphcommerce/next-ui 3.22.2 → 3.24.1

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.
@@ -26,9 +26,10 @@ export function GlobalHead(props: GlobalHeadProps) {
26
26
  <meta name='apple-mobile-web-app-title' content={name} key='apple-mobile-web-app-title' />
27
27
  <meta name='format-detection' content='telephone=no' key='format-detection' />
28
28
  <meta name='mobile-web-app-capable' content='yes' key='mobile-web-app-capable' />
29
- <link rel='apple-touch-icon' href='/manifest/icon-512-512.png' key='apple-touch-icon' />
29
+ <link rel='icon' href='/favicon.ico' sizes='any' />
30
+ <link rel='icon' href='/manifest/favicon.svg' type='image/svg+xml' />
31
+ <link rel='apple-touch-icon' href='/apple-touch-icon.png' />
30
32
  <link rel='manifest' href='/manifest.webmanifest' key='manifest' />
31
- <link rel='icon' href='/manifest/favicon.ico' key='icon' />
32
33
  </Head>
33
34
  )
34
35
  }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,55 @@
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.24.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.24.0...@graphcommerce/next-ui@3.24.1) (2022-01-18)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * favicon and manifest ([304d6dd](https://github.com/ho-nl/m2-pwa/commit/304d6dd7769d349b02b06dfdfdc3f9d22a4af081))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.24.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.23.1...@graphcommerce/next-ui@3.24.0) (2022-01-17)
18
+
19
+
20
+ ### Features
21
+
22
+ * manifest and favicon ([a82202c](https://github.com/ho-nl/m2-pwa/commit/a82202c0e572f005cbcfca815936af9356eb2767))
23
+
24
+
25
+
26
+
27
+
28
+ ## [3.23.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.23.0...@graphcommerce/next-ui@3.23.1) (2022-01-04)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * close button on mobile ([a0c6c07](https://github.com/ho-nl/m2-pwa/commit/a0c6c075a1ee2541c864a561cd5318ed5fb5760c))
34
+
35
+
36
+
37
+
38
+
39
+ # [3.23.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.22.2...@graphcommerce/next-ui@3.23.0) (2022-01-04)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * backbutton wasn't translated ([5f841c0](https://github.com/ho-nl/m2-pwa/commit/5f841c052b454c0d565a68829f78492c5a3b6dab))
45
+
46
+
47
+ ### Features
48
+
49
+ * introduced a withTheme hoc to allow theming per route ([55e3fc1](https://github.com/ho-nl/m2-pwa/commit/55e3fc178b385d0ccdc19a5c09a7887be5db14dc))
50
+
51
+
52
+
53
+
54
+
6
55
  ## [3.22.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.22.1...@graphcommerce/next-ui@3.22.2) (2022-01-04)
7
56
 
8
57
 
@@ -5,6 +5,7 @@ import SvgImageSimple from '../../SvgImage/SvgImageSimple'
5
5
  import { iconClose } from '../../icons'
6
6
  import { makeStyles, Theme } from '@material-ui/core'
7
7
  import { responsiveVal } from '../../Styles/responsiveVal'
8
+ import { Trans } from '@lingui/macro'
8
9
 
9
10
  export function useShowClose() {
10
11
  const { overlayGroup } = usePageContext()
@@ -13,8 +14,10 @@ export function useShowClose() {
13
14
 
14
15
  const useStyles = makeStyles((theme: Theme) => ({
15
16
  close: {
16
- marginLeft: `calc(${responsiveVal(12, 22)} * -1)`,
17
- marginRight: `calc(${responsiveVal(12, 22)} * -1)`,
17
+ [theme.breakpoints.up('md')]: {
18
+ marginLeft: `calc(${responsiveVal(12, 22)} * -1)`,
19
+ marginRight: `calc(${responsiveVal(12, 22)} * -1)`,
20
+ },
18
21
  },
19
22
  }))
20
23
 
@@ -32,7 +35,7 @@ export default function LayoutHeaderClose() {
32
35
  startIcon={<SvgImageSimple src={iconClose} />}
33
36
  className={classes.close}
34
37
  >
35
- Close
38
+ <Trans>Close</Trans>
36
39
  </Button>
37
40
  )
38
41
  }
@@ -55,6 +55,7 @@ const useStyles = makeStyles(
55
55
  )
56
56
 
57
57
  export type LayoutDefaultProps = {
58
+ className?: string
58
59
  header: React.ReactNode
59
60
  footer: React.ReactNode
60
61
  menuFab?: React.ReactNode
@@ -64,14 +65,14 @@ export type LayoutDefaultProps = {
64
65
  } & UseStyles<typeof useStyles>
65
66
 
66
67
  export function LayoutDefault(props: LayoutDefaultProps) {
67
- const { children, header, footer, menuFab, cartFab, noSticky } = props
68
+ const { children, header, footer, menuFab, cartFab, noSticky, className } = props
68
69
  const classes = useStyles(props)
69
70
 
70
71
  const offset = useScrollOffset().y
71
72
  const scrollWithOffset = useTransform(useViewportScroll().scrollY, (y) => y + offset)
72
73
 
73
74
  return (
74
- <div className={classes.root}>
75
+ <div className={clsx(classes.root, className)}>
75
76
  <LayoutProvider scroll={scrollWithOffset}>
76
77
  <header className={clsx(classes.header, !noSticky && classes.headerSticky)}>
77
78
  {header}
@@ -178,6 +178,7 @@ type StyleProps = {
178
178
 
179
179
  export type LayoutOverlayBaseProps = {
180
180
  children?: React.ReactNode
181
+ className?: string
181
182
  } & StyleProps &
182
183
  UseStyles<typeof useStyles>
183
184
 
@@ -193,6 +194,7 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
193
194
  variantSm,
194
195
  variantMd,
195
196
  classes: _classes,
197
+ className,
196
198
  sizeSm = 'full',
197
199
  sizeMd = 'full',
198
200
  justifySm = 'stretch',
@@ -211,7 +213,7 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
211
213
  const position = useMotionValue<OverlayPosition>(OverlayPosition.UNOPENED)
212
214
 
213
215
  const classes = useStyles({ classes: _classes, sizeSm, sizeMd, justifySm, justifyMd })
214
- const className = classesPicker(classes, {
216
+ const clsName = classesPicker(classes, {
215
217
  variantSm,
216
218
  variantMd,
217
219
  sizeSm,
@@ -390,11 +392,11 @@ export function LayoutOverlayBase(props: LayoutOverlayBaseProps) {
390
392
 
391
393
  return (
392
394
  <>
393
- <m.div {...className('backdrop')} style={{ opacity: positions.open.visible }} />
394
- <Scroller {...className('root')} grid={false} hideScrollbar onClick={onClickAway}>
395
+ <m.div {...clsName('backdrop')} style={{ opacity: positions.open.visible }} />
396
+ <Scroller {...clsName('root')} grid={false} hideScrollbar onClick={onClickAway}>
395
397
  <BeforeOverlay onClick={onClickAway} ref={beforeRef} />
396
- <Overlay {...className('overlay')} ref={overlayRef}>
397
- <OverlayPane {...className('overlayPane')}>
398
+ <Overlay {...clsName('overlay')} ref={overlayRef}>
399
+ <OverlayPane {...clsName('overlayPane', className)}>
398
400
  <LayoutProvider scroll={scrollWithoffset}>{children}</LayoutProvider>
399
401
  </OverlayPane>
400
402
  </Overlay>
package/Styles/index.tsx CHANGED
@@ -1,3 +1,8 @@
1
1
  export type UseStyles<T extends (...args: never[]) => unknown> = {
2
2
  classes?: Partial<ReturnType<T>>
3
3
  }
4
+
5
+ export * from './breakpointVal'
6
+ export * from './responsiveVal'
7
+ export * from './classesPicker'
8
+ export * from './withTheme'
@@ -0,0 +1,51 @@
1
+ import { makeStyles, Theme, ThemeProvider } from '@material-ui/core'
2
+
3
+ const useStyles = makeStyles(
4
+ {
5
+ // These theme specific styles are copied from
6
+ // https://github.com/mui-org/material-ui/blob/master/packages/mui-material/src/CssBaseline/CssBaseline.js#L18-L24
7
+ root: (theme: Theme) => ({
8
+ color: theme.palette.text.primary,
9
+ ...theme.typography.body1,
10
+ backgroundColor: theme.palette.background.default,
11
+ }),
12
+ },
13
+ { name: 'Theme' },
14
+ )
15
+
16
+ /**
17
+ * It will provide a theme for the underlying tree and will set the color/font and backgroundColor
18
+ * for the child.
19
+ *
20
+ * To use it, wrap your component with it.
21
+ *
22
+ * Example:
23
+ *
24
+ * ```tsx
25
+ * const MyPage = () => {
26
+ * return <div>Your regular page content</div>
27
+ * }
28
+ * export default MyPage
29
+ * ```
30
+ *
31
+ * Becomes:
32
+ *
33
+ * ```tsx
34
+ * const MyPage = () => {
35
+ * return <div>Your regular page content, but now in darkMode</div>
36
+ * }
37
+ *
38
+ * export default withTheme(MyPage, darkTheme)
39
+ * ```
40
+ */
41
+ export function withTheme<P extends { className?: string }>(Component: React.FC<P>, theme: Theme) {
42
+ return (props: P) => {
43
+ const classes = useStyles(theme)
44
+
45
+ return (
46
+ <ThemeProvider theme={theme}>
47
+ <Component {...props} className={classes.root} />
48
+ </ThemeProvider>
49
+ )
50
+ }
51
+ }
package/index.ts CHANGED
@@ -106,9 +106,6 @@ export * from './Stepper/Stepper'
106
106
  export { default as Stepper } from './Stepper/Stepper'
107
107
  export { default as StyledBadge } from './StyledBadge'
108
108
  export * from './Styles'
109
- export * from './Styles/breakpointVal'
110
- export * from './Styles/responsiveVal'
111
- export * from './Styles/classesPicker'
112
109
  export * from './SvgImage'
113
110
  export { default as SvgImage } from './SvgImage'
114
111
  export { default as SvgImageSimple } from './SvgImage/SvgImageSimple'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/next-ui",
3
- "version": "3.22.2",
3
+ "version": "3.24.1",
4
4
  "author": "",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@apollo/client": "^3.5.6",
13
13
  "@graphcommerce/framer-next-pages": "^2.109.2",
14
- "@graphcommerce/framer-scroller": "^1.2.2",
14
+ "@graphcommerce/framer-scroller": "^1.2.6",
15
15
  "@graphcommerce/framer-utils": "^2.103.21",
16
16
  "@graphcommerce/graphql": "^2.105.13",
17
17
  "@graphcommerce/image": "^2.105.13",
@@ -51,5 +51,5 @@
51
51
  "project": "./tsconfig.json"
52
52
  }
53
53
  },
54
- "gitHead": "0553535bc06348d46a64c90e5330f8ff108c0cbc"
54
+ "gitHead": "63eca898199abef3b1c47c855142423afb2b49d6"
55
55
  }