2022-09-12 13:01:58 +00:00
|
|
|
<template>
|
2022-09-13 01:50:59 +00:00
|
|
|
<v-footer :color="variant" :dark="is_dark" fixed>
|
|
|
|
|
<span class="text-h6" :style="{ 'animation-duration': marqueeDuration }">
|
2022-09-12 13:01:58 +00:00
|
|
|
<div v-html="content" />
|
|
|
|
|
</span>
|
|
|
|
|
</v-footer>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
2022-09-13 01:50:59 +00:00
|
|
|
import Color from "color";
|
2022-09-12 13:01:58 +00:00
|
|
|
|
|
|
|
|
@Component
|
|
|
|
|
export default class TickerBar extends Vue {
|
2022-09-12 22:37:55 +00:00
|
|
|
@Prop({ required: true })
|
|
|
|
|
private readonly content!: string;
|
2022-09-12 13:01:58 +00:00
|
|
|
|
2022-09-13 01:50:59 +00:00
|
|
|
@Prop({ default: "primary" })
|
|
|
|
|
private readonly variant!: string;
|
|
|
|
|
|
|
|
|
|
private get is_dark(): boolean {
|
|
|
|
|
return this.footerColor.isDark();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private get footerColor(): Color {
|
|
|
|
|
// try getting from vuetify theme
|
|
|
|
|
let color = this.$vuetify.theme.themes.light[this.variant];
|
|
|
|
|
|
|
|
|
|
if (typeof color === "string") {
|
|
|
|
|
return Color(color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fallback: parse color directly
|
|
|
|
|
return Color(this.variant);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-12 23:49:06 +00:00
|
|
|
private get marqueeDuration(): string {
|
2022-09-12 13:01:58 +00:00
|
|
|
// 10 seconds + another second per 7 chars
|
|
|
|
|
let dv = this.content ? Math.round(this.content.length / 7) : 0;
|
|
|
|
|
return 10 + dv + "s";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2022-09-12 21:05:41 +00:00
|
|
|
<style lang="scss" scoped>
|
2022-09-12 13:01:58 +00:00
|
|
|
@keyframes marquee {
|
|
|
|
|
0% {
|
|
|
|
|
transform: translate(0, 0);
|
|
|
|
|
}
|
|
|
|
|
100% {
|
|
|
|
|
transform: translate(-100%, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.v-footer {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
|
|
> span {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
padding-left: 100%;
|
|
|
|
|
text-indent: 0;
|
|
|
|
|
animation: marquee 30s linear infinite;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
animation-play-state: paused;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-12 21:15:33 +00:00
|
|
|
:deep(*) {
|
2022-09-12 21:05:41 +00:00
|
|
|
margin: 0 !important;
|
|
|
|
|
}
|
2022-09-12 13:01:58 +00:00
|
|
|
}
|
2022-09-12 22:35:58 +00:00
|
|
|
</style>
|