added hooks for populating inputs in teameditor
This commit is contained in:
parent
189a047bd2
commit
237ecac25a
|
@ -1,31 +1,72 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom";
|
import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom";
|
||||||
import Appbar from './components/appbar';
|
import Appbar from "./components/appbar";
|
||||||
import { Button, TextField, MenuItem, InputLabel, Select, Container, Slider } from '@mui/material'
|
import {
|
||||||
|
Button,
|
||||||
function TeamList() {
|
TextField,
|
||||||
let teams = {"team 1": ["tom", "eric", "gustav"], "team 2": ["emma", "mari", "ida"],"team 3": ["ola", "ole", "ost"],"team 4": ["christine", "kristine", "kristhine"]}
|
MenuItem,
|
||||||
return (<div>
|
InputLabel,
|
||||||
<ul>
|
Select,
|
||||||
{Object.entries(teams).map(([team, players]) => <li key={team} ><button>{team}</button></li>)}
|
Container,
|
||||||
</ul>
|
Slider,
|
||||||
</div>)
|
} from "@mui/material";
|
||||||
}
|
|
||||||
|
|
||||||
function TeamChanger() {
|
function TeamChanger() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<form>
|
<form>
|
||||||
<InputLabel htmlFor="teamInput">Team Name: </InputLabel>
|
<InputLabel htmlFor="teamInput">Team Name: </InputLabel>
|
||||||
<TextField type="text" id="teamInput" variant="filled" label="Team Name:" />
|
<TextField
|
||||||
|
type="text"
|
||||||
|
id="teamInput"
|
||||||
|
variant="filled"
|
||||||
|
label="Team Name:"
|
||||||
|
/>
|
||||||
<InputLabel htmlFor="membersInput">Team Members: </InputLabel>
|
<InputLabel htmlFor="membersInput">Team Members: </InputLabel>
|
||||||
<TextField type="text" id="membersInput" variant="filled" label="Members:"/>
|
<TextField
|
||||||
|
type="text"
|
||||||
|
id="membersInput"
|
||||||
|
variant="filled"
|
||||||
|
label="Members:"
|
||||||
|
/>
|
||||||
</form>
|
</form>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TeamList() {
|
||||||
|
let teams = {
|
||||||
|
"team 1": ["tom", "eric", "gustav"],
|
||||||
|
"team 2": ["emma", "mari", "ida"],
|
||||||
|
"team 3": ["ola", "ole", "ost"],
|
||||||
|
"team 4": ["christine", "kristine", "kristhine"],
|
||||||
|
};
|
||||||
|
const [teamInput, setteamInput] = React.useState("");
|
||||||
|
const [membersInput, setmembersInput] = React.useState("");
|
||||||
|
React.useEffect(() => {
|
||||||
|
document.getElementById("teamInput").value = teamInput;
|
||||||
|
document.getElementById("membersInput").value = membersInput;
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
{Object.entries(teams).map(([team, players]) => (
|
||||||
|
<li key={team}>
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
setteamInput(team);
|
||||||
|
setmembersInput(players);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{team}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default function TeamEditor() {
|
export default function TeamEditor() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue