Skip to content

Commit e869f99

Browse files
Merge pull request #13 from gianantoniopini/feature/no-ref/refactor-attribution-into-separate-component
feat: refactor attribution section into separate component
2 parents 6a3f3f7 + 80a06a4 commit e869f99

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

src/components/VideoAttribution.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<script setup>
2+
const props = defineProps({
3+
author: { type: String, required: true },
4+
hostingWebsiteName: { type: String, required: true },
5+
license: { type: String, required: true },
6+
sourceUrl: { type: String, required: true },
7+
title: { type: String, required: true }
8+
})
9+
</script>
10+
11+
<template>
12+
<p class="text-lg">
13+
"<a :href="props.sourceUrl" target="_blank" rel="noreferrer"
14+
>{{ props.title }}
15+
<img src="@/assets/externalLink.svg" alt="External link" class="inline" /></a
16+
>" by {{ props.author }}, {{ props.license }}, via {{ props.hostingWebsiteName }}
17+
</p>
18+
</template>

src/views/WatchVideo.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ref } from 'vue'
33
import { useRoute } from 'vue-router'
44
import { getVideoById } from '@/services/videos'
55
import VideoPlayer from '@/components/VideoPlayer.vue'
6+
import VideoAttribution from '@/components/VideoAttribution.vue'
67
78
const route = useRoute()
89
@@ -23,12 +24,13 @@ const video = await getVideoById(route.params.id)
2324
@status-change="onVideoPlayerStatusChange"
2425
/>
2526
<h1 class="text-2xl font-bold">{{ video.title }}</h1>
26-
<p class="text-lg">
27-
"<a :href="video.sourceUrl" target="_blank" rel="noreferrer"
28-
>{{ video.title }}
29-
<img src="@/assets/externalLink.svg" alt="External link" class="inline" /></a
30-
>" by {{ video.author }}, {{ video.license }}, via {{ video.hostingWebsiteName }}
31-
</p>
27+
<video-attribution
28+
:author="video.author"
29+
:hosting-website-name="video.hostingWebsiteName"
30+
:license="video.license"
31+
:source-url="video.sourceUrl"
32+
:title="video.title"
33+
/>
3234
<span class="text-base">{{ videoPlayerStatus }}</span>
3335
</div>
3436
<div v-else class="w-full"><p>Video unavailable</p></div>

0 commit comments

Comments
 (0)