-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Frontend: Display Player names along with cards
1. The Player component was refactored to separate JSX for rendering player cards. 2. Highlighting functionality was added to indicate the current player's turn. 3. Player names were styled to appear in a white box with black text. 4. Brightness adjustment was applied to highlight the active player. Fixes #158
- Loading branch information
1 parent
e87b337
commit e22f88e
Showing
3 changed files
with
55 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
|
||
interface Player { | ||
name: string; | ||
cards: { length: number }; | ||
} | ||
|
||
interface PlayerProps { | ||
player: Player; | ||
highlighted: boolean; | ||
positionStyle: React.CSSProperties; | ||
} | ||
|
||
const Player: React.FC<PlayerProps> = ({ | ||
player, | ||
highlighted, | ||
positionStyle, | ||
}) => { | ||
return ( | ||
<div | ||
className="absolute flex flex-col items-center justify-center bg-player-icon-bg" | ||
style={{ | ||
...positionStyle, | ||
backgroundSize: 'contain', | ||
backgroundRepeat: 'no-repeat', | ||
width: '70px', | ||
height: '80px', | ||
zIndex: 2, | ||
filter: highlighted ? 'brightness(1.5)' : 'none', | ||
}} | ||
> | ||
<div | ||
className="player-cards font-[Kavoon] text-gray-900 mt-[96px] text-[12px]" | ||
style={{ marginLeft: '-8px' }} | ||
> | ||
{player.cards.length} | ||
</div> | ||
<div | ||
className="player-name font-[Kavoon] mb-2 text-[14px] text-black bg-gray-400 rounded-lg shadow-md" | ||
style={{ marginLeft: '-8px' }} | ||
> | ||
{player.name} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Player; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters