fix: dnd box z-index (#1353)

* fix: dnd box z-index

* fix: dnd boxes
This commit is contained in:
Akioe Yu
2024-07-08 10:49:57 +08:00
committed by GitHub
parent e371bbedc0
commit 2cd1fa6601
5 changed files with 53 additions and 7 deletions

View File

@@ -22,7 +22,14 @@ export const GroupItem = (props: Props) => {
let { type, group, onDelete } = props;
const sortable = type === "prepend" || type === "append";
const { attributes, listeners, setNodeRef, transform, transition } = sortable
const {
attributes,
listeners,
setNodeRef,
transform,
transition,
isDragging,
} = sortable
? useSortable({ id: group.name })
: {
attributes: {},
@@ -30,6 +37,7 @@ export const GroupItem = (props: Props) => {
setNodeRef: null,
transform: null,
transition: null,
isDragging: false,
};
const [iconCachePath, setIconCachePath] = useState("");
@@ -55,6 +63,7 @@ export const GroupItem = (props: Props) => {
<ListItem
dense
sx={({ palette }) => ({
position: "relative",
background:
type === "original"
? palette.mode === "dark"
@@ -68,6 +77,7 @@ export const GroupItem = (props: Props) => {
borderRadius: "8px",
transform: CSS.Transform.toString(transform),
transition,
zIndex: isDragging ? "calc(infinity)" : undefined,
})}
>
{group.icon && group.icon?.trim().startsWith("http") && (