From 245afbd6f130578f6cc89516616dd0137391ac6a Mon Sep 17 00:00:00 2001 From: Cristiano Pires Date: Thu, 12 Oct 2023 14:20:51 +0100 Subject: [PATCH] ... --- src/Components/LeagueTable.jsx | 12 ++- src/Components/LeaguesTable.css | 0 src/Components/LeaguesTable.jsx | 74 +++++++++++++++++++ .../{Navigation.js => Navigation.jsx} | 1 + src/Pages/Leagues.jsx | 24 +++++- 5 files changed, 101 insertions(+), 10 deletions(-) create mode 100644 src/Components/LeaguesTable.css create mode 100644 src/Components/LeaguesTable.jsx rename src/Components/{Navigation.js => Navigation.jsx} (92%) diff --git a/src/Components/LeagueTable.jsx b/src/Components/LeagueTable.jsx index 9854bbc..1a0c796 100644 --- a/src/Components/LeagueTable.jsx +++ b/src/Components/LeagueTable.jsx @@ -9,8 +9,8 @@ class LeagueTable extends React.Component constructor() { super() - // this.league = this.props.league; - this.league = {//Leagues[0] + // this.League = this.props.League; + this.League = {//Leagues[0] "name":"Legendary League", "players": [ @@ -48,7 +48,7 @@ class LeagueTable extends React.Component } rows() { - return this.league.players.map(({ name, points, playedMatches }) => { + return this.League.players.map(({ name, points, playedMatches }) => { return {name} {points} @@ -60,12 +60,10 @@ class LeagueTable extends React.Component { return (
-

{this.league.name}

+

{this.League.name}

{this.tableHeaders()} - - {this.rows()} - + {this.rows()}
) diff --git a/src/Components/LeaguesTable.css b/src/Components/LeaguesTable.css new file mode 100644 index 0000000..e69de29 diff --git a/src/Components/LeaguesTable.jsx b/src/Components/LeaguesTable.jsx new file mode 100644 index 0000000..8ff2e69 --- /dev/null +++ b/src/Components/LeaguesTable.jsx @@ -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( + + Leagues + + ) + } + rows() + { + return this.Leagues.map(({name}) => { + return + {name} + + }) + } + goToLeague = (event)=> + { + console.log(this.props) + this.props.GoTo(event.target.innerHTML); + } + render() + { + return( + + {this.headers()} + {this.rows()} +
+ ) + } +} +export default LeaguesTable \ No newline at end of file diff --git a/src/Components/Navigation.js b/src/Components/Navigation.jsx similarity index 92% rename from src/Components/Navigation.js rename to src/Components/Navigation.jsx index 5ef119e..de7a26e 100644 --- a/src/Components/Navigation.js +++ b/src/Components/Navigation.jsx @@ -18,6 +18,7 @@ class Navigation extends React.Component + }/> }/> }/> diff --git a/src/Pages/Leagues.jsx b/src/Pages/Leagues.jsx index 10be61a..a0b6a08 100644 --- a/src/Pages/Leagues.jsx +++ b/src/Pages/Leagues.jsx @@ -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 (








- + {page? + ( + + ): + ( +
+ )} ) }