@graphcommerce/next-ui 3.12.2 → 3.13.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.
@@ -0,0 +1,23 @@
1
+ import { makeStyles, Theme } from '@material-ui/core'
2
+ import React from 'react'
3
+ import { UseStyles } from '../../Styles'
4
+ import SvgImage, { SvgImageProps } from '../../SvgImage'
5
+
6
+ const useStyles = makeStyles(
7
+ (theme: Theme) => ({
8
+ root: {
9
+ filter: theme.palette.type === 'light' ? undefined : 'brightness(1) invert(1)',
10
+ },
11
+ }),
12
+ {
13
+ name: 'SocialIcon',
14
+ },
15
+ )
16
+
17
+ type SocialIconProps = UseStyles<typeof useStyles> & SvgImageProps
18
+
19
+ export default function SocialIcon(props: SocialIconProps) {
20
+ const classes = useStyles(props)
21
+
22
+ return <SvgImage {...props} className={classes.root} />
23
+ }
@@ -0,0 +1,119 @@
1
+ import { ContainerProps, Theme, makeStyles, Container } from '@material-ui/core'
2
+ import clsx from 'clsx'
3
+ import React from 'react'
4
+ import { UseStyles } from '../../Styles'
5
+
6
+ const useStyles = makeStyles(
7
+ (theme: Theme) => ({
8
+ footer: {
9
+ gridTemplateColumns: '2.5fr 1.5fr',
10
+ gridTemplateAreas: `
11
+ 'social switcher'
12
+ 'links support'
13
+ `,
14
+ borderTop: `1px solid ${theme.palette.divider}`,
15
+ padding: `${theme.page.vertical} ${theme.page.horizontal} ${theme.page.vertical}`,
16
+ display: 'grid',
17
+ gap: theme.spacings.xs,
18
+ alignItems: 'center',
19
+ [theme.breakpoints.down('xs')]: {
20
+ paddingTop: theme.spacings.lg,
21
+ justifyItems: 'center',
22
+ gridTemplateAreas: `
23
+ 'switcher switcher'
24
+ 'support support'
25
+ 'social social'
26
+ 'links links'
27
+ `,
28
+ gap: theme.spacings.md,
29
+ '& > *': {
30
+ maxWidth: 'max-content',
31
+ },
32
+ },
33
+ [theme.breakpoints.up('md')]: {
34
+ gridTemplateColumns: 'auto auto',
35
+ gridTemplateRows: 'auto',
36
+ justifyContent: 'space-between',
37
+ },
38
+ },
39
+ disableMargin: {
40
+ [theme.breakpoints.down('xs')]: {
41
+ marginBottom: 0,
42
+ },
43
+ },
44
+ copyright: {
45
+ display: 'grid',
46
+ gridAutoFlow: 'column',
47
+ alignContent: 'center',
48
+ gridArea: 'links',
49
+ ...theme.typography.body2,
50
+ gap: theme.spacings.sm,
51
+ [theme.breakpoints.down('xs')]: {
52
+ gridAutoFlow: 'row',
53
+ textAlign: 'center',
54
+ gap: 0,
55
+ },
56
+ },
57
+ support: {
58
+ gridArea: 'support',
59
+ justifySelf: 'flex-end',
60
+ [theme.breakpoints.down('xs')]: {
61
+ justifySelf: 'center',
62
+ },
63
+ },
64
+ social: {
65
+ display: 'grid',
66
+ justifyContent: 'start',
67
+ gridAutoFlow: 'column',
68
+ gridArea: 'social',
69
+ gap: `0 ${theme.spacings.xs}`,
70
+ '& > *': {
71
+ minWidth: 'min-content',
72
+ },
73
+ [theme.breakpoints.down('xs')]: {
74
+ gap: `0 ${theme.spacings.sm}`,
75
+ },
76
+ },
77
+ storeSwitcher: {
78
+ gridArea: 'switcher',
79
+ justifySelf: 'end',
80
+ [theme.breakpoints.down('xs')]: {
81
+ justifySelf: 'center',
82
+ },
83
+ },
84
+ }),
85
+ { name: 'Footer' },
86
+ )
87
+
88
+ type FooterProps = UseStyles<typeof useStyles> & {
89
+ disableMargin?: boolean
90
+ storeSwitcher?: React.ReactNode
91
+ socialLinks?: React.ReactElement
92
+ customerService?: React.ReactNode
93
+ copyright?: React.ReactElement
94
+ } & Omit<ContainerProps, 'children'>
95
+
96
+ export default function Footer(props: FooterProps) {
97
+ const {
98
+ disableMargin,
99
+ socialLinks,
100
+ storeSwitcher,
101
+ customerService,
102
+ copyright,
103
+ ...containerProps
104
+ } = props
105
+ const classes = useStyles(props)
106
+
107
+ return (
108
+ <Container
109
+ maxWidth={false}
110
+ className={clsx(classes.footer, disableMargin && classes.disableMargin)}
111
+ {...containerProps}
112
+ >
113
+ <div className={classes.social}>{socialLinks}</div>
114
+ <div className={classes.storeSwitcher}>{storeSwitcher}</div>
115
+ <div className={classes.support}>{customerService}</div>
116
+ <div className={classes.copyright}>{copyright}</div>
117
+ </Container>
118
+ )
119
+ }
@@ -1,5 +1,5 @@
1
1
  import { makeStyles, Theme } from '@material-ui/core'
