Extract the ranged map function
This commit is contained in:
parent
7c1928dce3
commit
d557a21d90
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
export function rangedmap(arr, func, start, end) {
|
||||||
|
return arr.slice(start, end).map(func);
|
||||||
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ import { TurniereNavigation } from '../js/components/Navigation';
|
||||||
import { TournamentInformationView } from '../js/components/TournamentInformationView';
|
import { TournamentInformationView } from '../js/components/TournamentInformationView';
|
||||||
import { BigImage } from '../js/components/BigImage';
|
import { BigImage } from '../js/components/BigImage';
|
||||||
import { Footer } from '../js/components/Footer';
|
import { Footer } from '../js/components/Footer';
|
||||||
|
import { rangedmap } from '../js/utils/rangedmap';
|
||||||
import { Order, sort } from '../js/utils/sort';
|
import { Order, sort } from '../js/utils/sort';
|
||||||
|
|
||||||
import '../static/css/tournament-statistics.css';
|
import '../static/css/tournament-statistics.css';
|
||||||
|
|
@ -115,12 +116,12 @@ class StandingsTable extends React.Component {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{ map(sortedPerformances, (team, index) => (
|
{ rangedmap(sortedPerformances, (team, index) => (
|
||||||
<TeamRow key={index} teams={this.props.data.teams} teamToShow={team}/>
|
<TeamRow key={index} teams={this.props.data.teams} teamToShow={team}/>
|
||||||
), 0, 3) }
|
), 0, 3) }
|
||||||
</tbody>
|
</tbody>
|
||||||
<Collapse isOpen={ this.state.showFullTable } tag="tbody">
|
<Collapse isOpen={ this.state.showFullTable } tag="tbody">
|
||||||
{ map(sortedPerformances, (team, index) => (
|
{ rangedmap(sortedPerformances, (team, index) => (
|
||||||
<TeamRow key={index} teams={this.props.data.teams} teamToShow={team}/>
|
<TeamRow key={index} teams={this.props.data.teams} teamToShow={team}/>
|
||||||
), 3) }
|
), 3) }
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
|
@ -142,8 +143,6 @@ class StandingsTable extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function map(arr, func, start, end) {
|
|
||||||
return arr.slice(start, end).map(func);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TableButton extends React.Component {
|
class TableButton extends React.Component {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue