-
Notifications
You must be signed in to change notification settings - Fork 2
/
TableSettings.js
97 lines (96 loc) · 3.12 KB
/
TableSettings.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import React, { useState } from 'react';
import {
Container,
Button,
Row,
Col,
Table,
Form,
Modal
} from 'react-bootstrap';
//import styles from './tableSettings.module.css';
export default function TableSettings(props) {
let newPlayer = props.newPlayer.map((item)=>{
return(
<tr>
<th>{item}</th>
<th onClick={()=>props.removePlayerToTable(item)} style = {{cursor: 'pointer'}}>x</th>
</tr>
)
})
const [tableName, setTableName] = useState('');
const [playerName, setPlayerName] = useState('');
return (
<Modal show={props.showTableModal} centered onHide={() => props.changeTableModal()}>
<Modal.Header
closeButton
// onClick={() => props.changeTableModal()}
className='createTableModalHeader'
>
<Modal.Title style={{ fontSize: '30px' }}>
Create/Edit Table
</Modal.Title>
</Modal.Header>
<Modal.Body>
<Container>
<Row>
<Col md = {{offset: 1}} style = {{paddingLeft: '10px'}}>
<span>Table Name:</span>
<div style = {{paddingTop: '10px'}}></div>
<div>
<input onChange = {(e) => setTableName(e.target.value)} value = {tableName} type="text" placeholder = 'Enter table name'/>
</div>
<div style = {{paddingTop: '10px'}}></div>
<div style = {{paddingTop: '10px'}}></div>
<div>Invite Players</div>
<div style = {{paddingTop: '10px'}}></div>
<div>
<form onSubmit={(e) => {
e.preventDefault();
props.addPlayerToTable(playerName)
}}>
<input onChange = {(e) => { setPlayerName(e.target.value)}} style = {{display: 'inline' ,width:'75%', marginRight:'5px'}} type="email" name="emailaddress" placeholder = 'Enter user Email'/>
<Button
type="submit"
style = {{display: 'inline', position: 'relative',top: '-1px'}}
size="sm"
variant="success">
+
</Button>
</form>
</div>
</Col>
<Col>
<span>Creator: </span>
<div style = {{paddingTop: '10px'}}></div>
{/* map through administrators */}
<div>{props.userName}</div>
<div style = {{paddingTop: '10px'}}></div>
<div>
<Table size = 'sm'>
<thead>
<tr>
<th>
Players
</th>
</tr>
</thead>
<tbody>
{/* map through all players */}
{newPlayer}
</tbody>
</Table>
</div>
</Col>
</Row>
</Container>
</Modal.Body>
<Modal.Footer>
<Button
onClick={() => props.addTable(tableName, props.newPlayer)} variant="success">
Save
</Button>
</Modal.Footer>
</Modal>
);
}