parent
035663f1bb
commit
245afbd6f1
@ -0,0 +1,74 @@
|
||||
import './LeagueTable.css'
|
||||
|
||||
import React from 'react'
|
||||
|
||||
|
||||
|
||||
class LeaguesTable extends React.Component
|
||||
{
|
||||
constructor(props)
|
||||
{
|
||||
super(props);
|
||||
console.log('constructor', props);
|
||||
// this.leagues = this.props.leagues;
|
||||
this.Leagues =[{//Leagues[0]
|
||||
"name":"Legendary League",
|
||||
"players":
|
||||
[
|
||||
{
|
||||
"name":"hc12",
|
||||
"points":10,
|
||||
"playedMatches":10
|
||||
},
|
||||
{
|
||||
"name":"DashPT5",
|
||||
"points":10,
|
||||
"playedMatches":10
|
||||
}
|
||||
],
|
||||
"games":
|
||||
[
|
||||
{
|
||||
"_id":"String"
|
||||
},
|
||||
{
|
||||
"_id": "String"
|
||||
}
|
||||
]
|
||||
},
|
||||
{ ",name":"League0"},
|
||||
{"name":"League1"}
|
||||
]
|
||||
}
|
||||
headers()
|
||||
{
|
||||
return(
|
||||
<tr>
|
||||
<th>Leagues</th>
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
rows()
|
||||
{
|
||||
return this.Leagues.map(({name}) => {
|
||||
return <tr key={name} >
|
||||
<td onClick={this.goToLeague}>{name}</td>
|
||||
</tr>
|
||||
})
|
||||
}
|
||||
goToLeague = (event)=>
|
||||
{
|
||||
console.log(this.props)
|
||||
this.props.GoTo(event.target.innerHTML);
|
||||
}
|
||||
render()
|
||||
{
|
||||
return(
|
||||
<table>
|
||||
{this.headers()}
|
||||
{this.rows()}
|
||||
</table>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default LeaguesTable
|
@ -1,18 +1,36 @@
|
||||
|
||||
import React from 'react';
|
||||
import Table from '../Components/LeagueTable'
|
||||
import LTable from '../Components/LeagueTable'
|
||||
import Table from '../Components/LeaguesTable'
|
||||
var page = null;
|
||||
function goTo (where)
|
||||
{
|
||||
return page = where;
|
||||
}
|
||||
function getLeague()
|
||||
{
|
||||
//TODO
|
||||
|
||||
}
|
||||
function getAllLeagues()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
function Leagues() {
|
||||
return (
|
||||
|
||||
return (
|
||||
<div>
|
||||
<br></br>
|
||||
<br></br>
|
||||
<br></br>
|
||||
<br></br>
|
||||
<Table league={getLeague}/>
|
||||
{page?
|
||||
(
|
||||
<LTable League={getLeague} test="test" GoTo={goTo}/>
|
||||
):
|
||||
(
|
||||
<Table Leagues={getAllLeagues}/>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in new issue