Update WordHighScores.tsx

This commit is contained in:
Hugo Bernier 2020-05-28 22:39:55 -04:00 committed by GitHub
parent 50ea7ce668
commit 395aaa1316
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 34 deletions

View File

@ -1,42 +1,40 @@
import * as React from "react";
import { WordGameListItem } from "./WordService"
import * as React from 'react';
import { WordGameListItem } from './WordService';
export interface IWordHighScoresProps {
scores: WordGameListItem[]
scores: WordGameListItem[];
}
export default class WordHighScores extends React.Component<IWordHighScoresProps, {}> {
constructor() {
super();
constructor() {
super();
}
}
public render(): React.ReactElement<IWordHighScoresProps> {
let rank = 1;
return (
<div>
{
this.props.scores.length>0 ?
<h3 style={{ textDecoration: 'underline' }}>High Scores</h3> : ''
}
<table style={{ marginLeft: 'Auto', marginRight: 'Auto' }}>
<tbody>
{
this.props.scores.map(score => (
<tr>
<td><b>{rank++ + ') '}</b></td>
<td><b>{score.Name} </b></td>
<td><span style={{ marginLeft: '10px' }}>Score: {score.Score} </span></td>
<td><span style={{ marginLeft: '10px' }}>Seconds: {score.Seconds}</span></td>
</tr>
))
}
</tbody>
</table>
</div>
);
}
}
public render(): React.ReactElement<IWordHighScoresProps> {
let rank: number = 1;
return (
<div>
{
this.props.scores.length > 0 ?
<h3 style={{ textDecoration: 'underline' }}>High Scores</h3> : ''
}
<table style={{ marginLeft: 'Auto', marginRight: 'Auto' }}>
<tbody>
{
this.props.scores.map(score => (
<tr>
<td><b>{rank++ + ') '}</b></td>
<td><b>{score.Name} </b></td>
<td><span style={{ marginLeft: '10px' }}>Score: {score.Score} </span></td>
<td><span style={{ marginLeft: '10px' }}>Seconds: {score.Seconds}</span></td>
</tr>
))
}
</tbody>
</table>
</div>
);
}
}