styles: muly

- change progressbar (show countdown instead of ellapsed)
- fix issue where it would not refresh if there was no time
- add style countdown to red background
This commit is contained in:
cv
2021-06-08 13:26:31 +02:00
parent ef5dd82c79
commit 11b6498760
3 changed files with 22 additions and 12 deletions
@@ -3,16 +3,21 @@ import styles from './MyProgressBar.module.css';
export default function MyProgressBar(props) {
const { now, complete, showElapsed } = props;
const percentComplete = showElapsed
? clamp((100 - (now * 100) / complete), 0, 100)
: clamp((now * 100) / complete, 0, 100)
let percentComplete = showElapsed ? 0 : 100;
if (now != null && complete != null) {
percentComplete = showElapsed
? clamp(100 - (now * 100) / complete, 0, 100)
: clamp((now * 100) / complete, 0, 100);
}
return (
<div className={styles.progress}>
<div className={showElapsed ? styles.progress : styles.progressCountdown}>
<div
className={styles.progressBar}
style={{ width: `${percentComplete}%` }}
></div>
/>
</div>
);
}
@@ -1,13 +1,22 @@
.progress {
.progress,
.progressCountdown {
height: 2vh;
background-color: rgba(255, 255, 255, 0.13);
border-radius: 4px;
}
.progress {
background-color: rgba(255, 255, 255, 0.13);
}
.progressCountdown {
background-color: #ff7597;
}
.progressBar {
width: 100%;
height: 2vh;
background-color: rgba(255, 255, 255, 0.79);
background-color: rgb(255, 255, 255);
border-radius: 4px;
transition: 1s linear;
transition-property: width;
@@ -71,11 +71,7 @@ export default function PresenterView(props) {
isPlaying ? style.progressContainer : style.progressContainerPaused
}
>
<MyProgressBar
now={normalisedTime}
complete={time.durationSeconds}
showElapsed
/>
<MyProgressBar now={normalisedTime} complete={time.durationSeconds} />
</div>
)}