-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from shibisuriya/feat/step-controls
Feat/step controls
- Loading branch information
Showing
8 changed files
with
143 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
.game { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
margin-top: 30px; | ||
height: 100vh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { Fragment, useState } from 'react'; | ||
import { Radio, Row, Col, Space } from 'antd'; | ||
import styles from './directionselector.module.css'; | ||
|
||
function DirectionSelector({ id, headColor, bodyColor, direction, updateSnakeDirection }) { | ||
return ( | ||
<div className={styles.container}> | ||
<div className={styles['colors-container']}> | ||
<div className={styles.head} style={{ backgroundColor: headColor }}></div> | ||
<div className={styles.body} style={{ backgroundColor: bodyColor }}></div> | ||
</div> | ||
<div> | ||
<Radio.Group | ||
onChange={(e) => { | ||
updateSnakeDirection(id, e.target.value); | ||
}} | ||
value={direction} | ||
> | ||
<Row justify="center" align="middle"> | ||
<Col span={6}> | ||
<div className={styles['radio-button']}> | ||
<Radio.Button value={'left'}>W</Radio.Button> | ||
</div> | ||
</Col> | ||
<Col span={6}> | ||
<div className={styles['radio-button']}> | ||
<Radio.Button value={'up'}>N</Radio.Button> | ||
</div> | ||
|
||
<div className={styles['radio-button']}> | ||
<Radio.Button value={'down'}>S</Radio.Button> | ||
</div> | ||
</Col> | ||
<Col span={6}> | ||
<div className={styles['radio-button']}> | ||
<Radio.Button value={'right'}>E</Radio.Button> | ||
</div> | ||
</Col> | ||
</Row> | ||
</Radio.Group> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default DirectionSelector; |
30 changes: 30 additions & 0 deletions
30
packages/game-client/src/components/directionselector.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.radio-button { | ||
margin: 10px; | ||
padding: 6px; | ||
} | ||
|
||
.colors-container { | ||
margin-top: 10px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.head { | ||
width: 50px; | ||
height: 50px; | ||
} | ||
|
||
.body { | ||
width: 30px; | ||
height: 30px; | ||
} | ||
|
||
.id { | ||
text-align: center; | ||
} | ||
|
||
.container { | ||
border: 1px solid black; | ||
border-radius: 15px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters