- 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:
Shemy Gan committed 2024-12-12 09:58:11 -05:00
1 parent 9370db62cc
commit 00be6c219a
2 files changed
+3 -6

No files matched your search

@@ -2,13 +2,11 @@ import React, { useRef } from "react";
import { useDrag, useDrop } from "react-dnd"; import { useDrag, useDrop } from "react-dnd";
import ItemTypes from "./ItemTypes"; import ItemTypes from "./ItemTypes";
import Card from "@mui/material/Card"; import Card from "@mui/material/Card";
import CardActionArea from "@mui/material/CardActionArea";
import CardContent from "@mui/material/CardContent";
import Server from "./Server" import Server from "./Server"
import { CardContent } from "@mui/material";
const CustomCard = React.forwardRef((props, ref) => ( const CustomCard = React.forwardRef((props, ref) => (
<Card ref={ref}> <Card ref={ref}>
<CardActionArea>
<CardContent> <CardContent>
<Server <Server
id={props.id} id={props.id}
@@ -17,7 +15,6 @@ const CustomCard = React.forwardRef((props, ref) => (
onChange={props.onChange} onChange={props.onChange}
/> />
</CardContent> </CardContent>
</CardActionArea>
</Card> </Card>
)); ));
@@ -68,7 +65,7 @@ const MyCard = ({ id, index, moveCard, removeCard, value, onChange }) => {
item.index = hoverIndex; item.index = hoverIndex;
} }
}); });
const [ {isDragging}, drag] = useDrag({ const [ _, drag] = useDrag({
type: ItemTypes.CARD, type: ItemTypes.CARD,
item: {id: id, index:index}, item: {id: id, index:index},
collect: monitor => ({ collect: monitor => ({
@@ -169,7 +169,7 @@ const ContentPanel = () => {
text={"" + idx} text={"" + idx}
moveCard={moveCard} moveCard={moveCard}
removeCard={removeCard} removeCard={removeCard}
value={card?.url} value={card?.url??""}
onChange = {handleCardChange} onChange = {handleCardChange}
/> />
))} ))}