mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 01:13:55 +00:00
make function common
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export const clamp = (num, a, b) =>
|
||||
Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));
|
||||
@@ -1,8 +1,6 @@
|
||||
import { clamp } from '../../../app/utils';
|
||||
import styles from './MyProgressBar.module.css';
|
||||
|
||||
const clamp = (num, a, b) =>
|
||||
Math.max(Math.min(num, Math.max(a, b)), Math.min(a, b));
|
||||
|
||||
export default function MyProgressBar({ normalisedComplete }) {
|
||||
const percentComplete = clamp(100 - normalisedComplete * 100, 0, 100);
|
||||
const completeWidth = `${percentComplete}%`;
|
||||
|
||||
Reference in New Issue
Block a user