Added fixed speed dial
This commit is contained in:
@@ -33,6 +33,7 @@ import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|||||||
import NodePieChart, { PieData } from "./NodePieChart";
|
import NodePieChart, { PieData } from "./NodePieChart";
|
||||||
import Fab from "@mui/material/Fab";
|
import Fab from "@mui/material/Fab";
|
||||||
import AddIcon from "@mui/icons-material/Add";
|
import AddIcon from "@mui/icons-material/Add";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
import Grid2 from "@mui/material/Unstable_Grid2"; // Grid version 2
|
import Grid2 from "@mui/material/Unstable_Grid2"; // Grid version 2
|
||||||
import {
|
import {
|
||||||
@@ -118,7 +119,8 @@ function stableSort<T>(
|
|||||||
return stabilizedThis.map((el) => el[0]);
|
return stabilizedThis.map((el) => el[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function BasicSpeedDial() {
|
function CrudSpeedDial(props: {selected: string | undefined}) {
|
||||||
|
const { selected } = props;
|
||||||
const [open, setOpen] = React.useState(false);
|
const [open, setOpen] = React.useState(false);
|
||||||
|
|
||||||
function handleClose(event: any, reason: CloseReason) {
|
function handleClose(event: any, reason: CloseReason) {
|
||||||
@@ -133,19 +135,22 @@ function BasicSpeedDial() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isSomethingSelected = selected != undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
transform: "translateZ(0px)",
|
transform: "translateZ(0px)",
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
right: 10,
|
right: 20,
|
||||||
top: 10,
|
top: 15,
|
||||||
margin: 0,
|
margin: 0,
|
||||||
zIndex: 9000,
|
zIndex: 9000,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SpeedDial
|
<SpeedDial
|
||||||
|
color="secondary"
|
||||||
ariaLabel="SpeedDial basic example"
|
ariaLabel="SpeedDial basic example"
|
||||||
icon={<SpeedDialIcon />}
|
icon={<SpeedDialIcon />}
|
||||||
direction="down"
|
direction="down"
|
||||||
@@ -153,13 +158,30 @@ function BasicSpeedDial() {
|
|||||||
onOpen={handleOpen}
|
onOpen={handleOpen}
|
||||||
open={open}
|
open={open}
|
||||||
>
|
>
|
||||||
<SpeedDialAction key="Edit" icon={<EditIcon />} tooltipTitle="Edit" />
|
<SpeedDialAction
|
||||||
<SpeedDialAction key="Add" icon={<AddIcon />} tooltipTitle="Add" />
|
key="Add"
|
||||||
|
icon={
|
||||||
|
<Link href="/nodes/add">
|
||||||
|
<AddIcon color="action" />
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
tooltipTitle="Add"
|
||||||
|
/>
|
||||||
|
|
||||||
<SpeedDialAction
|
<SpeedDialAction
|
||||||
key="Delete"
|
key="Delete"
|
||||||
icon={<DeleteIcon />}
|
icon={<DeleteIcon color={isSomethingSelected ? "action" : "disabled"} />}
|
||||||
tooltipTitle="Delete"
|
tooltipTitle="Delete"
|
||||||
/>
|
/>
|
||||||
|
<SpeedDialAction
|
||||||
|
key="Edit"
|
||||||
|
icon={
|
||||||
|
<Link href="/nodes/edit">
|
||||||
|
<EditIcon color={isSomethingSelected ? "action" : "disabled"} />
|
||||||
|
</Link>
|
||||||
|
}
|
||||||
|
tooltipTitle="Edit"
|
||||||
|
/>
|
||||||
</SpeedDial>
|
</SpeedDial>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
@@ -267,7 +289,7 @@ function EnhancedTableToolbar(props: EnhancedTableToolbarProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid2 container spacing={1} sx={debugSx}>
|
<Grid2 container spacing={1} sx={debugSx}>
|
||||||
<BasicSpeedDial />
|
<CrudSpeedDial selected={selected}/>
|
||||||
<Grid2 key="Header" xs={6}>
|
<Grid2 key="Header" xs={6}>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{ marginLeft: 3, marginTop: 1 }}
|
sx={{ marginLeft: 3, marginTop: 1 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user