This commit is contained in:
syuilo 2023-05-29 17:22:09 +09:00
parent c5f9b1c224
commit 25d1b66ca4
3 changed files with 118 additions and 99 deletions

View file

@ -1,14 +1,20 @@
<template>
<span v-if="!fetching" class="nmidsaqw">
<span v-if="!fetching" :class="$style.root">
<template v-if="display === 'marquee'">
<Transition name="change" mode="default">
<Transition
:enterActiveClass="$style.transition_change_enterActive"
:leaveActiveClass="$style.transition_change_leaveActive"
:enterFromClass="$style.transition_change_enterFrom"
:leaveToClass="$style.transition_change_leaveTo"
mode="default"
>
<MarqueeText :key="key" :duration="marqueeDuration" :reverse="marqueeReverse">
<span v-for="instance in instances" :key="instance.id" class="item" :class="{ colored }" :style="{ background: colored ? instance.themeColor : null }">
<img class="icon" :src="getInstanceIcon(instance)" alt=""/>
<MkA :to="`/instance-info/${instance.host}`" class="host _monospace">
<span v-for="instance in instances" :key="instance.id" :class="[$style.item, { [$style.colored]: colored }]" :style="{ background: colored ? instance.themeColor : null }">
<img :class="$style.icon" :src="getInstanceIcon(instance)" alt=""/>
<MkA :to="`/instance-info/${instance.host}`" :class="$style.host" class="_monospace">
{{ instance.host }}
</MkA>
<span class="divider"></span>
<span :class="$style.divider"></span>
</span>
</MarqueeText>
</Transition>
@ -61,46 +67,47 @@ function getInstanceIcon(instance): string {
}
</script>
<style lang="scss" scoped>
.change-enter-active, .change-leave-active {
<style lang="scss" module>
.transition_change_enterActive,
.transition_change_leaveActive {
position: absolute;
top: 0;
transition: all 1s ease;
}
.change-enter-from {
opacity: 0;
.transition_change_enterFrom {
opacity: 0;
transform: translateY(-100%);
}
.change-leave-to {
opacity: 0;
.transition_change_leaveTo {
opacity: 0;
transform: translateY(100%);
}
.nmidsaqw {
.root {
display: inline-block;
position: relative;
}
::v-deep(.item) {
display: inline-block;
vertical-align: bottom;
margin-right: 5em;
.item {
display: inline-block;
vertical-align: bottom;
margin-right: 5em;
> .icon {
display: inline-block;
height: var(--height);
aspect-ratio: 1;
vertical-align: bottom;
margin-right: 1em;
}
> .host {
vertical-align: bottom;
}
&.colored {
padding-right: 1em;
color: #fff;
}
&.colored {
padding-right: 1em;
color: #fff;
}
}
.icon {
display: inline-block;
height: var(--height);
aspect-ratio: 1;
vertical-align: bottom;
margin-right: 1em;
}
.host {
vertical-align: bottom;
}
</style>