Files
cloudron-box/dashboard/src/components/AppStoreItem.vue
T

70 lines
1.1 KiB
Vue
Raw Normal View History

<script setup>
import { ref, onMounted, useTemplateRef } from 'vue';
defineProps([ 'app' ]);
const visible = ref(false);
const elem = useTemplateRef('elem');
onMounted(() => {
const observer = new IntersectionObserver(result => {
if (result[0].isIntersecting && elem.value) {
visible.value = true;
observer.unobserve(elem.value);
}
});
observer.observe(elem.value);
});
</script>
<template>
<div class="item" ref="elem">
<img v-if="visible" class="icon" :src="app.iconUrl" />
<div class="description">
<div class="title">{{ app.manifest.title }}</div>
<div class="tagline">{{ app.manifest.tagline }}</div>
</div>
</div>
</template>
<style scoped>
.item {
display: flex;
align-items: center;
width: 300px;
padding: 10px 15px;
border-radius: 10px;
cursor: pointer;
}
.item:hover {
background-color: var(--card-background);
}
.item.active {
width: 100%;
background-color: var(--card-background);
}
.icon {
width: 64px;
height: 64px;
object-fit: contain;
margin-right: 20px;
}
.title {
font-size: 16px;
}
.tagline {
font-size: 12px;
opacity: 0.8;
}
</style>