- Fix the warning button can not be descendant of button
- Fix the warning possible change from uncontrolled to controlled component
This commit is contained in:
1 parent
9370db62cc
commit
00be6c219a
2 files changed
+15
-18
No files matched your search
@@ -2,22 +2,19 @@ import React, { useRef } from "react";
|
||||
import { useDrag, useDrop } from "react-dnd";
|
||||
import ItemTypes from "./ItemTypes";
|
||||
import Card from "@mui/material/Card";
|
||||
import CardActionArea from "@mui/material/CardActionArea";
|
||||
import CardContent from "@mui/material/CardContent";
|
||||
import Server from "./Server"
|
||||
import { CardContent } from "@mui/material";
|
||||
|
||||
const CustomCard = React.forwardRef((props, ref) => (
|
||||
<Card ref={ref}>
|
||||
<CardActionArea>
|
||||
<CardContent>
|
||||
<Server
|
||||
id={props.id}
|
||||
removeItem={props.removeCard}
|
||||
value={props.value}
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</CardActionArea>
|
||||
<CardContent>
|
||||
<Server
|
||||
id={props.id}
|
||||
removeItem={props.removeCard}
|
||||
value={props.value}
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
));
|
||||
|
||||
@@ -68,7 +65,7 @@ const MyCard = ({ id, index, moveCard, removeCard, value, onChange }) => {
|
||||
item.index = hoverIndex;
|
||||
}
|
||||
});
|
||||
const [ {isDragging}, drag] = useDrag({
|
||||
const [ _, drag] = useDrag({
|
||||
type: ItemTypes.CARD,
|
||||
item: {id: id, index:index},
|
||||
collect: monitor => ({
|
||||
@@ -76,14 +73,14 @@ const MyCard = ({ id, index, moveCard, removeCard, value, onChange }) => {
|
||||
})
|
||||
});
|
||||
drag(drop(ref));
|
||||
return (
|
||||
return (
|
||||
<CustomCard
|
||||
ref={ref}
|
||||
ref={ref}
|
||||
id={id}
|
||||
removeCard={removeCard}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
/>
|
||||
onChange={onChange}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ const ContentPanel = () => {
|
||||
text={"" + idx}
|
||||
moveCard={moveCard}
|
||||
removeCard={removeCard}
|
||||
value={card?.url}
|
||||
value={card?.url??""}
|
||||
onChange = {handleCardChange}
|
||||
/>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user