227 lines
4.7 KiB
Vue
227 lines
4.7 KiB
Vue
<script setup lang="ts">
|
|
import type { MediaPublicItem } from '~/data/news-content'
|
|
|
|
const props = defineProps<{
|
|
item: MediaPublicItem
|
|
reverse?: boolean
|
|
watchYoutubeLabel?: string
|
|
watchTiktokLabel?: string
|
|
}>()
|
|
|
|
const primaryVideoUrl = computed(
|
|
() => props.item.youtubeUrl || props.item.tiktokUrl || ''
|
|
)
|
|
</script>
|
|
|
|
<template>
|
|
<article class="cstory" :class="{ 'cstory--reverse': reverse }">
|
|
<div class="cstory__grid">
|
|
<div class="cstory__media">
|
|
<a
|
|
v-if="primaryVideoUrl"
|
|
:href="primaryVideoUrl"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="cstory__thumb"
|
|
:aria-label="item.title"
|
|
>
|
|
<img :src="item.thumbnail" :alt="item.thumbnailAlt" loading="lazy" />
|
|
<span class="cstory__play" aria-hidden="true">
|
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
|
|
<path d="M8 5v14l11-7z" />
|
|
</svg>
|
|
</span>
|
|
</a>
|
|
<div v-else class="cstory__thumb">
|
|
<img :src="item.thumbnail" :alt="item.thumbnailAlt" loading="lazy" />
|
|
<span class="cstory__play" aria-hidden="true">
|
|
<svg viewBox="0 0 24 24" width="22" height="22" fill="currentColor">
|
|
<path d="M8 5v14l11-7z" />
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="cstory__content">
|
|
<h2 class="cstory__title">{{ item.title }}</h2>
|
|
<p class="cstory__summary">{{ item.summary }}</p>
|
|
<div v-if="item.youtubeUrl || item.tiktokUrl" class="cstory__actions">
|
|
<a
|
|
v-if="item.youtubeUrl"
|
|
:href="item.youtubeUrl"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="cstory__btn"
|
|
>
|
|
{{ watchYoutubeLabel ?? 'Watch on YouTube' }}
|
|
</a>
|
|
<a
|
|
v-if="item.tiktokUrl"
|
|
:href="item.tiktokUrl"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
class="cstory__btn cstory__btn--tiktok"
|
|
>
|
|
{{ watchTiktokLabel ?? 'Watch on TikTok' }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.cstory {
|
|
padding: 40px 0;
|
|
border-bottom: 1px solid #d8dde3;
|
|
}
|
|
|
|
.cstory:last-child {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.cstory__grid {
|
|
display: grid;
|
|
grid-template-columns: auto 1fr;
|
|
gap: 36px;
|
|
align-items: center;
|
|
}
|
|
|
|
.cstory--reverse .cstory__grid {
|
|
direction: rtl;
|
|
}
|
|
|
|
.cstory--reverse .cstory__grid > * {
|
|
direction: ltr;
|
|
}
|
|
|
|
.cstory__thumb {
|
|
position: relative;
|
|
display: block;
|
|
width: 220px;
|
|
max-width: 100%;
|
|
text-decoration: none;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
box-shadow: 0 4px 16px rgba(15, 39, 64, 0.12);
|
|
}
|
|
|
|
.cstory__thumb img {
|
|
width: 220px;
|
|
height: 220px;
|
|
max-width: 100%;
|
|
object-fit: cover;
|
|
display: block;
|
|
transition: transform 0.2s ease;
|
|
}
|
|
|
|
.cstory__thumb:hover img {
|
|
transform: scale(1.03);
|
|
}
|
|
|
|
.cstory__play {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
width: 52px;
|
|
height: 52px;
|
|
border-radius: 50%;
|
|
background: rgba(15, 39, 64, 0.72);
|
|
color: #fff;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
|
|
transition: background 0.18s ease, transform 0.18s ease;
|
|
}
|
|
|
|
.cstory__thumb:hover .cstory__play {
|
|
background: rgba(72, 164, 252, 0.92);
|
|
transform: translate(-50%, -50%) scale(1.06);
|
|
}
|
|
|
|
.cstory__play svg {
|
|
margin-left: 3px;
|
|
}
|
|
|
|
.cstory__content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
justify-content: center;
|
|
min-width: 0;
|
|
}
|
|
|
|
.cstory__title {
|
|
margin: 0;
|
|
color: var(--blue);
|
|
font-size: clamp(18px, 2.2vw, 22px);
|
|
font-weight: 700;
|
|
line-height: 1.45;
|
|
}
|
|
|
|
.cstory__summary {
|
|
margin: 14px 0 0;
|
|
color: #1e1e1e;
|
|
font-size: 15px;
|
|
line-height: 1.8;
|
|
text-align: justify;
|
|
}
|
|
|
|
.cstory__actions {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 12px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.cstory__btn {
|
|
display: inline-block;
|
|
padding: 10px 24px;
|
|
border: none;
|
|
border-radius: 999px;
|
|
background: #48a4fc;
|
|
color: #fff;
|
|
font-family: Georgia, 'Times New Roman', serif;
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
text-decoration: none;
|
|
transition: background 0.18s ease;
|
|
}
|
|
|
|
.cstory__btn:hover {
|
|
background: #3a96f0;
|
|
}
|
|
|
|
.cstory__btn--tiktok {
|
|
background: #010101;
|
|
}
|
|
|
|
.cstory__btn--tiktok:hover {
|
|
background: #222;
|
|
}
|
|
|
|
@media (max-width: 900px) {
|
|
.cstory {
|
|
padding: 32px 0;
|
|
}
|
|
|
|
.cstory__grid {
|
|
grid-template-columns: 1fr;
|
|
gap: 20px;
|
|
align-items: start;
|
|
}
|
|
|
|
.cstory__thumb,
|
|
.cstory__thumb img {
|
|
width: min(100%, 280px);
|
|
height: min(100%, 280px);
|
|
}
|
|
|
|
.cstory--reverse .cstory__grid {
|
|
direction: ltr;
|
|
}
|
|
}
|
|
</style>
|