@graphcommerce/next-ui 3.25.3 → 4.1.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.
Files changed (140) hide show
  1. package/AnimatedRow/index.tsx +6 -3
  2. package/ApolloError/ApolloErrorAlert.tsx +20 -21
  3. package/ApolloError/ApolloErrorFullPage.tsx +3 -4
  4. package/ApolloError/ApolloErrorSnackbar.tsx +3 -3
  5. package/Blog/BlogAuthor/index.tsx +42 -48
  6. package/Blog/BlogContent/index.tsx +6 -23
  7. package/Blog/BlogHeader/index.tsx +26 -23
  8. package/Blog/BlogList/index.tsx +7 -25
  9. package/Blog/BlogListItem/index.tsx +63 -52
  10. package/Blog/BlogTags/BlogTag.tsx +27 -0
  11. package/Blog/BlogTags/index.tsx +7 -32
  12. package/Blog/BlogTitle/index.tsx +7 -21
  13. package/Button/Button.tsx +5 -0
  14. package/Button/LinkOrButton.tsx +80 -0
  15. package/Button/index.tsx +2 -177
  16. package/CHANGELOG.md +524 -645
  17. package/ChipMenu/index.tsx +71 -77
  18. package/ContainerWithHeader/index.tsx +33 -30
  19. package/FlagAvatar/index.tsx +2 -12
  20. package/Footer/Footer.tsx +105 -88
  21. package/Footer/index.ts +0 -1
  22. package/Form/Form.tsx +35 -0
  23. package/Form/FormActions.tsx +9 -14
  24. package/Form/FormDivider.tsx +8 -13
  25. package/Form/FormHeader.tsx +5 -26
  26. package/Form/FormRow.tsx +8 -13
  27. package/Form/InputCheckmark.tsx +9 -22
  28. package/FramerScroller/SidebarGallery.tsx +340 -0
  29. package/FramerScroller/SidebarSlider.tsx +107 -0
  30. package/FramerScroller/index.ts +2 -0
  31. package/FullPageMessage/index.tsx +52 -48
  32. package/Highlight/index.tsx +1 -1
  33. package/IconHeader/index.tsx +63 -58
  34. package/JsonLd/index.tsx +3 -2
  35. package/Layout/components/LayoutHeader.tsx +75 -82
  36. package/Layout/components/LayoutHeaderBack.tsx +26 -18
  37. package/Layout/components/LayoutHeaderClose.tsx +9 -22
  38. package/Layout/components/LayoutHeaderContent.tsx +190 -154
  39. package/Layout/components/LayoutHeadertypes.ts +1 -1
  40. package/Layout/components/LayoutTitle.tsx +60 -55
  41. package/LayoutDefault/components/LayoutDefault.tsx +96 -85
  42. package/LayoutOverlay/components/LayoutOverlay.tsx +2 -8
  43. package/LayoutOverlay/components/LayoutOverlayBase.tsx +233 -239
  44. package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
  45. package/LayoutParts/DesktopHeaderBadge.tsx +28 -0
  46. package/LayoutParts/DesktopNavActions.tsx +15 -0
  47. package/LayoutParts/DesktopNavBar.tsx +113 -0
  48. package/LayoutParts/DesktopNavBarItem.tsx +44 -0
  49. package/{AppShell → LayoutParts}/GlobalHead.tsx +1 -2
  50. package/LayoutParts/Logo.tsx +77 -0
  51. package/LayoutParts/MenuFab.tsx +132 -0
  52. package/LayoutParts/MenuFabItem.tsx +25 -0
  53. package/LayoutParts/MenuFabSecondaryItem.tsx +37 -0
  54. package/{AppShell/PlaceholderFab/index.tsx → LayoutParts/PlaceholderFab.tsx} +1 -1
  55. package/LayoutParts/StickyBelowHeader.tsx +25 -0
  56. package/LayoutParts/index.ts +12 -0
  57. package/{AppShell → LayoutParts}/useFabAnimation.ts +0 -0
  58. package/Page/CssAndFramerMotionProvider.tsx +21 -0
  59. package/Page/index.ts +2 -0
  60. package/Page/types.ts +2 -8
  61. package/PageLoadIndicator/index.tsx +25 -30
  62. package/PageMeta/index.tsx +1 -1
  63. package/Pagination/index.tsx +37 -54
  64. package/RenderType/index.tsx +1 -1
  65. package/Row/ButtonLinkList/ButtonLinkList.tsx +35 -37
  66. package/Row/ButtonLinkList/ButtonLinkListItem.tsx +16 -33
  67. package/Row/ColumnOne/index.tsx +5 -10
  68. package/Row/ColumnOneBoxed/index.tsx +18 -19
  69. package/Row/ColumnOneCentered/index.tsx +3 -4
  70. package/Row/ColumnThree/index.tsx +62 -57
  71. package/Row/ColumnTwo/index.tsx +37 -32
  72. package/Row/ColumnTwoSpread/index.tsx +28 -37
  73. package/Row/ColumnTwoWithTop/index.tsx +37 -43
  74. package/Row/ContentLinks/index.tsx +24 -25
  75. package/Row/HeroBanner/index.tsx +98 -82
  76. package/Row/IconBlocks/IconBlock/index.tsx +45 -37
  77. package/Row/IconBlocks/index.tsx +29 -44
  78. package/Row/ImageText/index.tsx +71 -67
  79. package/Row/ImageTextBoxed/index.tsx +66 -65
  80. package/Row/ParagraphWithSidebarSlide/index.tsx +80 -76
  81. package/Row/Quote/index.tsx +3 -3
  82. package/Row/SpecialBanner/index.tsx +97 -97
  83. package/Row/index.tsx +4 -9
  84. package/SectionContainer/index.tsx +32 -31
  85. package/SectionHeader/index.tsx +41 -43
  86. package/Separator/index.tsx +19 -18
  87. package/Snackbar/MessageSnackbar.tsx +1 -2
  88. package/Snackbar/MessageSnackbarImpl.tsx +68 -115
  89. package/StarRatingField/index.tsx +24 -25
  90. package/Stepper/Stepper.tsx +34 -32
  91. package/Styles/EmotionProvider.tsx +14 -0
  92. package/Styles/breakpointVal.tsx +16 -10
  93. package/Styles/extendableComponent.ts +70 -0
  94. package/Styles/index.tsx +9 -2
  95. package/Styles/withEmotionCache.tsx +36 -0
  96. package/Styles/withTheme.tsx +15 -24
  97. package/SvgIcon/SvgIcon.tsx +60 -0
  98. package/TextInputNumber/index.tsx +49 -50
  99. package/Theme/DarkLightModeThemeProvider.tsx +119 -0
  100. package/Theme/MuiButton.ts +128 -0
  101. package/Theme/MuiSlider.ts +28 -0
  102. package/Theme/MuiSnackbar.ts +31 -0
  103. package/Theme/{types.ts → createTheme.ts} +8 -2
  104. package/Theme/index.ts +5 -0
  105. package/Theme/themeDefaults.ts +51 -0
  106. package/TimeAgo/index.tsx +1 -1
  107. package/ToggleButton/index.tsx +43 -49
  108. package/ToggleButtonGroup/index.tsx +39 -39
  109. package/UspList/UspListItem.tsx +56 -46
  110. package/UspList/index.tsx +29 -26
  111. package/docs/building-components.mdx +3 -0
  112. package/docs/components/ComponentBasic.tsx +26 -0
  113. package/docs/components/ComponentChild.tsx +48 -0
  114. package/docs/components/ComponentChildVariant.tsx +54 -0
  115. package/docs/components/ComponentChildVariantExtendable.tsx +62 -0
  116. package/docs/components/ComponentStylable.tsx +32 -0
  117. package/docs/pages/building-components.tsx +62 -0
  118. package/icons/index.tsx +2 -0
  119. package/index.ts +27 -81
  120. package/package.json +27 -27
  121. package/types.d.ts +1 -1
  122. package/AppShell/AppShellSticky/index.tsx +0 -38
  123. package/AppShell/DesktopNavActions.tsx +0 -32
  124. package/AppShell/DesktopNavBar.tsx +0 -158
  125. package/AppShell/Logo.tsx +0 -46
  126. package/AppShell/Menu.tsx +0 -7
  127. package/AppShell/MenuFab.tsx +0 -162
  128. package/AppShell/MenuFabSecondaryItem.tsx +0 -32
  129. package/AppShell/index.ts +0 -15
  130. package/AspectRatioContainer/index.tsx +0 -27
  131. package/Footer/SocialIcon.tsx +0 -23
  132. package/Form/index.tsx +0 -67
  133. package/FramerScroller/components/SidebarGallery.tsx +0 -317
  134. package/FramerScroller/components/SidebarSlider.tsx +0 -97
  135. package/Page/App.tsx +0 -17
  136. package/Page/Document.tsx +0 -24
  137. package/StyledBadge/index.tsx +0 -20
  138. package/Styles/classesPicker.ts +0 -41
  139. package/SvgImage/SvgImageSimple.tsx +0 -100
  140. package/SvgImage/index.tsx +0 -74
