Commit 561af3a7 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'optimize/duel/layout' into 'main'

Optimize/duel/layout

See merge request mycard/Neos!113
parents 89790ce6 de6e9486
Pipeline #20434 passed with stages
in 6 minutes and 46 seconds
......@@ -38,6 +38,20 @@
"z": 1
},
"floating": 0.02
},
"layout": {
"header": {
"height": 80
},
"content": {
"height": 800
},
"sider": {
"width": 400
},
"footer": {
"height": 80
}
}
}
}
This diff is collapsed.
import React from "react";
import { Layout } from "antd";
import NeosConfig from "../../../neos.config.json";
const layoutConfig = NeosConfig.ui.layout;
const { Header, Footer, Sider, Content } = Layout;
const headerStyle: React.CSSProperties = {
textAlign: "center",
color: "#fff",
height: layoutConfig.header.height,
paddingInline: 50,
lineHeight: "64px",
};
const contentStyle: React.CSSProperties = {
textAlign: "center",
minHeight: 120,
height: layoutConfig.content.height,
lineHeight: "120px",
};
const siderStyle: React.CSSProperties = {
lineHeight: "120px",
position: "fixed",
overflow: "auto",
height: "100vh",
padding: "50px 20px",
color: "#fff",
};
const footerStyle: React.CSSProperties = {
textAlign: "center",
height: layoutConfig.footer.height,
color: "#fff",
};
const NeosLayout = (props: {
sider: React.ReactNode;
header: React.ReactNode;
content: React.ReactNode;
footer: React.ReactNode;
}) => {
return (
<Layout>
<Sider style={siderStyle} width={layoutConfig.sider.width}>
{props.sider}
</Sider>
<Layout>
<Header style={headerStyle}>{props.header}</Header>
<Content style={contentStyle}>{props.content}</Content>
<Footer style={footerStyle}>{props.footer}</Footer>
</Layout>
</Layout>
);
};
export default NeosLayout;
......@@ -19,8 +19,12 @@ import OptionModal from "./optionModal";
import Phase from "./phase";
import CheckCardModalV2 from "./checkCardModalV2";
import ExtraDeck from "./extraDeck";
import NeosLayout from "./layout";
import { initStrings } from "../../api/strings";
import NeosConfig from "../../../neos.config.json";
import DuelTimeLine from "./timeLine";
import { Row } from "antd";
import SendBox from "./sendBox";
// Ref: https://github.com/brianzinn/react-babylonjs/issues/126
const NeosDuel = () => {
......@@ -41,29 +45,12 @@ const NeosDuel = () => {
return (
<>
<ReactReduxContext.Consumer>
{({ store }) => (
<Engine antialias adaptToDeviceRatio canvasId="babylonJS">
<Scene>
<Provider store={store}>
<Camera />
<Light />
<Hands />
<Monsters />
<Magics />
<Field />
<CommonDeck />
<ExtraDeck />
<Cemeteries />
<Exclusion />
<Field />
<Phase />
<Ground />
</Provider>
</Scene>
</Engine>
)}
</ReactReduxContext.Consumer>
<NeosLayout
sider={<NeosSider />}
header={<div>header</div>}
content={<NeosCanvas />}
footer={<div>footer</div>}
/>
<CardModal />
<CardListModal />
<HintNotification />
......@@ -76,6 +63,43 @@ const NeosDuel = () => {
);
};
const NeosSider = () => (
<div>
<Row>
<DuelTimeLine />
</Row>
<Row>
<SendBox />
</Row>
</div>
);
const NeosCanvas = () => (
<ReactReduxContext.Consumer>
{({ store }) => (
<Engine antialias adaptToDeviceRatio canvasId="babylonJS">
<Scene>
<Provider store={store}>
<Camera />
<Light />
<Hands />
<Monsters />
<Magics />
<Field />
<CommonDeck />
<ExtraDeck />
<Cemeteries />
<Exclusion />
<Field />
<Phase />
<Ground />
</Provider>
</Scene>
</Engine>
)}
</ReactReduxContext.Consumer>
);
const Camera = () => (
<freeCamera
name="duel-camera"
......
import React, { useState } from "react";
import { Input, Button, Row, Col } from "antd";
import { SendOutlined } from "@ant-design/icons";
const SendBox = () => {
const [content, setContent] = useState("");
return (
<>
<Row>
<Input.TextArea
placeholder="Message to sent..."
autoSize={{ minRows: 3, maxRows: 4 }}
value={content}
onChange={(e) => {
setContent(e.target.value);
}}
/>
</Row>
<Row>
<Col>
<Button
icon={<SendOutlined />}
onClick={() => {}}
disabled={!content}
/>
</Col>
</Row>
</>
);
};
export default SendBox;
import React from "react";
import { Timeline } from "antd";
import { UserOutlined, SettingOutlined } from "@ant-design/icons";
const DuelTimeLine = () => (
<Timeline
items={[
{
dot: <UserOutlined />,
children: "对手消息",
color: "red",
},
{
dot: <UserOutlined />,
children: "自己消息",
color: "green",
},
{
dot: <SettingOutlined />,
children: "系统消息",
},
]}
/>
);
export default DuelTimeLine;
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