Skip to content

Commit

Permalink
Refactor && short-circuiting to ternary operators
Browse files Browse the repository at this point in the history
  • Loading branch information
allezxandre committed Dec 13, 2022
1 parent c2b72c8 commit 1d0311b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/ProgressBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@
let barStyle: string;
$: barStyle =
((color && `background-color: ${color};`) || '') +
((width && width * 100 && `width: ${width * 100}%;`) || '');
(color ? `background-color: ${color};` : '') +
(width && width * 100 ? `width: ${width * 100}%;` : '');
// the box shadow of the leader bar uses `color` to set its shadow color
let leaderColorStyle: string;
$: leaderColorStyle = (color && `background-color: ${color}; color: ${color};`) || '';
$: leaderColorStyle = color ? `background-color: ${color}; color: ${color};` : '';
/** When navigating, this is the threshold duration in milliseconds
* that the progress bar will wait before showing.
Expand Down

0 comments on commit 1d0311b

Please sign in to comment.