Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
Iss #33 Cleaning up color coding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Wright committed Aug 7, 2017
1 parent c8774d5 commit da70b3b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
21 changes: 12 additions & 9 deletions app/components/Balance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ Balance.propTypes = {
};

export function Balance (props) {
return (
<div className="player-balance container">
<div className="balance-label">
Balance
</div>
<div className="balance-value">
{toCurrencyString(props.balance)}
</div>
const { balance } = props;
const cls_balance = balance < 0 ? 'loss' : 'win';

return (
<div className="player-balance container">
<div className="balance-label">
Balance
</div>
<div className={ "balance-value " + cls_balance }>
{toCurrencyString(props.balance)}
</div>
);
</div>
);
};


Expand Down
6 changes: 4 additions & 2 deletions app/components/EpisodeUserStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ export class EpisodeUserStats extends React.Component {

render() {
const { previousBalance, winnings, losses, balance } = this.props;
const cls_prev_balance = previousBalance < 0 ? 'losses' : '';
const cls_balance = balance < previousBalance ? 'losses' : 'winnings';

const resultsHtml = balance ? (
<div className="results row ">
<div className="result balance small-3 columns">
<div className={"result prevbalance small-3 columns " + cls_prev_balance }>
<div className="title">
Previous Balance
</div>
Expand All @@ -42,7 +44,7 @@ export class EpisodeUserStats extends React.Component {
{ toCurrencyString(losses) }
</div>
</div>
<div className="result balance small-3 columns">
<div className={"result balance small-3 columns " + cls_balance }>
<div className="title">
Result
</div>
Expand Down
9 changes: 8 additions & 1 deletion app/styles/components/_balance.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@
border: 1px solid $border-color;
border-top: 0px;
padding: 0.25rem;
color: $money-color-win;
padding-left: 1rem;
font-size: 3rem;
font-weight: bold;

&.win {
color: $color-winning;
}

&.loss {
color: $color-losing;
}
}
}

0 comments on commit da70b3b

Please sign in to comment.