From b636099fb74da404db86e9bbebe7d5ae947be1b5 Mon Sep 17 00:00:00 2001 From: Daniel Shleifman Date: Fri, 28 May 2021 23:34:24 +0300 Subject: [PATCH] refactor --- web/src/components/DialogTorrentDetailsContent/style.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/web/src/components/DialogTorrentDetailsContent/style.js b/web/src/components/DialogTorrentDetailsContent/style.js index bdb94b0..c051feb 100644 --- a/web/src/components/DialogTorrentDetailsContent/style.js +++ b/web/src/components/DialogTorrentDetailsContent/style.js @@ -167,14 +167,12 @@ export const StatisticsFieldValue = styled.div` ` export const LoadingProgress = styled.div.attrs(({ value, fullAmount }) => { - const percentage = (value * 100) / fullAmount - const percentageMinmax = Math.min(100, percentage) - // console.log(percentage) - const stylePercentage = percentageMinmax === 100 ? 100 : percentageMinmax % 100 + const percentage = Math.min(100, (value * 100) / fullAmount) return { + // this block is here according to styled-components recomendation about fast changable components style: { - background: `linear-gradient(to right, #b5dec9 0%, #b5dec9 ${stylePercentage}%, #fff ${stylePercentage}%, #fff 100%)`, + background: `linear-gradient(to right, #b5dec9 0%, #b5dec9 ${percentage}%, #fff ${percentage}%, #fff 100%)`, }, } })`