@@ -1,158 +0,0 @@
1
- import { Scroller, ScrollerButton, ScrollerProvider } from '@graphcommerce/framer-scroller'
2
- import { Link, LinkProps as MuiLinkProps, makeStyles, Theme } from '@material-ui/core'
3
- import clsx from 'clsx'
4
- import { m } from 'framer-motion'
5
- import PageLink from 'next/link'
6
- import { useRouter } from 'next/router'
7
- import React from 'react'
8
- import { UseStyles } from '../Styles'
9
- import SvgImageSimple from '../SvgImage/SvgImageSimple'
10
- import { iconChevronLeft, iconChevronRight } from '../icons'
11
- import { MenuProps } from './Menu'
12
-
13
- const useStyles = makeStyles(
14
- (theme: Theme) => ({
15
- container: {
16
- minWidth: 200,
17
- flex: 1,
18
- position: 'relative',
19
- pointerEvents: 'all',
20
- [theme.breakpoints.down('sm')]: {
21
- display: 'none',
22
- },
23
- },
24
- scroller: {
25
- display: 'grid',
26
- columnGap: 40,
27
- padding: '0 40px',
28
- minHeight: 40,
29
- gridAutoColumns: 'min-content',
30
- },
31
- prevNextBtnWrapper: {
32
- position: 'absolute',
33
- top: 0,
34
- },
35
- left: {
36
- left: 0,
37
- },
38
- right: {
39
- right: 0,
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
- },
58
- link: {
59
- whiteSpace: 'nowrap',
60
- color: theme.palette.text.primary,
61
- '&:hover': {
62
- textDecoration: 'none',
63
- },
64
- fontWeight: theme.typography.fontWeightBold,
65
- paddingTop: 6,
66
- },
67
- line: {
68
- maxWidth: 40,
69
- width: '100%',
70
- display: 'flex',
71
- justifyContent: 'center',
72
- height: 2,
73
- background: theme.palette.primary.main,
74
- margin: '0 auto',
75
- marginTop: 6,
76
- opacity: 0,
77
- },
78
- lineShow: {
79
- opacity: 1,
80
- },
81
- }),
82
- { name: 'DesktopNavBar' },
83
- )
84
-
85
- export type MenuTabsProps = MenuProps &
86
- UseStyles<typeof useStyles> & {
87
- LinkProps?: MuiLinkProps
88
- iconScrollerBtnLeft?: React.ReactNode
89
- iconScrollerBtnRight?: React.ReactNode
90
- }
91
-
92
- export default function DesktopNavBar(props: MenuTabsProps) {
93
- const { menu, LinkProps, iconScrollerBtnLeft, iconScrollerBtnRight } = props
94
- const classes = useStyles(props)
95
- const router = useRouter()
96
-
97
- return (
98
- <ScrollerProvider scrollSnapAlign='none'>
99
- <div className={classes.container}>
100
- <Scroller className={classes.scroller} hideScrollbar>
101
- {menu.map(({ href, children, ...linkProps }) => (
102
- <PageLink key={href.toString()} href={href} {...linkProps} passHref>
103
- <Link
104
- variant='subtitle1'
105
- {...LinkProps}
106
- className={clsx(classes.link, LinkProps?.className)}
107
- >
108
- {children}
109
- <div
110
- className={clsx(
111
- classes.line,
112
- router.asPath.startsWith(href.toString()) && classes.lineShow,
113
- )}
114
- />
115
- </Link>
116
- </PageLink>
117
- ))}
118
- </Scroller>
119
-
120
- <m.div className={clsx(classes.prevNextBtnWrapper, classes.left)}>
121
- <ScrollerButton
122
- direction='left'
123
- size='small'
124
- classes={{ root: clsx(classes.prevNextBtn, classes.prevBtn) }}
125
- >
126
- {iconScrollerBtnLeft ?? <SvgImageSimple src={iconChevronLeft} />}
127
- </ScrollerButton>
128
- </m.div>
129
-
130
- <m.div className={clsx(classes.prevNextBtnWrapper, classes.right)}>
131
- <ScrollerButton
132
- direction='right'
133
- size='small'
134
- classes={{ root: clsx(classes.prevNextBtn, classes.nextBtn) }}
135
- >
136
- {iconScrollerBtnRight ?? <SvgImageSimple src={iconChevronRight} />}
137
- </ScrollerButton>
138
- </m.div>
139
- </div>
140
-
141
- {/* <ScrollerButton
142
- direction='left'
143
- size='small'
144
- className={clsx(classes.prevNext, classes.prev)}
145
- >
146
- <SvgImageSimple src={iconChevronLeft} />
147
- </ScrollerButton>
148
-
149
- <ScrollerButton
150
- direction='right'
151
- size='small'
152
- className={clsx(classes.prevNext, classes.next)}
153
- >
154
- <SvgImageSimple src={iconChevronRight} />
155
- </ScrollerButton> */}
156
- </ScrollerProvider>
157
- )
158
- }
package/AppShell/Logo.tsx DELETED
@@ -1,46 +0,0 @@
1
- import { Image, ImageProps } from '@graphcommerce/image'
2
- import { makeStyles, Theme } from '@material-ui/core'
3
- import PageLink from 'next/link'
4
- import { useRouter } from 'next/router'
5
- import React from 'react'
6
- import { UseStyles } from '../Styles'
7
-
8
- const useStyles = makeStyles(
9
- (theme: Theme) => ({
10
- logo: {},
11
- parent: {
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
- }),
25
- { name: 'Logo' },
26
- )
27
-
28
- export type LogoProps = { href?: `/${string}`; image: ImageProps } & UseStyles<typeof useStyles>
29
-
30
- export default function Logo(props: LogoProps) {
31
- const { href, image } = props
32
- const router = useRouter()
33
- const classes = useStyles(props)
34
-
35
- return router.asPath.split('?')[0] === '/' ? (
36
- <div className={classes.parent}>
37
- <Image layout='fixed' loading='eager' {...image} className={classes.logo} />
38
- </div>
39
- ) : (
40
- <PageLink href={href ?? '/'} passHref>
41
- <a className={classes.parent} aria-label='Logo'>
42
- <Image layout='fixed' loading='eager' {...image} className={classes.logo} />
43
- </a>
44
- </PageLink>
45
- )
46
- }
package/AppShell/Menu.tsx DELETED
@@ -1,7 +0,0 @@
1
- import { LinkProps } from 'next/link'
2
-
3
- type MenuItemProps = LinkProps & { children: React.ReactNode }
4
-
5
- export type MenuProps = {
6
- menu: MenuItemProps[]
7
- }
@@ -1,162 +0,0 @@
1
- import {
2
- Divider,
3
- Fab,
4
- List,
5
- ListItem,
6
- ListItemText,
7
- makeStyles,
8
- Menu,
9
- Theme,
10
- } from '@material-ui/core'
11
- import { m } from 'framer-motion'
12
- import PageLink from 'next/link'
13
- import { useRouter } from 'next/router'
14
- import React, { useEffect } from 'react'
15
- import { UseStyles } from '../Styles'
16
- import { responsiveVal } from '../Styles/responsiveVal'
17
- import SvgImageSimple from '../SvgImage/SvgImageSimple'
18
- import { iconMenu, iconClose } from '../icons'
19
- import { MenuProps } from './Menu'
20
- import { useFabAnimation } from './useFabAnimation'
21
-
22
- const useStyles = makeStyles(
23
- (theme: Theme) => ({
24
- menuWrapper: {
25
- left: theme.page.horizontal,
26
- [theme.breakpoints.down('sm')]: {
27
- transform: 'none !important',
28
- opacity: '1 !important',
29
- },
30
- },
31
- menuFab: {
32
- boxShadow: 'none',
33
- '&:hover, &:focus': {
34
- boxShadow: 'none',
35
- background: theme.palette.text.primary,
36
- },
37
- background: theme.palette.text.primary,
38
- width: responsiveVal(42, 56),
39
- height: responsiveVal(42, 56),
40
- pointerEvents: 'all',
41
- color: theme.palette.background.paper,
42
- },
43
- shadow: {
44
- pointerEvents: 'none',
45
- borderRadius: '99em',
46
- position: 'absolute',
47
- height: '100%',
48
- width: '100%',
49
- boxShadow: theme.shadows[6],
50
- top: 0,
51
- [theme.breakpoints.down('sm')]: {
52
- opacity: '1 !important',
53
- },
54
- },
55
- menu: {
56
- backgroundColor: theme.palette.background.paper,
57
- color: theme.palette.text.primary,
58
- minWidth: responsiveVal(200, 280),
59
- marginTop: `calc(${responsiveVal(42, 56)} + 3px)`,
60
- [theme.breakpoints.down('sm')]: {
61
- marginTop: `calc((${responsiveVal(42, 56)} + 12px) * -1)`,
62
- },
63
- },
64
- menuItemText: {
65
- ...theme.typography.h4,
66
- lineHeight: 1.1,
67
- },
68
- menuItem: {},
69
- }),
70
- { name: 'Menu' },
71
- )
72
-
73
- export type MenuFabProps = MenuProps &
74
- UseStyles<typeof useStyles> & {
75
- children?: React.ReactNode
76
- search?: React.ReactNode
77
- menuIcon?: React.ReactNode
78
- closeIcon?: React.ReactNode
79
- }
80
-
81
- export default function MenuFab(props: MenuFabProps) {
82
- const { menu, children, search, menuIcon, closeIcon } = props
83
- const classes = useStyles(props)
84
- const router = useRouter()
85
- const [openEl, setOpenEl] = React.useState<null | HTMLElement>(null)
86
-
87
- const { opacity, scale, shadowOpacity } = useFabAnimation()
88
-
89
- useEffect(() => {
90
- const clear = () => setOpenEl(null)
91
- router.events.on('routeChangeStart', clear)
92
- return () => router.events.off('routeChangeStart', clear)
93
- }, [router])
94
-
95
- return (
96
- <m.div className={classes.menuWrapper} style={{ scale, opacity }}>
97
- <Fab
98
- color='inherit'
99
- aria-label='Open Menu'
100
- size='medium'
101
- onClick={(event) => setOpenEl(event.currentTarget)}
102
- className={classes.menuFab}
103
- >
104
- {closeIcon ?? (
105
- <SvgImageSimple src={iconClose} inverted style={{ display: openEl ? 'block' : 'none' }} />
106
- )}
107
- {menuIcon ?? (
108
- <SvgImageSimple src={iconMenu} inverted style={{ display: openEl ? 'none' : 'block' }} />
109
- )}
110
- </Fab>
111
- <m.div className={classes.shadow} style={{ opacity: shadowOpacity }} />
112
-
113
- <Menu
114
- anchorEl={openEl}
115
- open={!!openEl}
116
- onClose={() => setOpenEl(null)}
117
- classes={{ paper: classes.menu }}
118
- disableScrollLock
119
- transitionDuration={{
120
- appear: 175,
121
- enter: 175,
122
- exit: 175,
123
- }}
124
- >
125
- {search && (
126
- <List>
127
- <ListItem dense>{search}</ListItem>
128
- </List>
129
- )}
130
- <List>
131
- <PageLink href='/' passHref>
132
- <ListItem
133
- button
134
- dense
135
- selected={router.asPath.split('?')[0] === '/'}
136
- classes={{ root: classes.menuItem }}
137
- >
138
- <ListItemText classes={{ primary: classes.menuItemText }}>Home</ListItemText>
139
- </ListItem>
140
- </PageLink>
141
-
142
- {menu.map(({ href, children: itemChildren, ...linkProps }) => (
143
- <PageLink key={href.toString()} href={href} {...linkProps} passHref>
144
- <ListItem
145
- button
146
- dense
147
- selected={router.asPath.startsWith(href.toString())}
148
- classes={{ root: classes.menuItem }}
149
- >
150
- <ListItemText classes={{ primary: classes.menuItemText }}>
151
- {itemChildren}
152
- </ListItemText>
153
- </ListItem>
154
- </PageLink>
155
- ))}
156
- </List>
157
- <Divider variant='middle' />
158
- <List component='div'>{children}</List>
159
- </Menu>
160
- </m.div>
161
- )
162
- }
@@ -1,32 +0,0 @@
1
- import { ListItem, ListItemIcon, ListItemText, makeStyles } from '@material-ui/core'
2
- import PageLink from 'next/link'
3
- import router from 'next/router'
4
- import React from 'react'
5
-
6
- const useStyles = makeStyles(
7
- {
8
- listItemText: {},
9
- icon: { minWidth: 30 },
10
- },
11
- { name: 'FabMenuSecondaryItem' },
12
- )
13
-
14
- export type FabMenuSecondaryItemProps = {
15
- href: string
16
- children: React.ReactNode
17
- icon: React.ReactNode
18
- }
19
-
20
- export function MenuFabSecondaryItem(props: FabMenuSecondaryItemProps) {
21
- const { href, children, icon } = props
22
- const classes = useStyles()
23
-
24
- return (
25
- <PageLink href={href} passHref>
26
- <ListItem component='a' dense button selected={router.asPath.startsWith(href)}>
27
- <ListItemIcon classes={{ root: classes.icon }}>{icon}</ListItemIcon>
28
- <ListItemText primary={children} classes={{ primary: classes.listItemText }} />
29
- </ListItem>
30
- </PageLink>
31
- )
32
- }
package/AppShell/index.ts DELETED
@@ -1,15 +0,0 @@
1
- export { default as AppShellSticky } from './AppShellSticky'
2
- export { default as DesktopNavActions } from './DesktopNavActions'
3
-
4
- export * from './DesktopNavBar'
5
- export { default as DesktopNavBar } from './DesktopNavBar'
6
-
7
- export { default as Logo } from './Logo'
8
- export * from './Logo'
9
- export * from './Menu'
10
- export * from './MenuFab'
11
- export { default as MenuFab } from './MenuFab'
12
- export * from './MenuFabSecondaryItem'
13
- export * from './PlaceholderFab'
14
- export * from './GlobalHead'
15
- export * from './useFabAnimation'
@@ -1,27 +0,0 @@
1
- import { makeStyles } from '@material-ui/core'
2
- import React from 'react'
3
- import { UseStyles } from '../Styles'
4
-
5
- const useStyles = makeStyles({
6
- root: ({ width, height }: Props) => ({
7
- position: `relative`,
8
- paddingTop: `calc(100% / ${width} * ${height})`,
9
- '& img, & video': {
10
- position: 'absolute',
11
- left: 0,
12
- top: 0,
13
- width: `100%`,
14
- height: `auto`,
15
- },
16
- }),
17
- })
18
-
19
- export type Props = { width: number; height: number }
20
- export type AspectRatioContainerProps = Props & UseStyles<typeof useStyles>
21
-
22
- const AspectRatioContainer: React.FC<AspectRatioContainerProps> = ({ children, ...styleProps }) => {
23
- const classes = useStyles(styleProps)
24
- return <div className={classes.root}>{children}</div>
25
- }
26
-
27
- export default AspectRatioContainer
@@ -1,23 +0,0 @@
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 function SocialIcon(props: SocialIconProps) {
20
- const classes = useStyles(props)
21
-
22
- return <SvgImage {...props} className={classes.root} />
23
- }
package/Form/index.tsx DELETED
@@ -1,67 +0,0 @@
1
- import { darken, lighten, makeStyles, Theme } from '@material-ui/core'
2
- import clsx from 'clsx'
3
- import React from 'react'
4
- import { UseStyles } from '../Styles'
5
- import { responsiveVal } from '../Styles/responsiveVal'
6
-
7
- const useStyles = makeStyles(
8
- (theme: Theme) => ({
9
- root: {
10
- display: 'grid',
11
- alignItems: 'center',
12
- padding: `${theme.spacings.xxs} 0`,
13
- },
14
- secondary: {
15
- background: theme.palette.secondary.light,
16
- },
17
- default: {
18
- background:
19
- theme.palette.type === 'light'
20
- ? darken(theme.palette.background.default, 0.03)
21
- : lighten(theme.palette.background.default, 0.1),
22
- },
23
- contained: {
24
- padding: `${theme.spacings.xxs} ${theme.spacings.sm}`,
25
- // paddingTop: theme.spacings.md,
26
- overflow: 'hidden',
27
- borderRadius: responsiveVal(theme.shape.borderRadius * 3, theme.shape.borderRadius * 4),
28
- },
29
- }),
30
- { name: 'Form' },
31
- )
32
-
33
- export type BaseFormProps = {
34
- contained?: boolean
35
- background?: 'secondary' | 'default'
36
- children: React.ReactNode
37
- } & UseStyles<typeof useStyles>
38
-
39
- export type FormFormProps = BaseFormProps & JSX.IntrinsicElements['form']
40
-
41
- export const Form = React.forwardRef<HTMLFormElement, FormFormProps>((props, ref) => {
42
- const classes = useStyles(props)
43
- const { contained, background, ...formProps } = props
44
-
45
- return (
46
- <form ref={ref} {...formProps} className={clsx(classes.root, contained && classes.contained)} />
47
- )
48
- })
49
-
50
- export type DivFormProps = BaseFormProps & JSX.IntrinsicElements['div']
51
-
52
- export const FormDiv = React.forwardRef<HTMLDivElement, DivFormProps>((props, ref) => {
53
- const classes = useStyles(props)
54
- const { contained, background = 'default', classes: _classes, ...formProps } = props
55
-
56
- return (
57
- <div
58
- ref={ref}
59
- {...formProps}
60
- className={clsx(
61
- classes.root,
62
- contained && classes.contained,
63
- contained && classes[background],
64
- )}
65
- />
66
- )
67
- })