1
1
import { Controller } from 'react-hook-form' ;
2
- import { useLocalStorage } from '@mantine/hooks' ;
3
- import { Alert , Flex , Stack , Text } from '@mantine/core' ;
2
+ import { useLocalStorage , useMediaQuery } from '@mantine/hooks' ;
3
+ import { Alert , Flex , Stack , Text , Box , useMantineTheme } from '@mantine/core' ;
4
4
import { ReactNode , useEffect , useRef , useState } from 'react' ;
5
5
6
6
import { Warning } from '@icons' ;
@@ -11,6 +11,7 @@ import { colors, variables } from '@config';
11
11
import { logAmplitudeEvent } from '@amplitude' ;
12
12
import { FileDropzone } from '@ui/FileDropzone' ;
13
13
import { Footer } from 'components/Common/Footer' ;
14
+ import { useStyles } from './ImageUpload.Styles' ;
14
15
import { useImageUpload } from '@hooks/ImageUpload/useImageUpload' ;
15
16
import { ImageWithIndicator } from '@ui/ImageWithIndicator' ;
16
17
@@ -20,6 +21,10 @@ interface ImageUploadProps {
20
21
}
21
22
22
23
export function ImageUpload ( { goToUpload, texts } : ImageUploadProps ) {
24
+ const { classes } = useStyles ( ) ;
25
+ const theme = useMantineTheme ( ) ;
26
+ const isLargerThanSm = useMediaQuery ( `(min-width: ${ theme . breakpoints . sm } px)` ) ;
27
+
23
28
const [ showAlert , setShowAlert ] = useLocalStorage < boolean > ( {
24
29
key : variables . SHOW_IMAGE_ALERT_STORAGE_KEY ,
25
30
defaultValue : true ,
@@ -50,7 +55,7 @@ export function ImageUpload({ goToUpload, texts }: ImageUploadProps) {
50
55
< >
51
56
< Stack style = { { flexGrow : 1 } } >
52
57
< Flex gap = "sm" direction = "column" >
53
- { showAlert && (
58
+ { showAlert && isLargerThanSm && (
54
59
< Alert
55
60
color = "blue"
56
61
withCloseButton
@@ -75,6 +80,7 @@ export function ImageUpload({ goToUpload, texts }: ImageUploadProps) {
75
80
) }
76
81
/>
77
82
</ Flex >
83
+
78
84
< FileDropzone texts = { texts } title = "Upload Image" onDrop = { onImageSelect } error = { errors . image ?. message } />
79
85
< Stack ref = { wrapperRef } style = { { flexGrow : 1 , overflow : 'auto' } } h = { containerHeight } >
80
86
{ Object . entries (
@@ -111,11 +117,14 @@ export function ImageUpload({ goToUpload, texts }: ImageUploadProps) {
111
117
) ) }
112
118
</ Stack >
113
119
</ Stack >
114
- < Footer
115
- active = { PhasesEnum . IMAGE_UPLOAD }
116
- onNextClick = { onGenerateTemplateClick }
117
- primaryButtonLoading = { isDownloadInProgress }
118
- />
120
+
121
+ < Box className = { classes . stickyFooter } >
122
+ < Footer
123
+ active = { PhasesEnum . IMAGE_UPLOAD }
124
+ onNextClick = { onGenerateTemplateClick }
125
+ primaryButtonLoading = { isDownloadInProgress }
126
+ />
127
+ </ Box >
119
128
</ >
120
129
) ;
121
130
}
0 commit comments