@graphcommerce/next-ui 3.0.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.
Files changed (153) hide show
  1. package/.babelrc +3 -0
  2. package/AnimatedRow/index.tsx +20 -0
  3. package/ApolloError/ApolloErrorAlert.tsx +59 -0
  4. package/ApolloError/ApolloErrorFullPage.tsx +25 -0
  5. package/AppShell/AppShellHeader/appShellHeaderContext.tsx +11 -0
  6. package/AppShell/AppShellHeader/index.tsx +433 -0
  7. package/AppShell/AppShellHeader/useAppShellHeaderContext.tsx +6 -0
  8. package/AppShell/AppShellProvider/index.tsx +18 -0
  9. package/AppShell/AppShellSticky/index.tsx +66 -0
  10. package/AppShell/AppShellTitle/index.tsx +45 -0
  11. package/AppShell/DesktopNavActions.tsx +28 -0
  12. package/AppShell/DesktopNavBar.tsx +110 -0
  13. package/AppShell/FixedFab.tsx +41 -0
  14. package/AppShell/ForwardButton.tsx +53 -0
  15. package/AppShell/FullPageShellBase.tsx +59 -0
  16. package/AppShell/Menu.tsx +7 -0
  17. package/AppShell/MenuFab.tsx +132 -0
  18. package/AppShell/MenuFabSecondaryItem.tsx +32 -0
  19. package/AppShell/MinimalPageShellBase.tsx +22 -0
  20. package/AppShell/PageShellHeader/index.tsx +14 -0
  21. package/AppShell/SheetShellBase/index.tsx +107 -0
  22. package/AppShell/SheetShellBase/useSheetStyles.ts +11 -0
  23. package/AppShell/SheetShellDragIndicator/index.tsx +48 -0
  24. package/AppShell/SheetShellHeader/index.tsx +28 -0
  25. package/AppShell/ShellBase.tsx +45 -0
  26. package/AppShell/useFabAnimation.tsx +19 -0
  27. package/AppShell/useFixedFabAnimation.tsx +18 -0
  28. package/AspectRatioContainer/index.tsx +27 -0
  29. package/Blog/BlogAuthor/index.tsx +60 -0
  30. package/Blog/BlogContent/index.tsx +24 -0
  31. package/Blog/BlogHeader/index.tsx +64 -0
  32. package/Blog/BlogList/index.tsx +27 -0
  33. package/Blog/BlogListItem/index.tsx +83 -0
  34. package/Blog/BlogTags/index.tsx +34 -0
  35. package/Blog/BlogTitle/index.tsx +29 -0
  36. package/Button/index.tsx +164 -0
  37. package/ButtonLink/index.tsx +45 -0
  38. package/CHANGELOG.md +1095 -0
  39. package/ChipMenu/index.tsx +130 -0
  40. package/ContainerWithHeader/index.tsx +49 -0
  41. package/Debug/DebugSpacer.tsx +51 -0
  42. package/FlagAvatar/index.tsx +28 -0
  43. package/Form/FormActions.tsx +15 -0
  44. package/Form/FormDivider.tsx +14 -0
  45. package/Form/FormHeader.tsx +27 -0
  46. package/Form/FormRow.tsx +14 -0
  47. package/Form/InputCheckmark.tsx +19 -0
  48. package/Form/index.tsx +62 -0
  49. package/FramerNextPagesSlider/Slide.tsx +71 -0
  50. package/FramerNextPagesSlider/Slider.tsx +39 -0
  51. package/FramerNextPagesSlider/index.ts +1 -0
  52. package/FramerNextPagesSlider/types.ts +3 -0
  53. package/FramerScroller/components/SidebarGallery.tsx +246 -0
  54. package/FramerScroller/components/SidebarSlider.tsx +103 -0
  55. package/FullPageMessage/index.tsx +68 -0
  56. package/Highlight/index.tsx +14 -0
  57. package/IconHeader/index.tsx +109 -0
  58. package/JsonLd/index.tsx +18 -0
  59. package/Page/App.tsx +15 -0
  60. package/Page/Document.tsx +23 -0
  61. package/Page/framerFeatures.ts +4 -0
  62. package/Page/types.ts +19 -0
  63. package/PageLoadIndicator/index.tsx +46 -0
  64. package/PageMeta/index.tsx +40 -0
  65. package/Pagination/index.tsx +123 -0
  66. package/RenderType/index.tsx +40 -0
  67. package/Row/ButtonLinkList/index.tsx +53 -0
  68. package/Row/ColumnOne/index.tsx +11 -0
  69. package/Row/ColumnOneBoxed/index.tsx +27 -0
  70. package/Row/ColumnOneCentered/index.tsx +22 -0
  71. package/Row/ColumnThree/index.tsx +66 -0
  72. package/Row/ColumnTwo/index.tsx +44 -0
  73. package/Row/ColumnTwoSpread/index.tsx +41 -0
  74. package/Row/ColumnTwoWithTop/index.tsx +53 -0
  75. package/Row/ContentLinks/index.tsx +48 -0
  76. package/Row/HeroBanner/index.tsx +102 -0
  77. package/Row/IconBlocks/IconBlock/index.tsx +56 -0
  78. package/Row/IconBlocks/index.tsx +57 -0
  79. package/Row/ParagraphWithSidebarSlide/index.tsx +114 -0
  80. package/Row/Quote/index.tsx +13 -0
  81. package/Row/RowImageText/index.tsx +67 -0
  82. package/Row/RowImageTextBoxed/index.tsx +75 -0
  83. package/Row/SpecialBanner/index.tsx +107 -0
  84. package/Row/index.tsx +13 -0
  85. package/SectionContainer/index.tsx +39 -0
  86. package/SectionHeader/index.tsx +69 -0
  87. package/Separator/index.tsx +33 -0
  88. package/Snackbar/ErrorSnackbar.tsx +9 -0
  89. package/Snackbar/MessageSnackbar.tsx +5 -0
  90. package/Snackbar/MessageSnackbarImpl.tsx +202 -0
  91. package/StarRatingField/index.tsx +58 -0
  92. package/Stepper/Stepper.tsx +45 -0
  93. package/StyledBadge/index.tsx +21 -0
  94. package/Styles/index.tsx +3 -0
  95. package/Styles/responsiveVal.tsx +20 -0
  96. package/SvgImage/SvgImageSimple.tsx +66 -0
  97. package/SvgImage/index.tsx +76 -0
  98. package/TextInputNumber/index.tsx +169 -0
  99. package/Theme/types.ts +63 -0
  100. package/TimeAgo/index.tsx +29 -0
  101. package/Title/index.tsx +71 -0
  102. package/ToggleButton/index.tsx +100 -0
  103. package/ToggleButtonGroup/index.tsx +112 -0
  104. package/UspList/UspListItem.tsx +46 -0
  105. package/UspList/index.tsx +32 -0
  106. package/icons/icon_addresses.svg +17 -0
  107. package/icons/icon_arrow_back.svg +1 -0
  108. package/icons/icon_arrow_forward.svg +1 -0
  109. package/icons/icon_box.svg +6 -0
  110. package/icons/icon_chat.svg +1 -0
  111. package/icons/icon_checkmark.svg +1 -0
  112. package/icons/icon_checkmark_green.svg +1 -0
  113. package/icons/icon_chevron_back.svg +8 -0
  114. package/icons/icon_chevron_down.svg +8 -0
  115. package/icons/icon_chevron_left.svg +8 -0
  116. package/icons/icon_chevron_right.svg +8 -0
  117. package/icons/icon_chevron_up.svg +8 -0
  118. package/icons/icon_close.svg +6 -0
  119. package/icons/icon_close_circle.svg +1 -0
  120. package/icons/icon_collapse_vertical.svg +11 -0
  121. package/icons/icon_customer_service.svg +6 -0
  122. package/icons/icon_email.svg +1 -0
  123. package/icons/icon_email_outline.svg +6 -0
  124. package/icons/icon_expand_vertical.svg +11 -0
  125. package/icons/icon_heart.svg +15 -0
  126. package/icons/icon_home.svg +6 -0
  127. package/icons/icon_id.svg +6 -0
  128. package/icons/icon_invoice_red.svg +7 -0
  129. package/icons/icon_location_red.svg +7 -0
  130. package/icons/icon_lock.svg +6 -0
  131. package/icons/icon_menu.svg +1 -0
  132. package/icons/icon_min.svg +1 -0
  133. package/icons/icon_newspaper.svg +6 -0
  134. package/icons/icon_party.svg +7 -0
  135. package/icons/icon_person.svg +6 -0
  136. package/icons/icon_person_alt.svg +6 -0
  137. package/icons/icon_person_alt_big.svg +15 -0
  138. package/icons/icon_phone.svg +1 -0
  139. package/icons/icon_plus.svg +1 -0
  140. package/icons/icon_sad_face.svg +11 -0
  141. package/icons/icon_sad_shoppingbag.svg +16 -0
  142. package/icons/icon_search.svg +1 -0
  143. package/icons/icon_shopping_bag.svg +7 -0
  144. package/icons/icon_shutdown.svg +6 -0
  145. package/icons/icon_star.svg +6 -0
  146. package/icons/icon_star_filled_muted.svg +6 -0
  147. package/icons/icon_star_yellow.svg +6 -0
  148. package/icons/index.tsx +42 -0
  149. package/index.ts +163 -0
  150. package/package.json +61 -0
  151. package/tsconfig.json +5 -0
  152. package/types.d.ts +13 -0
  153. package/useIntersectionObserver/index.tsx +31 -0
