fuzzyworld

dao-game / react-multiplayer / files / src / react / Status.tsx

Branch react-multiplayer · default branch · all branches

Status.tsx

Blame: the commit that last changed each line · file · history

417dc266 2022-03-23 Pavel Safronov1import * as React from 'react';
2import './Status.css';
3
4export type Props = {
5 currentPlayerId: string
6 player1Id: string
7 player1Name: string
8 player2Id: string
9 player2Name: string
10};
11export const Status = (props: Props): React.ReactElement => {
12
13 const { currentPlayerId, player1Id, player1Name, player2Name } = props;
14 const isPlayer1 = currentPlayerId === player1Id;
15
16 return (
17 <div className='status'>
18 <span className={`p1-turn ${isPlayer1 ? 'active' : ''}`}>{player1Name} turn</span>
19 <span className={`p2-turn ${isPlayer1 ? '' : 'active'}`}>{player2Name} turn</span>
20 </div>
21 );
22};