mirror of
https://github.com/koel/koel
synced 2024-12-21 10:03:10 +00:00
46 lines
989 B
Vue
46 lines
989 B
Vue
<template>
|
|
<a :href="url" data-testid="youtube-search-result" role="button" @click.prevent="play">
|
|
<img :alt="video.snippet.title" :src="video.snippet.thumbnails.default.url" width="90">
|
|
<div class="meta">
|
|
<h3 class="title">{{ video.snippet.title }}</h3>
|
|
<p class="desc">{{ video.snippet.description }}</p>
|
|
</div>
|
|
</a>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, toRefs } from 'vue'
|
|
import { youTubeService } from '@/services'
|
|
|
|
const props = defineProps<{ video: YouTubeVideo }>()
|
|
const { video } = toRefs(props)
|
|
|
|
const url = computed(() => `https://youtu.be/${video.value.id.videoId}`)
|
|
|
|
const play = () => youTubeService.play(video.value)
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
a {
|
|
display: flex;
|
|
padding: 12px 0;
|
|
|
|
&:hover, &:active, &:focus {
|
|
color: var(--color-text-primary);
|
|
}
|
|
}
|
|
|
|
.title {
|
|
font-size: 1.1rem;
|
|
margin-bottom: .4rem;
|
|
}
|
|
|
|
.desc {
|
|
font-size: .9rem;
|
|
}
|
|
|
|
img {
|
|
margin-right: 10px;
|
|
align-self: self-start;
|
|
}
|
|
</style>
|