Skip to content

Commit 5645207

Browse files
committed
feat: move Snackbar to top of screen in mobile
1 parent de9321d commit 5645207

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBar.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
IconInfoCircle,
88
IconSquareRoundedCheck,
99
IconX,
10+
MOBILE_VIEWPORT,
1011
} from 'twenty-ui';
1112

1213
import { ProgressBar } from '@/ui/feedback/progress-bar/components/ProgressBar';
@@ -39,7 +40,7 @@ export type SnackBarProps = Pick<
3940
};
4041

4142
const StyledContainer = styled.div`
42-
backdrop-filter: ${({ theme }) => theme.blur.light};
43+
backdrop-filter: ${({ theme }) => theme.blur.medium};
4344
background-color: ${({ theme }) => theme.background.transparent.primary};
4445
border-radius: ${({ theme }) => theme.border.radius.md};
4546
box-shadow: ${({ theme }) => theme.boxShadow.strong};
@@ -49,6 +50,11 @@ const StyledContainer = styled.div`
4950
padding: ${({ theme }) => theme.spacing(2)};
5051
position: relative;
5152
width: 296px;
53+
54+
@media (max-width: ${MOBILE_VIEWPORT}px) {
55+
border-radius: 0;
56+
width: 100%;
57+
}
5258
`;
5359

5460
const StyledProgressBar = styled(ProgressBar)`

packages/twenty-front/src/modules/ui/feedback/snack-bar-manager/components/SnackBarProvider.tsx

+17-14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { MOBILE_VIEWPORT } from 'twenty-ui';
44

55
import { useSnackBarManagerScopedStates } from '@/ui/feedback/snack-bar-manager/hooks/internal/useSnackBarManagerScopedStates';
66
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
7+
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
78

89
import { SnackBar } from './SnackBar';
910

@@ -16,26 +17,28 @@ const StyledSnackBarContainer = styled.div`
1617
z-index: ${({ theme }) => theme.lastLayerZIndex};
1718
1819
@media (max-width: ${MOBILE_VIEWPORT}px) {
19-
bottom: ${({ theme }) => theme.spacing(16)};
20-
right: 50%;
21-
transform: translateX(50%);
20+
top: 0;
21+
bottom: auto;
22+
left: 0;
23+
right: 0;
2224
}
2325
`;
2426

25-
const variants = {
26-
out: {
27-
opacity: 0,
28-
y: 40,
29-
},
30-
in: {
31-
opacity: 1,
32-
y: 0,
33-
},
34-
};
35-
3627
export const SnackBarProvider = ({ children }: React.PropsWithChildren) => {
3728
const { snackBarInternal } = useSnackBarManagerScopedStates();
3829
const { handleSnackBarClose } = useSnackBar();
30+
const isMobile = useIsMobile();
31+
32+
const variants = {
33+
out: {
34+
opacity: 0,
35+
y: isMobile ? -40 : 40,
36+
},
37+
in: {
38+
opacity: 1,
39+
y: 0,
40+
},
41+
};
3942

4043
return (
4144
<>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export const BLUR = {
22
light: 'blur(6px)',
3+
medium: 'blur(12px)',
34
strong: 'blur(20px)',
45
};

0 commit comments

Comments
 (0)