@@ -0,0 +1,56 @@
1
+ import { makeStyles, Theme, Typography } from '@material-ui/core'
2
+ import React, { useRef } from 'react'
3
+ import Button from '../../../Button'
4
+ import { UseStyles } from '../../../Styles'
5
+
6
+ const useStyles = makeStyles(
7
+ (theme: Theme) => ({
8
+ block: {
9
+ display: 'grid',
10
+ gridAutoFlow: 'row',
11
+ justifyItems: 'center',
12
+ gap: `${theme.spacings.xs}`,
13
+ border: `1px solid ${theme.palette.grey[300]}`,
14
+ padding: `${theme.spacings.sm}`,
15
+ borderRadius: '6px',
16
+ textAlign: 'center',
17
+ color: theme.palette.primary.contrastText,
18
+ },
19
+ link: {
20
+ textDecoration: 'none',
21
+ },
22
+ }),
23
+ { name: 'IconBlock' },
24
+ )
25
+
26
+ export type IconBlockProps = UseStyles<typeof useStyles> & {
27
+ title: string
28
+ icon: React.ReactNode
29
+ children: React.ReactNode
30
+ href?: string
31
+ }
32
+
33
+ const IconBlock = React.forwardRef<HTMLAnchorElement, IconBlockProps>((props, ref) => {
34
+ const { title, children, icon, href } = props
35
+ const classes = useStyles(props)
36
+
37
+ const content = (
38
+ <>
39
+ {icon}
40
+ <Typography variant='h6'>{title}</Typography>
41
+ {children}
42
+ </>
43
+ )
44
+
45
+ if (href) {
46
+ return (
47
+ <Button variant='text' color='primary' className={classes.block} ref={ref}>
48
+ <div>{content}</div>
49
+ </Button>
50
+ )
51
+ }
52
+
53
+ return <div className={classes.block}>{content}</div>
54
+ })
55
+
56
+ export default IconBlock
@@ -0,0 +1,57 @@
1
+ import { makeStyles, Theme, Typography } from '@material-ui/core'
2
+ import React from 'react'
3
+ import Row from '..'
4
+ import { UseStyles } from '../../Styles'
5
+ import responsiveVal from '../../Styles/responsiveVal'
6
+
7
+ const useStyles = makeStyles(
8
+ (theme: Theme) => ({
9
+ container: {
10
+ maxWidth: 820,
11
+ },
12
+ title: {
13
+ marginBottom: `${theme.spacings.md}`,
14
+ },
15
+ optionsWrapper: {
16
+ display: 'grid',
17
+ gridTemplateColumns: `repeat(auto-fill, minmax(${responsiveVal(150, 280)}, 1fr))`,
18
+ gap: `${theme.spacings.sm}`,
19
+ },
20
+ block: {
21
+ display: 'grid',
22
+ gridAutoFlow: 'row',
23
+ justifyItems: 'center',
24
+ gap: `${theme.spacings.xs}`,
25
+ border: `1px solid ${theme.palette.grey[300]}`,
26
+ padding: `${theme.spacings.sm}`,
27
+ borderRadius: '6px',
28
+ cursor: 'pointer',
29
+ textAlign: 'center',
30
+ },
31
+ wrapper: {
32
+ paddingTop: `${theme.spacings.lg}`,
33
+ },
34
+ }),
35
+ { name: 'ServiceOptions' },
36
+ )
37
+
38
+ export type IconBlocksProps = UseStyles<typeof useStyles> & {
39
+ title: string
40
+ children: React.ReactNode
41
+ }
42
+
43
+ export default function ServiceOptions(props: IconBlocksProps) {
44
+ const { title, children } = props
45
+ const classes = useStyles(props)
46
+
47
+ return (
48
+ <Row className={classes.container}>
49
+ <div className={classes.wrapper}>
50
+ <Typography variant='h5' className={classes.title}>
51
+ {title}
52
+ </Typography>
53
+ <div className={classes.optionsWrapper}>{children}</div>
54
+ </div>
55
+ </Row>
56
+ )
57
+ }
@@ -0,0 +1,114 @@
1
+ import { ContainerProps, makeStyles, Theme } from '@material-ui/core'
2
+ import { m, useSpring, useTransform, useViewportScroll } from 'framer-motion'
3
+ import React, { useEffect, useRef, useState } from 'react'
4
+ import Row from '..'
5
+ import { UseStyles } from '../../Styles'
6
+
7
+ const useStyles = makeStyles(
8
+ (theme: Theme) => ({
9
+ wrapper: {
10
+ overflow: 'hidden',
11
+ display: 'grid',
12
+ gridTemplateColumns: '1fr 1fr',
13
+ gap: `${theme.spacings.md}`,
14
+ [theme.breakpoints.up('md')]: {
15
+ gridTemplateColumns: '8fr 3fr',
16
+ },
17
+ },
18
+ backstory: {
19
+ position: 'relative',
20
+ '& img': {
21
+ position: 'absolute',
22
+ top: '0',
23
+ zIndex: 0,
24
+ width: '100%',
25
+ height: '100% !important',
26
+ objectFit: 'cover',
27
+ filter: 'brightness(80%)',
28
+ [theme.breakpoints.up('md')]: {
29
+ filter: 'brightness(100%)',
30
+ height: '100%',
31
+ },
32
+ },
33
+ },
34
+ copy: {
35
+ color: '#fff',
36
+ display: 'grid',
37
+ zIndex: 1,
38
+ justifyItems: 'start',
39
+ alignContent: 'end',
40
+ position: 'relative',
41
+ padding: `${theme.spacings.md}`,
42
+ '& > *': {
43
+ zIndex: 1,
44
+ maxWidth: 'max-content',
45
+ },
46
+ [theme.breakpoints.up('md')]: {
47
+ background: 'none',
48
+ width: '60%',
49
+ minHeight: '130vh',
50
+ },
51
+ [theme.breakpoints.up('lg')]: {
52
+ padding: `${theme.spacings.lg} ${theme.spacings.lg}`,
53
+ width: '50%',
54
+ },
55
+ },
56
+ slidingItems: {
57
+ maxWidth: '100%',
58
+ },
59
+ }),
60
+ { name: 'ParagraphWithSidebarSlide' },
61
+ )
62
+
63
+ export type ParagraphWithSidebarSlideProps = UseStyles<typeof useStyles> &
64
+ ContainerProps & {
65
+ slidingItems: React.ReactNode
66
+ background: React.ReactNode
67
+ children: React.ReactNode
68
+ }
69
+
70
+ export default function ParagraphWithSidebarSlide(props: ParagraphWithSidebarSlideProps) {
71
+ const { background, slidingItems, children, ...containerProps } = props
72
+ const classes = useStyles(props)
73
+
74
+ const [windowHeight, setHeight] = useState(0)
75
+ const [itemY, setItemY] = useState(0)
76
+ const [parentHeight, setParentHeight] = useState(0)
77
+ const sidebar = useRef<HTMLDivElement>(null)
78
+
79
+ useEffect(() => {
80
+ if (!sidebar.current) return () => {}
81
+ const ro = new ResizeObserver(([entry]) => {
82
+ if (entry.target instanceof HTMLElement) {
83
+ setParentHeight(entry.target.offsetHeight)
84
+ setHeight(window.innerHeight)
85
+ setItemY(entry.target.offsetTop)
86
+ }
87
+ })
88
+ ro.observe(sidebar.current)
89
+ return () => ro.disconnect()
90
+ }, [])
91
+
92
+ const { scrollY } = useViewportScroll()
93
+ const y = useSpring(
94
+ useTransform(
95
+ scrollY,
96
+ [itemY - windowHeight / 4, itemY + windowHeight / 2],
97
+ [0, parentHeight > windowHeight / 2 ? windowHeight / 2 : 0],
98
+ ),
99
+ )
100
+
101
+ return (
102
+ <Row maxWidth={false} {...containerProps}>
103
+ <div className={classes.wrapper}>
104
+ <div className={classes.backstory}>
105
+ <div className={classes.copy}>{children}</div>
106
+ {background}
107
+ </div>
108
+ <m.div ref={sidebar} transition={{ ease: 'linear' }} style={{ y }}>
109
+ {slidingItems}
110
+ </m.div>
111
+ </div>
112
+ </Row>
113
+ )
114
+ }
@@ -0,0 +1,13 @@
1
+ import { ContainerProps } from '@material-ui/core'
2
+ import React from 'react'
3
+ import Row from '..'
4
+
5
+ export type QuoteProps = {
6
+ children: React.ReactElement
7
+ } & ContainerProps
8
+
9
+ export default function Quote(props: QuoteProps) {
10
+ const { children, ...containerProps } = props
11
+
12
+ return <Row {...containerProps}>{children}</Row>
13
+ }
@@ -0,0 +1,67 @@
1
+ import { makeStyles, Theme } from '@material-ui/core'
2
+ import React from 'react'
3
+ import Row from '..'
4
+ import { UseStyles } from '../../Styles'
5
+
6
+ const useStyles = makeStyles(
7
+ (theme: Theme) => ({
8
+ wrapper: {
9
+ display: 'grid',
10
+ background: 'rgba(0,0,0,0.03)',
11
+ justifyItems: 'center',
12
+ columnGap: theme.spacings.lg,
13
+ padding: `${theme.spacings.xl} 0`,
14
+ [theme.breakpoints.up('md')]: {
15
+ padding: 0,
16
+ background: 'none',
17
+ gridTemplateColumns: '1fr 1fr',
18
+ },
19
+ },
20
+ asset: {
21
+ height: '100%',
22
+ width: '100%',
23
+ '& img': {
24
+ height: '100%',
25
+ width: '100%',
26
+ objectFit: 'cover',
27
+ },
28
+ },
29
+ copy: {
30
+ color: theme.palette.text.primary,
31
+ maxWidth: '80%',
32
+ display: 'grid',
33
+ alignContent: 'center',
34
+ [theme.breakpoints.up('md')]: {
35
+ maxWidth: '70%',
36
+ },
37
+ '& > *': {
38
+ maxWidth: 'max-content',
39
+ },
40
+ },
41
+ url: {
42
+ ...theme.typography.body2,
43
+ [theme.breakpoints.up('md')]: {
44
+ ...theme.typography.h4,
45
+ },
46
+ color: theme.palette.text.primary,
47
+ },
48
+ }),
49
+ { name: 'RowImageText' },
50
+ )
51
+
52
+ export type RowImageTextProps = UseStyles<typeof useStyles> & {
53
+ item?: React.ReactNode
54
+ children: React.ReactNode
55
+ }
56
+
57
+ export default function RowImageText(props: RowImageTextProps) {
58
+ const { item, children } = props
59
+ const classes = useStyles(props)
60
+
61
+ return (
62
+ <Row className={classes.wrapper}>
63
+ <div className={classes.asset}>{item}</div>
64
+ <div className={classes.copy}>{children}</div>
65
+ </Row>
66
+ )
67
+ }
@@ -0,0 +1,75 @@
1
+ import { Container, makeStyles, Theme } from '@material-ui/core'
2
+ import React from 'react'
3
+ import Row from '..'
4
+ import { UseStyles } from '../../Styles'
5
+ import responsiveVal from '../../Styles/responsiveVal'
6
+
7
+ const useStyles = makeStyles(
8
+ (theme: Theme) => ({
9
+ wrapper: {
10
+ display: 'grid',
11
+ border: `1px solid ${theme.palette.divider}`,
12
+ justifyItems: 'center',
13
+ columnGap: `${theme.spacings.lg}`,
14
+ padding: 0,
15
+ [theme.breakpoints.up('md')]: {
16
+ background: 'none',
17
+ gridTemplateColumns: '1fr auto',
18
+ columnGap: `${theme.spacings.lg}`,
19
+ },
20
+ },
21
+ asset: {
22
+ height: '100%',
23
+ width: '100%',
24
+ [theme.breakpoints.up('md')]: {
25
+ height: '100%',
26
+ width: responsiveVal(100, 600),
27
+ },
28
+ '& img': {
29
+ height: '100%',
30
+ width: '100%',
31
+ objectFit: `cover`,
32
+ },
33
+ },
34
+ copy: {
35
+ padding: `${theme.spacings.lg} 0`,
36
+ color: theme.palette.text.primary,
37
+ maxWidth: '80%',
38
+ display: 'grid',
39
+ alignContent: 'center',
40
+ [theme.breakpoints.up('md')]: {
41
+ maxWidth: '70%',
42
+ },
43
+ '& > *': {
44
+ maxWidth: 'max-content',
45
+ },
46
+ },
47
+ url: {
48
+ ...theme.typography.body2,
49
+ [theme.breakpoints.up('md')]: {
50
+ ...theme.typography.h4,
51
+ },
52
+ color: theme.palette.text.primary,
53
+ },
54
+ }),
55
+ { name: 'RowImageTextBoxed' },
56
+ )
57
+
58
+ export type RowImageTextBoxedProps = UseStyles<typeof useStyles> & {
59
+ children: React.ReactNode
60
+ item?: React.ReactNode
61
+ }
62
+
63
+ export default function RowImageTextBoxed(props: RowImageTextBoxedProps) {
64
+ const { children, item } = props
65
+ const classes = useStyles(props)
66
+
67
+ return (
68
+ <Row>
69
+ <div className={classes.wrapper}>
70
+ <div className={classes.copy}>{children}</div>
71
+ <div className={classes.asset}>{item}</div>
72
+ </div>
73
+ </Row>
74
+ )
75
+ }
@@ -0,0 +1,107 @@
1
+ import { ContainerProps, makeStyles, Theme, Typography } from '@material-ui/core'
2
+ import Row from '..'
3
+ import { UseStyles } from '../../Styles'
4
+ import responsiveVal from '../../Styles/responsiveVal'
5
+
6
+ const useStyles = makeStyles(
7
+ (theme: Theme) => ({
8
+ wrapper: {
9
+ display: 'grid',
10
+ background: 'rgba(0,0,0,0.03)',
11
+ justifyItems: 'center',
12
+ columnGap: `${theme.spacings.lg}`,
13
+ padding: `${theme.spacings.lg} 0`,
14
+ justifySelf: 'start',
15
+ [theme.breakpoints.up('md')]: {
16
+ padding: 0,
17
+ background: 'none',
18
+ justifySelf: 'center',
19
+ gridTemplateColumns: '1fr 1fr',
20
+ columnGap: `${theme.spacings.md}`,
21
+ },
22
+ },
23
+ asset: {
24
+ width: responsiveVal(200, 900),
25
+ height: 'auto',
26
+ '& img': {
27
+ width: responsiveVal(200, 900),
28
+ height: 'auto',
29
+ objectFit: 'cover',
30
+ },
31
+ [theme.breakpoints.up('lg')]: {
32
+ width: responsiveVal(250, 900),
33
+ height: 'auto',
34
+ '& img': {
35
+ width: responsiveVal(250, 900),
36
+ height: 'auto',
37
+ objectFit: 'cover',
38
+ },
39
+ },
40
+ [theme.breakpoints.between('md', 'lg')]: {
41
+ width: '100%',
42
+ '& img': {
43
+ width: '100%',
44
+ },
45
+ },
46
+ },
47
+ copy: {
48
+ color: theme.palette.text.primary,
49
+ maxWidth: '70%',
50
+ display: 'grid',
51
+ alignContent: 'center',
52
+ justifyContent: 'center',
53
+ '& > *': {
54
+ maxWidth: 'max-content',
55
+ },
56
+ },
57
+ topic: {
58
+ ...theme.typography.overline,
59
+ },
60
+ links: {
61
+ ...theme.typography.body2,
62
+ [theme.breakpoints.up('md')]: {
63
+ ...theme.typography.h4,
64
+ },
65
+ '& > *': {
66
+ color: theme.palette.text.primary,
67
+ },
68
+ },
69
+ textContainer: {
70
+ maxWidth: '70%',
71
+ [theme.breakpoints.up('md')]: {
72
+ maxWidth: '100%',
73
+ },
74
+ },
75
+ }),
76
+ { name: 'SpecialBanner' },
77
+ )
78
+
79
+ export type SpecialBannerProps = UseStyles<typeof useStyles> &
80
+ ContainerProps & {
81
+ asset: React.ReactNode
82
+ pageLinks?: React.ReactNode
83
+ topic: React.ReactNode
84
+ children: React.ReactNode
85
+ }
86
+
87
+ export default function SpecialBanner(props: SpecialBannerProps) {
88
+ const { asset, topic, pageLinks, children, ...containerProps } = props
89
+ const classes = useStyles()
90
+
91
+ return (
92
+ <Row maxWidth={false} {...containerProps}>
93
+ <div className={classes.wrapper}>
94
+ <div className={classes.asset}>{asset}</div>
95
+ <div className={classes.copy}>
96
+ {topic && (
97
+ <Typography variant='body2' className={classes.topic}>
98
+ {topic}
99
+ </Typography>
100
+ )}
101
+ <div className={classes.textContainer}>{children}</div>
102
+ <div className={classes.links}>{pageLinks}</div>
103
+ </div>
104
+ </div>
105
+ </Row>
106
+ )
107
+ }
package/Row/index.tsx ADDED
@@ -0,0 +1,13 @@
1
+ import { Container, styled } from '@material-ui/core'
2
+
3
+ const Row = styled(Container)(
4
+ ({ theme }) => ({
5
+ marginBottom: theme.spacings.lg,
6
+ [theme.breakpoints.up('md')]: {
7
+ marginBottom: `${theme.spacings.xl}`,
8
+ },
9
+ }),
10
+ { name: 'Row' },
11
+ )
12
+
13
+ export default Row
@@ -0,0 +1,39 @@
1
+ import { makeStyles, Theme } from '@material-ui/core'
2
+ import clsx from 'clsx'
3
+ import React, { PropsWithChildren } from 'react'
4
+ import SectionHeader, { SectionHeaderProps } from '../SectionHeader'
5
+ import { UseStyles } from '../Styles'
6
+
7
+ const useStyles = makeStyles(
8
+ (theme: Theme) => ({
9
+ sectionContainer: {},
10
+ sectionHeaderSidePadding: {},
11
+ sectionHeaderWrapper: {
12
+ borderBottom: `1px solid ${theme.palette.divider}`,
13
+ paddingBottom: theme.spacings.xxs,
14
+ marginBottom: theme.spacings.xxs,
15
+ },
16
+ labelLeft: {},
17
+ labelRight: {},
18
+ borderBottom: {
19
+ borderBottom: `1px solid ${theme.palette.divider}`,
20
+ },
21
+ }),
22
+ { name: 'SectionContainer' },
23
+ )
24
+
25
+ export type SectionContainerProps = PropsWithChildren<{ borderBottom?: boolean }> &
26
+ UseStyles<typeof useStyles> &
27
+ SectionHeaderProps
28
+
29
+ export default function SectionContainer(props: SectionContainerProps) {
30
+ const { children, borderBottom } = props
31
+ const { sectionContainer, borderBottom: borderBottomClass, ...classes } = useStyles(props)
32
+
33
+ return (
34
+ <div className={clsx(sectionContainer, { [borderBottomClass]: borderBottom })}>
35
+ <SectionHeader {...props} classes={classes} />
36
+ {children}
37
+ </div>
38
+ )
39
+ }
@@ -0,0 +1,69 @@
1
+ import { makeStyles, Theme, Typography, TypographyProps } 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
+ sectionHeaderSidePadding: {
9
+ paddingLeft: theme.spacings.xxs,
10
+ paddingRight: theme.spacings.xxs,
11
+ },
12
+ sectionHeaderWrapper: {
13
+ position: 'relative',
14
+ '&:focus': {
15
+ outline: 'none',
16
+ },
17
+ display: 'flex',
18
+ justifyContent: 'space-between',
19
+ alignItems: 'center',
20
+ marginTop: theme.spacings.sm,
21
+ marginBottom: theme.spacings.xxs,
22
+ },
23
+ labelLeft: {},
24
+ labelRight: {
25
+ color: theme.palette.primary.contrastText,
26
+ lineHeight: 1,
27
+ },
28
+ }),
29
+ { name: 'SectionHeader' },
30
+ )
31
+
32
+ export type SectionHeaderProps = {
33
+ variantLeft?: TypographyProps['variant']
34
+ variantRight?: TypographyProps['variant']
35
+ usePadding?: boolean
36
+ } & UseStyles<typeof useStyles> &
37
+ (
38
+ | { labelLeft: React.ReactNode; labelRight?: React.ReactNode }
39
+ | { labelLeft?: React.ReactNode; labelRight: React.ReactNode }
40
+ )
41
+
42
+ export default function SectionHeader(props: SectionHeaderProps) {
43
+ const {
44
+ labelLeft,
45
+ labelRight,
46
+ usePadding,
47
+ variantLeft = 'overline',
48
+ variantRight = 'body2',
49
+ } = props
50
+ const classes = useStyles(props)
51
+
52
+ return (
53
+ <div
54
+ className={clsx({
55
+ [classes.sectionHeaderWrapper]: true,
56
+ [classes.sectionHeaderSidePadding]: usePadding,
57
+ })}
58
+ >
59
+ <Typography className={classes.labelLeft} variant={variantLeft} component='div'>
60
+ {labelLeft}
61
+ </Typography>
62
+ {labelRight && (
63
+ <Typography className={classes.labelRight} variant={variantRight} component='div'>
64
+ {labelRight}
65
+ </Typography>
66
+ )}
67
+ </div>
68
+ )
69
+ }
@@ -0,0 +1,33 @@
1
+ import { makeStyles, Theme, Typography, TypographyProps } from '@material-ui/core'
2
+ import React from 'react'
3
+ import { UseStyles } from '../Styles'
4
+
5
+ export type DividedLinksProps = {
6
+ icon?: React.ReactNode
7
+ } & Pick<TypographyProps, 'color'> &
8
+ UseStyles<typeof useStyles>
9
+
10
+ const useStyles = makeStyles(
11
+ (theme: Theme) => ({
12
+ root: {
13
+ display: 'inline',
14
+ padding: `0 ${theme.spacings.xxs} 0 ${theme.spacings.xxs}`,
15
+ },
16
+ }),
17
+ { name: 'Separator' },
18
+ )
19
+
20
+ export default function Separator(props: DividedLinksProps) {
21
+ const { color, icon } = props
22
+ const classes = useStyles(props)
23
+
24
+ return (
25
+ <div className={classes.root}>
26
+ {icon ?? (
27
+ <Typography component='span' variant='body1' color={color}>
28
+ |
29
+ </Typography>
30
+ )}
31
+ </div>
32
+ )
33
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react'
2
+ import MessageSnackbar from './MessageSnackbar'
3
+ import { MessageSnackbarImplProps } from './MessageSnackbarImpl'
4
+
5
+ export type ErrorSnackbarProps = Omit<MessageSnackbarImplProps, 'severity' | 'action'>
6
+
7
+ export default function ErrorSnackbarImpl(props: ErrorSnackbarProps) {
8
+ return <MessageSnackbar {...props} />
9
+ }
@@ -0,0 +1,5 @@
1
+ import dynamic from 'next/dynamic'
2
+
3
+ /** Always load the MessageSnackbar dynamically */
4
+ const MessageSnackbar = dynamic(() => import('./MessageSnackbarImpl'), { ssr: false })
5
+ export default MessageSnackbar