diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-04-21 09:17:48 +0200 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-04-21 09:17:48 +0200 |
commit | 93f24011f9613b7785b37dc4b0c963d9be22ba30 (patch) | |
tree | 26e1a867623cc68e2b8293327572282e461568a6 /components/recentGames.tsx | |
parent | 7e7bf87896b6494886b3457a72864a498906f5b3 (diff) |
more components without inline css
Diffstat (limited to 'components/recentGames.tsx')
-rw-r--r-- | components/recentGames.tsx | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/components/recentGames.tsx b/components/recentGames.tsx index d619eeb..6683e20 100644 --- a/components/recentGames.tsx +++ b/components/recentGames.tsx @@ -1,18 +1,7 @@ import friendlyTime from 'friendly-time'; -import { CSSProperties } from 'react'; import { gameInfo } from '../api/api'; -var LeftAlignedTableColumn: CSSProperties = { - textAlign: 'left', - paddingLeft: 16, -}; - -var RightAlignedTableColumn: CSSProperties = { - textAlign: 'right', - paddingRight: 16, -}; - function GameOutcome(props: { game: gameInfo; }) { var gameStatus = (() => { return { @@ -42,10 +31,10 @@ function GameOutcome(props: { game: gameInfo; }) { } export default function RecentGames(props: { games?: Array<gameInfo>; }) { - return <div> + return <div className='recentGames'> <h2>Recente partijen</h2> {props.games?.length > 0 - ? <table width='100%' style={{ marginTop: '16px', textAlign: 'center' }}> + ? <table width='100%' className='recentGames center'> <tbody> <tr> <th style={{ width: '50%' }}>Tegenstander</th> @@ -55,19 +44,14 @@ export default function RecentGames(props: { games?: Array<gameInfo>; }) { </tr> {props.games?.map(game => <tr key={game.id}> - <td style={LeftAlignedTableColumn}> - <a - href={'/user?id=' + game.opponent?.id} - style={{ - fontWeight: 500, - }} - > + <td className='leftAlignedColumn'> + <a href={'/user?id=' + game.opponent?.id}> {game.opponent?.username} </a> </td> <GameOutcome game={game} /> <td>{Math.max(0, game.moves.length - 1)}</td> - <td style={RightAlignedTableColumn}> + <td className='rightAlignedColumn'> {(() => { var timeCreated = new Date(game.created); return friendlyTime(timeCreated); @@ -77,13 +61,7 @@ export default function RecentGames(props: { games?: Array<gameInfo>; }) { )} </tbody> </table> - : <h1 - style={{ - textAlign: 'center', - opacity: .6, - margin: '32px 64px', - }} - > + : <h1 className='nogames center subtile'> Deze gebruiker heeft nog geen partijen gespeeld </h1>} </div>; |