Commit 364ae7c0 authored by Chunchi Che's avatar Chunchi Che

update cardModal.tsx

parent da339efc
Pipeline #20599 passed with stages
in 7 minutes and 4 seconds
...@@ -12,10 +12,11 @@ import { ...@@ -12,10 +12,11 @@ import {
} from "../../reducers/duel/mod"; } from "../../reducers/duel/mod";
import { Modal, Card, Button, Row, Col } from "antd"; import { Modal, Card, Button, Row, Col } from "antd";
import { sendSelectIdleCmdResponse } from "../../api/ocgcore/ocgHelper"; import { sendSelectIdleCmdResponse } from "../../api/ocgcore/ocgHelper";
import Icon from "@ant-design/icons"; import Icon, { StarOutlined } from "@ant-design/icons";
import NeosConfig from "../../../neos.config.json"; import NeosConfig from "../../../neos.config.json";
import { ReactComponent as BattleSvg } from "../../../neos-assets/battle-axe.svg"; import { ReactComponent as BattleSvg } from "../../../neos-assets/battle-axe.svg";
import { ReactComponent as DefenceSvg } from "../../../neos-assets/checked-shield.svg"; import { ReactComponent as DefenceSvg } from "../../../neos-assets/checked-shield.svg";
import { Meta2StringCodeMap } from "../../common";
const { Meta } = Card; const { Meta } = Card;
const CARD_WIDTH = 240; const CARD_WIDTH = 240;
...@@ -25,6 +26,10 @@ const CardModal = () => { ...@@ -25,6 +26,10 @@ const CardModal = () => {
const isOpen = useAppSelector(selectCardModalIsOpen); const isOpen = useAppSelector(selectCardModalIsOpen);
const meta = useAppSelector(selectCardModalMeta); const meta = useAppSelector(selectCardModalMeta);
const name = meta?.text.name; const name = meta?.text.name;
const types = meta?.text.types;
const race = meta?.data.race;
const attribute = meta?.data.attribute;
const level = meta?.data.level;
const desc = meta?.text.desc; const desc = meta?.text.desc;
const atk = meta?.data.atk; const atk = meta?.data.atk;
const def = meta?.data.def; const def = meta?.data.def;
...@@ -45,30 +50,13 @@ const CardModal = () => { ...@@ -45,30 +50,13 @@ const CardModal = () => {
cover={<img alt={name} src={imgUrl} />} cover={<img alt={name} src={imgUrl} />}
> >
<Meta title={name} /> <Meta title={name} />
<p>{desc}</p>
<p> <p>
<Row gutter={8}> <AtkLine level={level} atk={atk} def={def} />
{atk ? ( </p>
<Col> <p>
<Icon component={BattleSvg} /> <AttLine types={types} race={race} attribute={attribute} />
<a>{atk}</a>
</Col>
) : (
<></>
)}
<Col>
<div>/</div>
</Col>
{def ? (
<Col>
<Icon component={DefenceSvg} />
<a>{def}</a>
</Col>
) : (
<></>
)}
</Row>
</p> </p>
<p>{desc}</p>
</Card> </Card>
{interactivies.map((interactive, idx) => { {interactivies.map((interactive, idx) => {
return ( return (
...@@ -89,4 +77,54 @@ const CardModal = () => { ...@@ -89,4 +77,54 @@ const CardModal = () => {
); );
}; };
const AtkLine = (props: { level?: number; atk?: number; def?: number }) => (
<Row gutter={8}>
{props.level ? (
<Col>
<StarOutlined />
{props.level}
</Col>
) : (
<></>
)}
{props.atk ? (
<Col>
<Icon component={BattleSvg} />
<a>{props.atk}</a>
</Col>
) : (
<></>
)}
<Col>
<div>/</div>
</Col>
{props.def ? (
<Col>
<Icon component={DefenceSvg} />
<a>{props.def}</a>
</Col>
) : (
<></>
)}
</Row>
);
const AttLine = (props: {
types?: string;
race?: number;
attribute?: number;
}) => (
<Row gutter={8}>
{props.types ? <Col>{`[${props.types}]`}</Col> : <></>}
{props.race ? <Col>{Meta2StringCodeMap.get(props.race)}</Col> : <></>}
<Col>
<div>/</div>
</Col>
{props.attribute ? (
<Col>{Meta2StringCodeMap.get(props.attribute)}</Col>
) : (
<></>
)}
</Row>
);
export default CardModal; export default CardModal;
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