Commit 869449bf authored by Chunchi Che's avatar Chunchi Che

update positionModal.tsx

parent b8477ec2
Pipeline #21016 passed with stages
in 18 minutes and 19 seconds
import React, { useState } from "react"; import React, { useRef, useState } from "react";
import { useAppSelector } from "../../hook"; import { useAppSelector } from "../../hook";
import { store } from "../../store"; import { store } from "../../store";
import { Modal, Button } from "antd"; import { Button } from "antd";
import { sendSelectPositionResponse } from "../../api/ocgcore/ocgHelper"; import { sendSelectPositionResponse } from "../../api/ocgcore/ocgHelper";
import { import {
selectPositionModalIsOpen, selectPositionModalIsOpen,
...@@ -13,6 +13,7 @@ import { ...@@ -13,6 +13,7 @@ import {
setPositionModalIsOpen, setPositionModalIsOpen,
} from "../../reducers/duel/mod"; } from "../../reducers/duel/mod";
import { CheckCard } from "@ant-design/pro-components"; import { CheckCard } from "@ant-design/pro-components";
import DragModal from "./dragModal";
const PositionModal = () => { const PositionModal = () => {
const dispatch = store.dispatch; const dispatch = store.dispatch;
...@@ -21,26 +22,31 @@ const PositionModal = () => { ...@@ -21,26 +22,31 @@ const PositionModal = () => {
const [selected, setSelected] = useState<ygopro.CardPosition | undefined>( const [selected, setSelected] = useState<ygopro.CardPosition | undefined>(
undefined undefined
); );
const draggleRef = useRef<HTMLDivElement>(null);
return ( return (
<Modal <DragModal
title="请选择表示形式" modalProps={{
open={isOpen} title: "请选择表示形式",
closable={false} open: isOpen,
footer={ closable: false,
<Button footer: (
disabled={selected === undefined} <Button
onClick={() => { disabled={selected === undefined}
if (selected !== undefined) { onClick={() => {
sendSelectPositionResponse(selected); if (selected !== undefined) {
dispatch(setPositionModalIsOpen(false)); sendSelectPositionResponse(selected);
dispatch(resetPositionModal()); dispatch(setPositionModalIsOpen(false));
} dispatch(resetPositionModal());
}} }
> }}
submit >
</Button> submit
} </Button>
),
}}
dragRef={draggleRef}
draggable={true}
> >
<CheckCard.Group <CheckCard.Group
bordered bordered
...@@ -58,7 +64,7 @@ const PositionModal = () => { ...@@ -58,7 +64,7 @@ const PositionModal = () => {
/> />
))} ))}
</CheckCard.Group> </CheckCard.Group>
</Modal> </DragModal>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment