Added global controls

This commit is contained in:
2021-12-19 03:03:37 +03:00
parent 9c881bd430
commit b4a408eddb
15 changed files with 334 additions and 123 deletions

55
src/views/Home/Time.vue Normal file
View File

@@ -0,0 +1,55 @@
<template>
<div
class="time"
:class="{ pulsing }"
>
{{ formattedTime }}
</div>
</template>
<script>
export default {
props: {
time: {
type: Number,
required: true,
},
pulsing: {
type: Boolean,
default: false,
},
},
computed: {
formattedTime() {
let { time } = this;
const msInASec = 1000;
const msInAMin = msInASec * 60;
const msInAHour = msInAMin * 60;
const msInADay = msInAHour * 24;
const days = Math.floor(time / msInADay);
time -= days * msInADay;
const hours = Math.floor(time / msInAHour);
time -= hours * msInAHour;
const mins = Math.floor(time / msInAMin);
return `${days}d ${hours}h ${mins}m`;
},
},
};
</script>
<style lang="scss" scoped>
@keyframes pulse {
from {
opacity: 0.3;
}
to {
opacity: 1;
}
}
.pulsing {
animation: pulse 1s infinite alternate;
}
</style>