Skip to content

Commit 920926d

Browse files
author
Mayur
committed
feat: Added sticky button of the Generate Template
1 parent 7d04149 commit 920926d

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { createStyles } from '@mantine/core';
2+
3+
export const useStyles = createStyles(() => ({
4+
stickyFooter: {
5+
position: 'sticky',
6+
zIndex: 1000,
7+
bottom: 0,
8+
top: 0,
9+
},
10+
}));

apps/widget/src/components/widget/Phases/ImageImport/ImageUpload.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
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';
44
import { ReactNode, useEffect, useRef, useState } from 'react';
55

66
import { Warning } from '@icons';
@@ -11,6 +11,7 @@ import { colors, variables } from '@config';
1111
import { logAmplitudeEvent } from '@amplitude';
1212
import { FileDropzone } from '@ui/FileDropzone';
1313
import { Footer } from 'components/Common/Footer';
14+
import { useStyles } from './ImageUpload.Styles';
1415
import { useImageUpload } from '@hooks/ImageUpload/useImageUpload';
1516
import { ImageWithIndicator } from '@ui/ImageWithIndicator';
1617

@@ -20,6 +21,10 @@ interface ImageUploadProps {
2021
}
2122

2223
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+
2328
const [showAlert, setShowAlert] = useLocalStorage<boolean>({
2429
key: variables.SHOW_IMAGE_ALERT_STORAGE_KEY,
2530
defaultValue: true,
@@ -50,7 +55,7 @@ export function ImageUpload({ goToUpload, texts }: ImageUploadProps) {
5055
<>
5156
<Stack style={{ flexGrow: 1 }}>
5257
<Flex gap="sm" direction="column">
53-
{showAlert && (
58+
{showAlert && isLargerThanSm && (
5459
<Alert
5560
color="blue"
5661
withCloseButton
@@ -75,6 +80,7 @@ export function ImageUpload({ goToUpload, texts }: ImageUploadProps) {
7580
)}
7681
/>
7782
</Flex>
83+
7884
<FileDropzone texts={texts} title="Upload Image" onDrop={onImageSelect} error={errors.image?.message} />
7985
<Stack ref={wrapperRef} style={{ flexGrow: 1, overflow: 'auto' }} h={containerHeight}>
8086
{Object.entries(
@@ -111,11 +117,14 @@ export function ImageUpload({ goToUpload, texts }: ImageUploadProps) {
111117
))}
112118
</Stack>
113119
</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>
119128
</>
120129
);
121130
}

0 commit comments

Comments
 (0)