adjust css & add slider

This commit is contained in:
Songyi Huang 2020-01-17 19:06:42 -08:00
parent 5568bb8d08
commit 376dd8c4eb
4 changed files with 26 additions and 11 deletions

View File

@ -3,6 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@material-ui/core": "^4.8.3",
"@testing-library/jest-dom": "^4.2.4", "@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2", "@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2", "@testing-library/user-event": "^7.1.2",

View File

@ -2,6 +2,7 @@
.played-card-area { .played-card-area {
font-size: 12px; font-size: 12px;
width: 300px;
display: flex; display: flex;
justify-content: center; justify-content: center;
.non-card { .non-card {
@ -97,10 +98,6 @@
height: 130px; height: 130px;
font-size: 10px; font-size: 10px;
.player-info {
float: right;
}
.player-hand-up { .player-hand-up {
position: absolute; position: absolute;
top: 0; top: 0;
@ -122,6 +119,10 @@
top: 0; top: 0;
margin-right: 130px; margin-right: 130px;
} }
.player-info {
float: right;
}
} }
.played-card-area { .played-card-area {
@ -161,6 +162,7 @@
} }
.played-card-area { .played-card-area {
width: 100%;
position: relative; position: relative;
transform: translateY(25px); transform: translateY(25px);
.non-card { .non-card {

View File

@ -102,7 +102,7 @@ class DoudizhuGameBoard extends React.Component {
} }
millisecond2Second(t){ millisecond2Second(t){
return Math.round(t/1000); return Math.ceil(t/1000);
} }
playerDecisionArea(playerIdx){ playerDecisionArea(playerIdx){

View File

@ -4,7 +4,8 @@ import DoudizhuGameBoard from '../components/GameBoard';
import webSocket from "socket.io-client"; import webSocket from "socket.io-client";
import {removeCards, doubleRaf} from "../utils"; import {removeCards, doubleRaf} from "../utils";
import { Button, Layout, Slider } from 'element-react'; import { Button, Layout, Slider as elSlider } from 'element-react';
import Slider from '@material-ui/core/Slider';
class DoudizhuGameView extends React.Component { class DoudizhuGameView extends React.Component {
constructor(props) { constructor(props) {
@ -160,13 +161,24 @@ class DoudizhuGameView extends React.Component {
<Button type="primary" onClick={()=>{this.startReplay()}}>Start Replay</Button> <Button type="primary" onClick={()=>{this.startReplay()}}>Start Replay</Button>
</Layout.Col> </Layout.Col>
</Layout.Row> </Layout.Row>
<Layout.Row> <Layout.Row style={{height: "31px"}}>
<Layout.Col span="24"> <Layout.Col span="8" style={{height: "100%"}}>
<div className="block"> <div style={{display: "table", height: "100%"}}>
<span className="demonstration">不显示间断点</span> <span style={{display: "table-cell", verticalAlign: "middle"}}>Consideration Time</span>
<Slider value={this.state.considerationTime} step={100} min={0} max={10000} onChange={(newVal)=>{console.log('slider val', newVal);this.setState({considerationTime: newVal})}} />
</div> </div>
</Layout.Col> </Layout.Col>
<Layout.Col span="16">
<Slider
value={this.state.considerationTime}
onChange={(e, newVal)=>{console.log('slider val', newVal);this.setState({considerationTime: newVal})}}
aria-labelledby="discrete-slider"
valueLabelDisplay="auto"
step={1000}
marks
min={0}
max={10000}
/>
</Layout.Col>
</Layout.Row> </Layout.Row>
<Layout.Row> <Layout.Row>
<Layout.Col span="24"> <Layout.Col span="24">