@graphcommerce/next-ui 3.25.3 → 4.0.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.
- package/AnimatedRow/index.tsx +6 -3
- package/ApolloError/ApolloErrorAlert.tsx +20 -21
- package/ApolloError/ApolloErrorFullPage.tsx +3 -4
- package/ApolloError/ApolloErrorSnackbar.tsx +3 -3
- package/Blog/BlogAuthor/index.tsx +42 -48
- package/Blog/BlogContent/index.tsx +6 -23
- package/Blog/BlogHeader/index.tsx +26 -23
- package/Blog/BlogList/index.tsx +7 -25
- package/Blog/BlogListItem/index.tsx +63 -52
- package/Blog/BlogTags/BlogTag.tsx +27 -0
- package/Blog/BlogTags/index.tsx +7 -32
- package/Blog/BlogTitle/index.tsx +7 -21
- package/Button/Button.tsx +5 -0
- package/Button/LinkOrButton.tsx +80 -0
- package/Button/index.tsx +2 -177
- package/CHANGELOG.md +490 -651
- package/ChipMenu/index.tsx +71 -77
- package/ContainerWithHeader/index.tsx +33 -30
- package/FlagAvatar/index.tsx +2 -12
- package/Footer/Footer.tsx +105 -88
- package/Footer/index.ts +0 -1
- package/Form/Form.tsx +35 -0
- package/Form/FormActions.tsx +9 -14
- package/Form/FormDivider.tsx +8 -13
- package/Form/FormHeader.tsx +5 -26
- package/Form/FormRow.tsx +8 -13
- package/Form/InputCheckmark.tsx +9 -22
- package/FramerScroller/SidebarGallery.tsx +340 -0
- package/FramerScroller/SidebarSlider.tsx +107 -0
- package/FramerScroller/index.ts +2 -0
- package/FullPageMessage/index.tsx +52 -48
- package/Highlight/index.tsx +1 -1
- package/IconHeader/index.tsx +63 -58
- package/JsonLd/index.tsx +3 -2
- package/Layout/components/LayoutHeader.tsx +75 -82
- package/Layout/components/LayoutHeaderBack.tsx +21 -12
- package/Layout/components/LayoutHeaderClose.tsx +9 -22
- package/Layout/components/LayoutHeaderContent.tsx +190 -154
- package/Layout/components/LayoutHeadertypes.ts +1 -1
- package/Layout/components/LayoutTitle.tsx +60 -55
- package/LayoutDefault/components/LayoutDefault.tsx +96 -85
- package/LayoutOverlay/components/LayoutOverlay.tsx +2 -8
- package/LayoutOverlay/components/LayoutOverlayBase.tsx +233 -239
- package/LayoutOverlay/test/LayoutOverlayDemo.tsx +1 -1
- package/LayoutParts/DesktopHeaderBadge.tsx +28 -0
- package/LayoutParts/DesktopNavActions.tsx +15 -0
- package/LayoutParts/DesktopNavBar.tsx +113 -0
- package/LayoutParts/DesktopNavBarItem.tsx +44 -0
- package/{AppShell → LayoutParts}/GlobalHead.tsx +1 -2
- package/LayoutParts/Logo.tsx +77 -0
- package/LayoutParts/MenuFab.tsx +131 -0
- package/LayoutParts/MenuFabItem.tsx +25 -0
- package/LayoutParts/MenuFabSecondaryItem.tsx +37 -0
- package/{AppShell/PlaceholderFab/index.tsx → LayoutParts/PlaceholderFab.tsx} +1 -1
- package/LayoutParts/StickyBelowHeader.tsx +25 -0
- package/LayoutParts/index.ts +12 -0
- package/{AppShell → LayoutParts}/useFabAnimation.ts +0 -0
- package/Page/CssAndFramerMotionProvider.tsx +21 -0
- package/Page/index.ts +2 -0
- package/Page/types.ts +2 -8
- package/PageLoadIndicator/index.tsx +25 -30
- package/PageMeta/index.tsx +1 -1
- package/Pagination/index.tsx +37 -54
- package/RenderType/index.tsx +1 -1
- package/Row/ButtonLinkList/ButtonLinkList.tsx +35 -37
- package/Row/ButtonLinkList/ButtonLinkListItem.tsx +16 -33
- package/Row/ColumnOne/index.tsx +5 -10
- package/Row/ColumnOneBoxed/index.tsx +18 -19
- package/Row/ColumnOneCentered/index.tsx +3 -4
- package/Row/ColumnThree/index.tsx +62 -57
- package/Row/ColumnTwo/index.tsx +37 -32
- package/Row/ColumnTwoSpread/index.tsx +28 -37
- package/Row/ColumnTwoWithTop/index.tsx +37 -43
- package/Row/ContentLinks/index.tsx +24 -25
- package/Row/HeroBanner/index.tsx +98 -82
- package/Row/IconBlocks/IconBlock/index.tsx +45 -37
- package/Row/IconBlocks/index.tsx +29 -44
- package/Row/ImageText/index.tsx +71 -67
- package/Row/ImageTextBoxed/index.tsx +66 -65
- package/Row/ParagraphWithSidebarSlide/index.tsx +80 -76
- package/Row/Quote/index.tsx +3 -3
- package/Row/SpecialBanner/index.tsx +97 -97
- package/Row/index.tsx +4 -9
- package/SectionContainer/index.tsx +32 -31
- package/SectionHeader/index.tsx +41 -43
- package/Separator/index.tsx +19 -18
- package/Snackbar/MessageSnackbar.tsx +1 -2
- package/Snackbar/MessageSnackbarImpl.tsx +68 -115
- package/StarRatingField/index.tsx +24 -25
- package/Stepper/Stepper.tsx +34 -32
- package/Styles/EmotionProvider.tsx +14 -0
- package/Styles/breakpointVal.tsx +16 -10
- package/Styles/extendableComponent.ts +70 -0
- package/Styles/index.tsx +9 -2
- package/Styles/withEmotionCache.tsx +36 -0
- package/Styles/withTheme.tsx +15 -24
- package/SvgIcon/SvgIcon.tsx +60 -0
- package/TextInputNumber/index.tsx +49 -50
- package/Theme/MuiButton.ts +128 -0
- package/Theme/MuiSlider.ts +28 -0
- package/Theme/MuiSnackbar.ts +31 -0
- package/Theme/{types.ts → createTheme.ts} +8 -2
- package/Theme/index.ts +4 -0
- package/Theme/themeDefaults.ts +51 -0
- package/TimeAgo/index.tsx +1 -1
- package/ToggleButton/index.tsx +43 -49
- package/ToggleButtonGroup/index.tsx +39 -39
- package/UspList/UspListItem.tsx +56 -46
- package/UspList/index.tsx +29 -26
- package/docs/building-components.mdx +3 -0
- package/docs/components/ComponentBasic.tsx +26 -0
- package/docs/components/ComponentChild.tsx +48 -0
- package/docs/components/ComponentChildVariant.tsx +54 -0
- package/docs/components/ComponentChildVariantExtendable.tsx +62 -0
- package/docs/components/ComponentStylable.tsx +32 -0
- package/docs/pages/building-components.tsx +62 -0
- package/index.ts +27 -81
- package/package.json +25 -27
- package/types.d.ts +1 -1
- package/AppShell/AppShellSticky/index.tsx +0 -38
- package/AppShell/DesktopNavActions.tsx +0 -32
- package/AppShell/DesktopNavBar.tsx +0 -158
- package/AppShell/Logo.tsx +0 -46
- package/AppShell/Menu.tsx +0 -7
- package/AppShell/MenuFab.tsx +0 -162
- package/AppShell/MenuFabSecondaryItem.tsx +0 -32
- package/AppShell/index.ts +0 -15
- package/AspectRatioContainer/index.tsx +0 -27
- package/Footer/SocialIcon.tsx +0 -23
- package/Form/index.tsx +0 -67
- package/FramerScroller/components/SidebarGallery.tsx +0 -317
- package/FramerScroller/components/SidebarSlider.tsx +0 -97
- package/Page/App.tsx +0 -17
- package/Page/Document.tsx +0 -24
- package/StyledBadge/index.tsx +0 -20
- package/Styles/classesPicker.ts +0 -41
- package/SvgImage/SvgImageSimple.tsx +0 -100
- package/SvgImage/index.tsx +0 -74
|
@@ -1,154 +1,27 @@
|
|
|
1
1
|
import { useMotionValueValue } from '@graphcommerce/framer-utils'
|
|
2
|
-
import {
|
|
2
|
+
import { Box, SxProps, Theme } from '@mui/material'
|
|
3
3
|
import React, { useRef } from 'react'
|
|
4
|
-
import {
|
|
5
|
-
import { classesPicker } from '../../Styles/classesPicker'
|
|
4
|
+
import { extendableComponent } from '../../Styles'
|
|
6
5
|
import { useScrollY } from '../hooks/useScrollY'
|
|
7
6
|
import { FloatingProps } from './LayoutHeadertypes'
|
|
8
7
|
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[theme.breakpoints.up('md')]: {
|
|
26
|
-
height: theme.appShell.appBarHeightMd,
|
|
27
|
-
},
|
|
28
|
-
borderTopLeftRadius: theme.shape.borderRadius * 3,
|
|
29
|
-
borderTopRightRadius: theme.shape.borderRadius * 3,
|
|
30
|
-
},
|
|
31
|
-
bgDivider: {
|
|
32
|
-
boxShadow: 'unset',
|
|
33
|
-
},
|
|
34
|
-
bgFloatingSm: {
|
|
35
|
-
[theme.breakpoints.down('sm')]: {
|
|
36
|
-
display: 'none',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
bgFloatingMd: {
|
|
40
|
-
[theme.breakpoints.up('md')]: {
|
|
41
|
-
display: 'none',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
bgScrolled: {
|
|
45
|
-
opacity: 1,
|
|
46
|
-
},
|
|
47
|
-
content: {
|
|
48
|
-
position: 'absolute',
|
|
49
|
-
left: 0,
|
|
50
|
-
width: '100%',
|
|
51
|
-
display: 'grid',
|
|
52
|
-
gridTemplateAreas: `"left center right"`,
|
|
53
|
-
gridTemplateColumns: '1fr auto 1fr',
|
|
54
|
-
alignItems: 'center',
|
|
55
|
-
// columnGap: theme.spacings.xs,
|
|
56
|
-
|
|
57
|
-
height: theme.appShell.headerHeightSm,
|
|
58
|
-
[theme.breakpoints.up('md')]: {
|
|
59
|
-
padding: `0 ${theme.page.horizontal}`,
|
|
60
|
-
height: theme.appShell.appBarHeightMd,
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
contentFloatingMd: {
|
|
64
|
-
[theme.breakpoints.up('md')]: {
|
|
65
|
-
padding: `0 ${theme.page.horizontal}`,
|
|
66
|
-
background: 'none',
|
|
67
|
-
pointerEvents: 'none',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
contentFloatingSm: {
|
|
71
|
-
[theme.breakpoints.down('sm')]: {
|
|
72
|
-
padding: `0 ${theme.page.horizontal}`,
|
|
73
|
-
background: 'none',
|
|
74
|
-
pointerEvents: 'none',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
left: {
|
|
78
|
-
'& > *': { pointerEvents: 'all' },
|
|
79
|
-
display: 'grid',
|
|
80
|
-
gridAutoFlow: 'column',
|
|
81
|
-
gap: theme.spacings.sm,
|
|
82
|
-
gridArea: 'left',
|
|
83
|
-
justifyContent: 'start',
|
|
84
|
-
},
|
|
85
|
-
center: {
|
|
86
|
-
display: 'grid',
|
|
87
|
-
gridAutoFlow: 'column',
|
|
88
|
-
gap: theme.spacings.sm,
|
|
89
|
-
gridArea: 'center',
|
|
90
|
-
justifyContent: 'start',
|
|
91
|
-
overflow: 'hidden',
|
|
92
|
-
transition: `opacity ${time}`,
|
|
93
|
-
opacity: 0,
|
|
94
|
-
},
|
|
95
|
-
centerScrolled: {
|
|
96
|
-
opacity: 1,
|
|
97
|
-
'& > *': { pointerEvents: 'all' },
|
|
98
|
-
},
|
|
99
|
-
centerFloatingSm: {
|
|
100
|
-
[theme.breakpoints.down('sm')]: {
|
|
101
|
-
display: 'none',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
centerFloatingMd: {
|
|
105
|
-
[theme.breakpoints.up('md')]: {
|
|
106
|
-
display: 'none',
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
right: {
|
|
110
|
-
'& > *': {
|
|
111
|
-
pointerEvents: 'all',
|
|
112
|
-
width: 'min-content',
|
|
113
|
-
},
|
|
114
|
-
display: 'grid',
|
|
115
|
-
gridAutoFlow: 'column',
|
|
116
|
-
gap: theme.spacings.sm,
|
|
117
|
-
gridArea: 'right',
|
|
118
|
-
justifyContent: 'end',
|
|
119
|
-
},
|
|
120
|
-
divider: {
|
|
121
|
-
position: 'absolute',
|
|
122
|
-
bottom: 0,
|
|
123
|
-
left: 0,
|
|
124
|
-
right: 0,
|
|
125
|
-
},
|
|
126
|
-
dividerFloatingSm: {
|
|
127
|
-
[theme.breakpoints.down('sm')]: {
|
|
128
|
-
display: 'none',
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
dividerFloatingMd: {
|
|
132
|
-
[theme.breakpoints.up('md')]: {
|
|
133
|
-
display: 'none',
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
}),
|
|
137
|
-
{ name: 'LayoutHeaderContent' },
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
export type ContentProps = FloatingProps &
|
|
141
|
-
UseStyles<typeof useStyles> & {
|
|
142
|
-
children?: React.ReactNode
|
|
143
|
-
left?: React.ReactNode
|
|
144
|
-
right?: React.ReactNode
|
|
145
|
-
divider?: React.ReactNode
|
|
146
|
-
switchPoint?: number
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export default function LayoutHeaderContent(props: ContentProps) {
|
|
8
|
+
export type LayoutHeaderContentProps = FloatingProps & {
|
|
9
|
+
children?: React.ReactNode
|
|
10
|
+
left?: React.ReactNode
|
|
11
|
+
right?: React.ReactNode
|
|
12
|
+
divider?: React.ReactNode
|
|
13
|
+
switchPoint?: number
|
|
14
|
+
sx?: SxProps<Theme>
|
|
15
|
+
sxBg?: SxProps<Theme>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type OwnerState = { floatingSm: boolean; floatingMd: boolean; scrolled: boolean; divider: boolean }
|
|
19
|
+
const name = 'LayoutHeaderContent' as const
|
|
20
|
+
const parts = ['bg', 'content', 'left', 'center', 'right', 'divider'] as const
|
|
21
|
+
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
22
|
+
|
|
23
|
+
export default function LayoutHeaderContent(props: LayoutHeaderContentProps) {
|
|
150
24
|
const ref = useRef<HTMLDivElement>(null)
|
|
151
|
-
const scroll = useScrollY()
|
|
152
25
|
|
|
153
26
|
const {
|
|
154
27
|
left,
|
|
@@ -158,12 +31,14 @@ export default function LayoutHeaderContent(props: ContentProps) {
|
|
|
158
31
|
floatingMd = false,
|
|
159
32
|
floatingSm = false,
|
|
160
33
|
switchPoint = 50,
|
|
34
|
+
sx = [],
|
|
35
|
+
sxBg = [],
|
|
161
36
|
} = props
|
|
162
|
-
const classes = useStyles(props)
|
|
163
37
|
|
|
38
|
+
const scroll = useScrollY()
|
|
164
39
|
const scrolled = useMotionValueValue(scroll, (y) => y >= switchPoint)
|
|
165
40
|
|
|
166
|
-
const
|
|
41
|
+
const classes = withState({
|
|
167
42
|
floatingSm,
|
|
168
43
|
floatingMd,
|
|
169
44
|
scrolled,
|
|
@@ -172,13 +47,174 @@ export default function LayoutHeaderContent(props: ContentProps) {
|
|
|
172
47
|
|
|
173
48
|
return (
|
|
174
49
|
<>
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
{
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
50
|
+
<Box
|
|
51
|
+
className={classes.bg}
|
|
52
|
+
sx={[
|
|
53
|
+
(theme) => ({
|
|
54
|
+
position: 'absolute',
|
|
55
|
+
left: 0,
|
|
56
|
+
width: '100%',
|
|
57
|
+
backgroundColor: theme.palette.background.paper,
|
|
58
|
+
boxShadow: theme.shadows[1],
|
|
59
|
+
|
|
60
|
+
height: theme.appShell.headerHeightSm,
|
|
61
|
+
[theme.breakpoints.up('md')]: {
|
|
62
|
+
height: theme.appShell.appBarHeightMd,
|
|
63
|
+
},
|
|
64
|
+
borderTopLeftRadius: theme.shape.borderRadius * 3,
|
|
65
|
+
borderTopRightRadius: theme.shape.borderRadius * 3,
|
|
66
|
+
|
|
67
|
+
'&.floatingSm': {
|
|
68
|
+
[theme.breakpoints.down('md')]: {
|
|
69
|
+
display: 'none',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
'&.floatingMd': {
|
|
73
|
+
[theme.breakpoints.up('md')]: {
|
|
74
|
+
display: 'none',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
opacity: 0,
|
|
79
|
+
transition: `opacity 150ms`,
|
|
80
|
+
'&.scrolled': {
|
|
81
|
+
opacity: 1,
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
'&.divider': {
|
|
85
|
+
boxShadow: 'unset',
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
...(Array.isArray(sxBg) ? sxBg : [sxBg]),
|
|
89
|
+
]}
|
|
90
|
+
/>
|
|
91
|
+
<Box
|
|
92
|
+
className={classes.content}
|
|
93
|
+
ref={ref}
|
|
94
|
+
sx={[
|
|
95
|
+
(theme) => ({
|
|
96
|
+
position: 'absolute',
|
|
97
|
+
left: 0,
|
|
98
|
+
width: '100%',
|
|
99
|
+
display: 'grid',
|
|
100
|
+
gridTemplateAreas: `"left center right"`,
|
|
101
|
+
gridTemplateColumns: '1fr auto 1fr',
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
// columnGap: theme.spacings.xs,
|
|
104
|
+
|
|
105
|
+
height: theme.appShell.headerHeightSm,
|
|
106
|
+
padding: `0 ${theme.page.horizontal}`,
|
|
107
|
+
|
|
108
|
+
[theme.breakpoints.up('md')]: {
|
|
109
|
+
height: theme.appShell.appBarHeightMd,
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
'&.floatingSm': {
|
|
113
|
+
[theme.breakpoints.down('md')]: {
|
|
114
|
+
padding: `0 ${theme.page.horizontal}`,
|
|
115
|
+
background: 'none',
|
|
116
|
+
pointerEvents: 'none',
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
'&.floatingMd': {
|
|
120
|
+
[theme.breakpoints.up('md')]: {
|
|
121
|
+
padding: `0 ${theme.page.horizontal}`,
|
|
122
|
+
background: 'none',
|
|
123
|
+
pointerEvents: 'none',
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
128
|
+
]}
|
|
129
|
+
>
|
|
130
|
+
{left && (
|
|
131
|
+
<Box
|
|
132
|
+
className={classes.left}
|
|
133
|
+
sx={(theme) => ({
|
|
134
|
+
'& > *': { pointerEvents: 'all' },
|
|
135
|
+
display: 'grid',
|
|
136
|
+
gridAutoFlow: 'column',
|
|
137
|
+
gap: theme.spacings.sm,
|
|
138
|
+
gridArea: 'left',
|
|
139
|
+
justifyContent: 'start',
|
|
140
|
+
})}
|
|
141
|
+
>
|
|
142
|
+
{left}
|
|
143
|
+
</Box>
|
|
144
|
+
)}
|
|
145
|
+
<Box
|
|
146
|
+
className={classes.center}
|
|
147
|
+
sx={(theme) => ({
|
|
148
|
+
display: 'grid',
|
|
149
|
+
gridAutoFlow: 'column',
|
|
150
|
+
gap: theme.spacings.sm,
|
|
151
|
+
gridArea: 'center',
|
|
152
|
+
justifyContent: 'start',
|
|
153
|
+
overflow: 'hidden',
|
|
154
|
+
|
|
155
|
+
transition: `opacity 150ms`,
|
|
156
|
+
opacity: 0,
|
|
157
|
+
'&.scrolled': {
|
|
158
|
+
opacity: 1,
|
|
159
|
+
'& > *': { pointerEvents: 'all' },
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
'&.floatingSm': {
|
|
163
|
+
[theme.breakpoints.down('md')]: {
|
|
164
|
+
display: 'none',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
'&.floatingMd': {
|
|
169
|
+
[theme.breakpoints.up('md')]: {
|
|
170
|
+
display: 'none',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
})}
|
|
174
|
+
>
|
|
175
|
+
{children}
|
|
176
|
+
</Box>
|
|
177
|
+
<Box
|
|
178
|
+
className={classes.right}
|
|
179
|
+
sx={(theme) => ({
|
|
180
|
+
'& > *': {
|
|
181
|
+
pointerEvents: 'all',
|
|
182
|
+
width: 'min-content',
|
|
183
|
+
},
|
|
184
|
+
display: 'grid',
|
|
185
|
+
gridAutoFlow: 'column',
|
|
186
|
+
gap: theme.spacings.sm,
|
|
187
|
+
gridArea: 'right',
|
|
188
|
+
justifyContent: 'end',
|
|
189
|
+
})}
|
|
190
|
+
>
|
|
191
|
+
{right}
|
|
192
|
+
</Box>
|
|
193
|
+
{divider && (
|
|
194
|
+
<Box
|
|
195
|
+
className={classes.divider}
|
|
196
|
+
sx={(theme) => ({
|
|
197
|
+
position: 'absolute',
|
|
198
|
+
bottom: 0,
|
|
199
|
+
left: 0,
|
|
200
|
+
right: 0,
|
|
201
|
+
|
|
202
|
+
'&.floatingSm': {
|
|
203
|
+
[theme.breakpoints.down('md')]: {
|
|
204
|
+
display: 'none',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
'&.floatingMd': {
|
|
208
|
+
[theme.breakpoints.up('md')]: {
|
|
209
|
+
display: 'none',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
})}
|
|
213
|
+
>
|
|
214
|
+
{divider}
|
|
215
|
+
</Box>
|
|
216
|
+
)}
|
|
217
|
+
</Box>
|
|
182
218
|
</>
|
|
183
219
|
)
|
|
184
220
|
}
|
|
@@ -1,79 +1,84 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Box, SxProps, Theme, Typography, TypographyProps } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { responsiveVal } from '../../Styles/responsiveVal'
|
|
6
|
-
import { SvgImageProps } from '../../SvgImage'
|
|
7
|
-
import SvgImageSimple from '../../SvgImage/SvgImageSimple'
|
|
3
|
+
import { extendableComponent, responsiveVal } from '../../Styles'
|
|
4
|
+
import { SvgIcon, SvgIconProps } from '../../SvgIcon/SvgIcon'
|
|
8
5
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
containerSizeSmall: {
|
|
22
|
-
flexFlow: 'unset',
|
|
23
|
-
overflow: 'hidden',
|
|
24
|
-
'& svg': {
|
|
25
|
-
width: responsiveVal(24, 28),
|
|
26
|
-
height: responsiveVal(24, 28),
|
|
27
|
-
strokeWidth: 1.4,
|
|
28
|
-
},
|
|
29
|
-
'& > *': {
|
|
30
|
-
overflow: 'hidden',
|
|
31
|
-
whiteSpace: 'nowrap',
|
|
32
|
-
textOverflow: 'ellipsis',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
containerGutterTop: {
|
|
36
|
-
marginTop: theme.spacings.xl,
|
|
37
|
-
},
|
|
38
|
-
containerGutterBottom: {
|
|
39
|
-
marginBottom: theme.spacings.lg,
|
|
40
|
-
},
|
|
41
|
-
typography: {},
|
|
42
|
-
}),
|
|
43
|
-
{ name: 'Title' },
|
|
6
|
+
type OwnerState = {
|
|
7
|
+
size?: 'small' | 'medium'
|
|
8
|
+
gutterTop?: boolean
|
|
9
|
+
gutterBottom?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const parts = ['root', 'title', 'icon'] as const
|
|
13
|
+
const { withState } = extendableComponent<OwnerState, 'LayoutTitle', typeof parts>(
|
|
14
|
+
'LayoutTitle',
|
|
15
|
+
parts,
|
|
44
16
|
)
|
|
45
17
|
|
|
46
18
|
export type TitleProps = {
|
|
47
19
|
children: React.ReactNode
|
|
48
|
-
icon?:
|
|
49
|
-
size?: 'small' | 'medium'
|
|
20
|
+
icon?: SvgIconProps['src']
|
|
50
21
|
variant?: TypographyProps['variant']
|
|
51
|
-
gutterTop?: boolean
|
|
52
|
-
gutterBottom?: boolean
|
|
53
22
|
component?: React.ElementType
|
|
54
|
-
|
|
23
|
+
sx?: SxProps<Theme>
|
|
24
|
+
} & OwnerState
|
|
55
25
|
|
|
56
26
|
export const LayoutTitle = React.forwardRef<HTMLDivElement, TitleProps>((props, ref) => {
|
|
57
|
-
const { children, icon, size = 'medium', component, variant } = props
|
|
58
|
-
const classes = useStyles(props)
|
|
59
|
-
const small = size === 'small'
|
|
27
|
+
const { children, icon, size = 'medium', component, variant, sx = [] } = props
|
|
60
28
|
|
|
61
29
|
const gutterTop = !!(props.gutterTop ?? size !== 'small')
|
|
62
30
|
const gutterBottom = !!(props.gutterBottom ?? size !== 'small')
|
|
63
31
|
|
|
64
|
-
const
|
|
32
|
+
const classes = withState({ size, gutterBottom, gutterTop })
|
|
65
33
|
|
|
66
34
|
return (
|
|
67
|
-
<
|
|
68
|
-
|
|
35
|
+
<Box
|
|
36
|
+
className={classes.root}
|
|
37
|
+
sx={[
|
|
38
|
+
(theme) => ({
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
justifyContent: 'center',
|
|
42
|
+
gap: `6px`,
|
|
43
|
+
flexFlow: 'unset',
|
|
44
|
+
[theme.breakpoints.up('md')]: {
|
|
45
|
+
flexFlow: 'column',
|
|
46
|
+
},
|
|
47
|
+
'&.sizeSmall': {
|
|
48
|
+
flexFlow: 'unset',
|
|
49
|
+
overflow: 'hidden',
|
|
50
|
+
'& svg': {
|
|
51
|
+
width: responsiveVal(24, 28),
|
|
52
|
+
height: responsiveVal(24, 28),
|
|
53
|
+
strokeWidth: 1.4,
|
|
54
|
+
},
|
|
55
|
+
'& > *': {
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
whiteSpace: 'nowrap',
|
|
58
|
+
textOverflow: 'ellipsis',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
'&.gutterTop': {
|
|
62
|
+
marginTop: theme.spacings.xl,
|
|
63
|
+
},
|
|
64
|
+
'&.gutterBottom': {
|
|
65
|
+
marginBottom: theme.spacings.xl,
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
69
|
+
]}
|
|
70
|
+
>
|
|
71
|
+
{icon && (
|
|
72
|
+
<SvgIcon src={icon} size={size === 'small' ? 'large' : 'xl'} className={classes.icon} />
|
|
73
|
+
)}
|
|
69
74
|
<Typography
|
|
70
75
|
ref={ref}
|
|
71
|
-
variant={variant || (small ? 'h6' : 'h3')}
|
|
76
|
+
variant={variant || (size === 'small' ? 'h6' : 'h3')}
|
|
72
77
|
component={component ?? 'h1'}
|
|
73
|
-
className={
|
|
78
|
+
className={classes.title}
|
|
74
79
|
>
|
|
75
80
|
{children}
|
|
76
81
|
</Typography>
|
|
77
|
-
</
|
|
82
|
+
</Box>
|
|
78
83
|
)
|
|
79
84
|
})
|