2
- import { m } from 'framer-motion'
2
+ import clsx from 'clsx'
3
3
  import React from 'react'
4
4
  import { UseStyles } from '../Styles'
5
5
  import AppShellProvider from './AppShellProvider'
@@ -14,6 +14,13 @@ const useStyles = makeStyles(
14
14
  gridTemplateRows: `auto 1fr auto`,
15
15
  gridTemplateColumns: '100%',
16
16
  },
17
+ hideFabsOnVirtualKeyboardOpen: {
18
+ [theme.breakpoints.down('sm')]: {
19
+ '@media (max-height: 530px)': {
20
+ display: 'none',
21
+ },
22
+ },
23
+ },
17
24
  header: {
18
25
  display: 'flex',
19
26
  alignItems: 'center',
@@ -29,6 +36,12 @@ const useStyles = makeStyles(
29
36
  height: theme.page.headerInnerHeight.md,
30
37
  },
31
38
  },
39
+ headerAlwaysShow: {
40
+ [theme.breakpoints.down('sm')]: {
41
+ marginTop: 20,
42
+ marginBottom: 22,
43
+ },
44
+ },
32
45
  }),
33
46
  { name: 'FullPageShellBase' },
34
47
  )
@@ -36,20 +49,31 @@ const useStyles = makeStyles(
36
49
  export type FullPageShellBaseProps = {
37
50
  header: React.ReactNode
38
51
  footer: React.ReactNode
52
+ menuFab?: React.ReactNode
53
+ cartFab?: React.ReactNode
39
54
  children?: React.ReactNode
55
+ alwaysShowHeader?: boolean
40
56
  } & UseStyles<typeof useStyles> &
41
57
  PageLayoutBaseProps
42
58
 
43
59
  export default function FullPageShellBase(props: FullPageShellBaseProps) {
44
- const { children, header, footer, name } = props
60
+ const { children, header, footer, menuFab, cartFab, name, alwaysShowHeader } = props
45
61
  const classes = useStyles(props)
46
62
 
47
63
  return (
48
64
  <div className={classes.root}>
49
65
  <AppShellProvider>
50
66
  <ShellBase name={name}>
51
- <header className={classes.header}>{header}</header>
52
- <div>{children}</div>
67
+ <header className={clsx(classes.header, alwaysShowHeader && classes.headerAlwaysShow)}>
68
+ {header}
69
+ </header>
70
+ <div>
71
+ <div className={classes.hideFabsOnVirtualKeyboardOpen}>
72
+ {menuFab}
73
+ {cartFab}
74
+ </div>
75
+ {children}
76
+ </div>
53
77
  <div>{footer}</div>
54
78
  </ShellBase>
55
79
  </AppShellProvider>
@@ -0,0 +1,55 @@
1
+ import { Image, ImageProps } from '@graphcommerce/image'
2
+ import { makeStyles, Theme, useTheme } from '@material-ui/core'
3
+ import clsx from 'clsx'
4
+ import PageLink from 'next/link'
5
+ import React from 'react'
6
+ import { UseStyles } from '../Styles'
7
+
8
+ const useStyles = makeStyles(
9
+ (theme: Theme) => ({
10
+ logo: {},
11
+ link: {
12
+ height: '100%',
13
+ width: 'max-content',
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ margin: '0 auto',
17
+ justifyContent: 'center',
18
+ [theme.breakpoints.up('md')]: {
19
+ display: 'flex',
20
+ margin: 'unset',
21
+ justifyContent: 'left',
22
+ },
23
+ },
24
+ logoHideOnMobile: {
25
+ display: 'none',
26
+ [theme.breakpoints.up('md')]: {
27
+ display: 'unset',
28
+ },
29
+ },
30
+ }),
31
+ { name: 'Logo' },
32
+ )
33
+
34
+ export type LogoProps = {
35
+ href?: `/${string}`
36
+ image: ImageProps
37
+ alwaysShow?: boolean
38
+ } & UseStyles<typeof useStyles>
39
+
40
+ export default function Logo(props: LogoProps) {
41
+ const { href, alwaysShow, image } = props
42
+ const classes = useStyles(props)
43
+ const theme = useTheme()
44
+
45
+ return (
46
+ <PageLink href={href ?? '/'} passHref>
47
+ <a className={classes.link}>
48
+ <Image
49
+ {...{ ...image }}
50
+ className={clsx(classes.logo, !alwaysShow && classes.logoHideOnMobile)}
51
+ />
52
+ </a>
53
+ </PageLink>
54
+ )
55
+ }
@@ -67,10 +67,14 @@ const useStyles = makeStyles(
67
67
  )
68
68
 
69
69
  export type MenuFabProps = MenuProps &
70
- UseStyles<typeof useStyles> & { children?: React.ReactNode; search?: React.ReactNode }
70
+ UseStyles<typeof useStyles> & {
71
+ children?: React.ReactNode
72
+ search?: React.ReactNode
73
+ menuIcon?: React.ReactNode
74
+ }
71
75
 
72
76
  export default function MenuFab(props: MenuFabProps) {
73
- const { menu, children, search } = props
77
+ const { menu, children, search, menuIcon } = props
74
78
  const classes = useStyles(props)
75
79
  const router = useRouter()
76
80
  const [openEl, setOpenEl] = React.useState<null | HTMLElement>(null)
@@ -88,7 +92,7 @@ export default function MenuFab(props: MenuFabProps) {
88
92
  onClick={(event) => setOpenEl(event.currentTarget)}
89
93
  className={classes.menuFab}
90
94
  >
91
- <SvgImageSimple src={iconMenu} inverted />
95
+ {menuIcon ?? <SvgImageSimple src={iconMenu} inverted />}
92
96
  </Fab>
93
97
 
94
98
  <Menu
@@ -0,0 +1,27 @@
1
+ import { Fab, FabProps, makeStyles } from '@material-ui/core'
2
+ import React from 'react'
3
+ import { UseStyles } from '../../Styles'
4
+
5
+ const useStyles = makeStyles(
6
+ () => ({
7
+ placeholderCartFab: {
8
+ boxShadow: 'none',
9
+ background: 'none',
10
+ pointerEvents: 'none',
11
+ },
12
+ }),
13
+ { name: 'FullPageShell' },
14
+ )
15
+
16
+ type PlaceholderFabProps = Omit<FabProps, 'children'> & UseStyles<typeof useStyles>
17
+
18
+ export default function PlaceholderFab(props: PlaceholderFabProps) {
19
+ const { ...fabProps } = props
20
+ const classes = useStyles(props)
21
+
22
+ return (
23
+ <Fab className={classes.placeholderCartFab} size='large' {...fabProps}>
24
+ <></>
25
+ </Fab>
26
+ )
27
+ }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,45 @@
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.13.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.13.0...@graphcommerce/next-ui@3.13.1) (2021-11-03)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * logo shouldnt invert, because it depends on the logo if it can be inverted. ([8426b09](https://github.com/ho-nl/m2-pwa/commit/8426b09688c7c77f45f912c56684ad1f378fc263))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.13.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.12.4...@graphcommerce/next-ui@3.13.0) (2021-11-03)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **full-page-shell:** show logo on mobile ([abe2af7](https://github.com/ho-nl/m2-pwa/commit/abe2af7001ce9a31ba67a9fa326c50a07fe86135))
23
+ * **logo:** correct props propagation ([968025b](https://github.com/ho-nl/m2-pwa/commit/968025bc0bed4843cce7d11c0ef2740edb2ea02b))
24
+
25
+
26
+ ### Features
27
+
28
+ * **next-ui:** introducing footer component ([a98129b](https://github.com/ho-nl/m2-pwa/commit/a98129b935b9fd45e985f958a60a4ad6b21c880c))
29
+
30
+
31
+
32
+
33
+
34
+ ## [3.12.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.12.2...@graphcommerce/next-ui@3.12.3) (2021-11-02)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * **MenuFab:** make icon customizable ([375bafd](https://github.com/ho-nl/m2-pwa/commit/375bafd901b3c53405e02d681ea0dca3af190e35))
40
+
41
+
42
+
43
+
44
+
6
45
  ## [3.12.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/next-ui@3.12.1...@graphcommerce/next-ui@3.12.2) (2021-11-02)
7
46
 
8
47
 
@@ -51,15 +51,15 @@ const useStyles = makeStyles(
51
51
  color: theme.palette.text.primary,
52
52
  },
53
53
  }),
54
- { name: 'RowImageText' },
54
+ { name: 'ImageText' },
55
55
  )
56
56
 
57
- export type RowImageTextProps = UseStyles<typeof useStyles> & {
57
+ export type ImageTextProps = UseStyles<typeof useStyles> & {
58
58
  item?: React.ReactNode
59
59
  children: React.ReactNode
60
60
  }
61
61
 
62
- export default function RowImageText(props: RowImageTextProps) {
62
+ export default function ImageText(props: ImageTextProps) {
63
63
  const { item, children } = props
64
64
  const classes = useStyles(props)
65
65
 
@@ -1,4 +1,4 @@
1
- import { Container, makeStyles, Theme } from '@material-ui/core'
1
+ import { makeStyles, Theme } from '@material-ui/core'
2
2
  import React from 'react'
3
3
  import Row from '..'
4
4
  import { UseStyles } from '../../Styles'
@@ -52,15 +52,15 @@ const useStyles = makeStyles(
52
52
  color: theme.palette.text.primary,
53
53
  },
54
54
  }),
55
- { name: 'RowImageTextBoxed' },
55
+ { name: 'ImageTextBoxed' },
56
56
  )
57
57
 
58
- export type RowImageTextBoxedProps = UseStyles<typeof useStyles> & {
58
+ export type ImageTextBoxedProps = UseStyles<typeof useStyles> & {
59
59
  children: React.ReactNode
60
60
  item?: React.ReactNode
61
61
  }
62
62
 
63
- export default function RowImageTextBoxed(props: RowImageTextBoxedProps) {
63
+ export default function ImageTextBoxed(props: ImageTextBoxedProps) {
64
64
  const { children, item } = props
65
65
  const classes = useStyles(props)
66
66
 
package/index.ts CHANGED
@@ -16,13 +16,18 @@ export { default as FixedFab } from './AppShell/FixedFab'
16
16
  export * from './AppShell/ForwardButton'
17
17
  export { default as ForwardButton } from './AppShell/ForwardButton'
18
18
  export * from './AppShell/FullPageShellBase'
19
+ export { default as Logo } from './AppShell/Logo'
20
+ export * from './AppShell/Logo'
19
21
  export { default as FullPageShellBase } from './AppShell/FullPageShellBase'
20
22
  export * from './AppShell/Menu'
21
23
  export * from './AppShell/MenuFab'
22
24
  export { default as MenuFab } from './AppShell/MenuFab'
23
25
  export * from './AppShell/MenuFabSecondaryItem'
26
+ export { default as Footer } from './AppShell/Footer'
24
27
  export { default as MenuFabSecondaryItem } from './AppShell/MenuFabSecondaryItem'
28
+ export { default as SocialIcon } from './AppShell/Footer/SocialIcon'
25
29
  export * from './AppShell/PageShellHeader'
30
+ export { default as PlaceholderFab } from './AppShell/PlaceholderFab'
26
31
  export { default as PageShellHeader } from './AppShell/PageShellHeader'
27
32
  export * from './AppShell/SheetShellBase'
28
33
  export { default as SheetShellBase } from './AppShell/SheetShellBase'
@@ -119,10 +124,10 @@ export * from './Row/ParagraphWithSidebarSlide'
119
124
  export { default as ParagraphWithSidebarSlide } from './Row/ParagraphWithSidebarSlide'
120
125
  export * from './Row/Quote'
121
126
  export { default as Quote } from './Row/Quote'
122
- export * from './Row/RowImageText'
123
- export { default as RowImageText } from './Row/RowImageText'
124
- export * from './Row/RowImageTextBoxed'
125
- export { default as RowImageTextBoxed } from './Row/RowImageTextBoxed'
127
+ export * from './Row/ImageText'
128
+ export { default as ImageText } from './Row/ImageText'
129
+ export * from './Row/ImageTextBoxed'
130
+ export { default as ImageTextBoxed } from './Row/ImageTextBoxed'
126
131
  export * from './Row/SpecialBanner'
127
132
  export { default as SpecialBanner } from './Row/SpecialBanner'
128
133
  export * from './SectionContainer'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/next-ui",
3
- "version": "3.12.2",
3
+ "version": "3.13.1",
4
4
  "author": "",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -11,10 +11,10 @@
11
11
  "dependencies": {
12
12
  "@apollo/client": "^3.4.16",
13
13
  "@graphcommerce/framer-next-pages": "^2.107.3",
14
- "@graphcommerce/framer-scroller": "^0.4.3",
14
+ "@graphcommerce/framer-scroller": "^1.0.1",
15
15
  "@graphcommerce/framer-sheet": "^2.105.15",
16
16
  "@graphcommerce/framer-utils": "^2.103.13",
17
- "@graphcommerce/graphql": "^2.105.2",
17
+ "@graphcommerce/graphql": "^2.105.3",
18
18
  "@graphcommerce/image": "^2.105.2",
19
19
  "@graphql-typed-document-node/core": "^3.1.0",
20
20
  "@material-ui/core": "^4.12.3",
@@ -53,5 +53,5 @@
53
53
  "project": "./tsconfig.json"
54
54
  }
55
55
  },
56
- "gitHead": "afae9da3ec938f2c088c254bcde22e1db2636ace"
56
+ "gitHead": "c9eac9065491268d26c187d9fe864f7e9232c0fb"
57
57
  }