Skip to content

Commit

Permalink
Add success/fail color to the progress bar in the swap modal (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 20, 2018
1 parent af14a6b commit 5e7512d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/renderer/components/Progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import {classNames} from 'react-extras';
import './Progress.scss';

const Progress = ({value, showLabel, hideWhenZero, ...props}) => {
const Progress = ({value, color, showLabel, hideWhenZero, ...props}) => {
if (value > 1 || value < 0) {
throw new TypeError('Expected a value in the range 0...1');
}
Expand All @@ -17,7 +17,7 @@ const Progress = ({value, showLabel, hideWhenZero, ...props}) => {

return (
<div {...props} className={className}>
<div className="Progress__bar" style={{width: percentageFormatted}}>
<div className="Progress__bar" style={{width: percentageFormatted, background: color}}>
{showLabel &&
<div className="Progress__label">{percentageFormatted}</div>
}
Expand Down
2 changes: 1 addition & 1 deletion app/renderer/components/Progress.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
width: 0;
height: 5px;
background: var(--progress-gradient);
transition: width 0.5s ease-in-out;
transition: width 0.5s, background 0.5s;
}

&__label {
Expand Down
8 changes: 7 additions & 1 deletion app/renderer/components/SwapDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ class SwapDetails extends React.Component {
</div>
</div>
<div className="section progress">
<Progress value={swap.progress}/>
<Progress
value={swap.progress}
color={
(swap.status === 'completed' && 'var(--success-color)') ||
(swap.status === 'failed' && 'var(--error-color)')
}
/>
<p>
{title(swap.statusFormatted)}
{(swap.status === 'failed' && swap.error) && (
Expand Down

0 comments on commit 5e7512d

Please sign in to comment.