feat: added scroll top button for agent and rule pages

This commit is contained in:
huzibaca
2024-11-22 09:22:44 +08:00
parent 9df2ceba84
commit 397e6a9d57
3 changed files with 117 additions and 32 deletions

View File

@@ -0,0 +1,35 @@
import { IconButton, Fade } from "@mui/material";
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
interface Props {
onClick: () => void;
show: boolean;
}
export const ScrollTopButton = ({ onClick, show }: Props) => {
return (
<Fade in={show}>
<IconButton
onClick={onClick}
sx={{
position: "absolute",
bottom: "20px",
right: "20px",
backgroundColor: (theme) =>
theme.palette.mode === "dark"
? "rgba(255,255,255,0.1)"
: "rgba(0,0,0,0.1)",
"&:hover": {
backgroundColor: (theme) =>
theme.palette.mode === "dark"
? "rgba(255,255,255,0.2)"
: "rgba(0,0,0,0.2)",
},
visibility: show ? "visible" : "hidden",
}}
>
<KeyboardArrowUpIcon />
</IconButton>
</Fade>
);
};