Added save, add and remove buttons to teameditor
This commit is contained in:
parent
39c6b3fea1
commit
bcf912c18c
|
@ -29,18 +29,19 @@ function TeamChanger() {
|
||||||
variant="filled"
|
variant="filled"
|
||||||
label="Members:"
|
label="Members:"
|
||||||
/>
|
/>
|
||||||
|
<br />
|
||||||
|
<button>Save Team</button>
|
||||||
</form>
|
</form>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
var teams = {
|
||||||
function TeamList() {
|
|
||||||
let teams = {
|
|
||||||
"team 1": ["tom", "eric", "gustav"],
|
"team 1": ["tom", "eric", "gustav"],
|
||||||
"team 2": ["emma", "mari", "ida"],
|
"team 2": ["emma", "mari", "ida"],
|
||||||
"team 3": ["ola", "ole", "ost"],
|
"team 3": ["ola", "ole", "ost"],
|
||||||
"team 4": ["christine", "kristine", "kristhine"],
|
"team 4": ["christine", "kristine", "kristhine"],
|
||||||
};
|
};
|
||||||
|
function TeamList() {
|
||||||
const [teamInput, setteamInput] = React.useState("");
|
const [teamInput, setteamInput] = React.useState("");
|
||||||
const [membersInput, setmembersInput] = React.useState("");
|
const [membersInput, setmembersInput] = React.useState("");
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
@ -49,6 +50,7 @@ function TeamList() {
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
Registered teams:
|
||||||
<ul>
|
<ul>
|
||||||
{Object.entries(teams).map(([team, players]) => (
|
{Object.entries(teams).map(([team, players]) => (
|
||||||
<li key={team}>
|
<li key={team}>
|
||||||
|
@ -67,12 +69,36 @@ function TeamList() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TeamRemover() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
Remove team:{" "}
|
||||||
|
<select>
|
||||||
|
{Object.entries(teams).map(([team, players]) => (
|
||||||
|
<option value={team}>{team}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
<button>Remove</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Save_Button() {
|
||||||
|
return (
|
||||||
|
<Link to="/tournament">
|
||||||
|
<button>Save and Exit</button>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default function TeamEditor() {
|
export default function TeamEditor() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Appbar />
|
<Appbar />
|
||||||
<TeamChanger />
|
<TeamChanger />
|
||||||
<TeamList />
|
<TeamList />
|
||||||
|
<TeamRemover />
|
||||||
|
<Save_Button />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue