2022-01-13 04:52:14 +00:00
|
|
|
<template>
|
2022-06-24 01:04:01 +00:00
|
|
|
<!-- desktop view -->
|
2022-06-24 21:53:45 +00:00
|
|
|
<div v-if="!mobileLayout" class="flex-col overflow-y-scroll max-h-75vh min-h-64 <lg:hidden">
|
2022-06-24 01:04:01 +00:00
|
|
|
<h2 v-t="'video.chapters'" class="mb-2 bg-gray-500/50 p-2" />
|
|
|
|
<div
|
|
|
|
:key="chapter.start"
|
|
|
|
v-for="chapter in chapters"
|
|
|
|
@click="$emit('seek', chapter.start)"
|
|
|
|
class="chapter-vertical"
|
|
|
|
>
|
|
|
|
<div class="flex">
|
|
|
|
<img :src="chapter.image" :alt="chapter.title" />
|
|
|
|
<div class="flex flex-col m-2">
|
|
|
|
<span class="text-truncate text-sm" :title="chapter.title" v-text="chapter.title" />
|
|
|
|
<span class="text-sm font-bold text-blue-500" v-text="timeFormat(chapter.start)" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- mobile view -->
|
|
|
|
<div v-else class="flex overflow-x-auto">
|
2022-06-17 05:06:05 +00:00
|
|
|
<div :key="chapter.start" v-for="chapter in chapters" @click="$emit('seek', chapter.start)" class="chapter">
|
|
|
|
<img :src="chapter.image" :alt="chapter.title" class="" />
|
|
|
|
<div class="m-1 flex">
|
|
|
|
<span class="text-truncate text-sm" :title="chapter.title" v-text="chapter.title" />
|
2022-06-17 07:54:40 +00:00
|
|
|
<span class="text-sm font-bold text-blue-500" v-text="timeFormat(chapter.start)" />
|
2022-06-17 05:06:05 +00:00
|
|
|
</div>
|
2022-01-13 04:52:14 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-26 04:39:36 +00:00
|
|
|
<style>
|
2022-06-17 05:06:05 +00:00
|
|
|
::-webkit-scrollbar {
|
|
|
|
height: 5px;
|
|
|
|
}
|
2022-01-26 04:39:36 +00:00
|
|
|
.chapter {
|
2022-06-17 05:06:05 +00:00
|
|
|
@apply cursor-pointer;
|
|
|
|
align-self: center;
|
|
|
|
padding: 10px;
|
|
|
|
img {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
2022-06-24 01:04:01 +00:00
|
|
|
.chapter-vertical {
|
|
|
|
@apply cursor-pointer;
|
|
|
|
align-self: center;
|
|
|
|
padding: 10px;
|
|
|
|
img {
|
|
|
|
width: 30%;
|
|
|
|
height: 30%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.chapter-vertical:hover {
|
|
|
|
@apply bg-gray-500;
|
|
|
|
}
|
2022-06-17 05:06:05 +00:00
|
|
|
.text-truncate {
|
|
|
|
white-space: nowrap;
|
|
|
|
width: 10em;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
display: inline-block;
|
2022-01-26 04:39:36 +00:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2022-01-13 04:52:14 +00:00
|
|
|
<script setup>
|
|
|
|
import { defineProps, defineEmits } from "vue";
|
|
|
|
|
2022-05-19 21:17:58 +00:00
|
|
|
defineProps({
|
2022-01-13 04:52:14 +00:00
|
|
|
chapters: Object,
|
2022-06-24 01:04:01 +00:00
|
|
|
mobileLayout: {
|
|
|
|
type: Boolean,
|
|
|
|
default: () => true,
|
|
|
|
},
|
2022-01-13 04:52:14 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
defineEmits(["seek"]);
|
|
|
|
</script>
|