fix(ux): replace buggy margin-based centering with reliable flexbox wrapper to permanently center floating action bars

This commit is contained in:
ashu130698 committed 2026-05-14 15:49:16 +05:30
1 parent 2097bc477a
commit d5d79a1eda
1 file changed
+12 -4
@@ -2,6 +2,7 @@ import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
@@ -31,16 +32,22 @@ export const FloatingActionBar: React.FC<FloatingActionBarProps> = ({
mountOnEnter mountOnEnter
unmountOnExit unmountOnExit
> >
<Paper <Box
elevation={6}
sx={{ sx={{
position: "fixed", position: "fixed",
bottom: theme.spacing(LAYOUT.XS), bottom: theme.spacing(LAYOUT.XS),
left: 0, left: 0,
right: 0, right: 0,
margin: "0 auto", display: "flex",
width: "max-content", justifyContent: "center",
pointerEvents: "none",
zIndex: theme.zIndex.snackbar, zIndex: theme.zIndex.snackbar,
}}
>
<Paper
elevation={6}
sx={{
pointerEvents: "auto",
px: LAYOUT.MD, px: LAYOUT.MD,
py: LAYOUT.XS, py: LAYOUT.XS,
borderRadius: theme.shape.borderRadius, borderRadius: theme.shape.borderRadius,
@@ -83,6 +90,7 @@ export const FloatingActionBar: React.FC<FloatingActionBarProps> = ({
</Stack> </Stack>
)} )}
</Paper> </Paper>
</Box>
</Slide> </Slide>
); );
}; };