Skip to content

Commit

Permalink
Show author & latency on eliminated snakes again.
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanvugt committed Jul 29, 2021
1 parent 8524ec4 commit 5bf7443
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/components/avatar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ const HealthBar = styled("div")(({ color }) => ({

const CauseOfDeath = styled("div")(({ theme }) => ({
width: "100%",
height: "2.2rem",
padding: ".2rem 0",
marginTop: "0.2rem",
fontSize: "1rem",
lineHeight: "1.3rem",
lineHeight: "1rem",
color: theme === themes.dark ? colors.lightText : colors.darkText
}));

Expand All @@ -76,27 +75,25 @@ class Avatar extends React.Component {
<Name>{this.props.snake.name}</Name>
<Length>{this.props.snake.body.length}</Length>
</NameWrapper>
<AuthorWrapper>
<Author>by {this.props.snake.author}</Author>
<Latency latency={this.props.snake.latency}>
{this.props.snake.latency} ms
</Latency>
</AuthorWrapper>
{this.props.snake.death ? (
<CauseOfDeath theme={this.props.theme}>
{getReadableCauseOfDeath(this.props.snake.death)}
</CauseOfDeath>
) : (
<div>
<AuthorWrapper>
<Author>by {this.props.snake.author}</Author>
<Latency latency={this.props.snake.latency}>
{this.props.snake.latency} ms
</Latency>
</AuthorWrapper>
<HealthBarWrapper>
<HealthBar
color={this.props.snake.color}
style={{
width: `${this.props.snake.health}%`
}}
/>
</HealthBarWrapper>
</div>
<HealthBarWrapper>
<HealthBar
color={this.props.snake.color}
style={{
width: `${this.props.snake.health}%`
}}
/>
</HealthBarWrapper>
)}
</AvatarWrapper>
);
Expand Down

0 comments on commit 5bf7443

Please sign in to comment.