Add play button [deploy-site]
This commit is contained in:
parent
72a3e28fea
commit
c780ded239
|
@ -19,8 +19,9 @@ templ PageVideos(r *http.Request, videos ...Video) {
|
|||
thumbnail := "https://img.youtube.com/vi/" + video.Code + "/maxresdefault.jpg"
|
||||
title := video.Title
|
||||
}}
|
||||
<div id={ id } data-on-click={ action } title={ title } class="w-full max-w-xl aspect-video cursor-pointer">
|
||||
<div id={ id } data-on-click={ action } title={ title } class="w-full max-w-xl aspect-video cursor-pointer video-wrapper relative">
|
||||
<img src={ thumbnail } alt={ title } class="w-full h-full"/>
|
||||
<button class="play-button" aria-label="Play video"></button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -52,4 +52,37 @@ pre code {
|
|||
|
||||
.prose ol, .prose ul {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.video-wrapper .play-button {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
|
||||
transition: background 0.3s, box-shadow 0.3s;
|
||||
pointer-events: none; /* For poster-based videos, we rely on the poster click */
|
||||
}
|
||||
.video-wrapper .play-button::before {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
margin-left: 2px; /* Nudge right for visual centering */
|
||||
border-left: 18px solid #000;
|
||||
border-top: 10px solid transparent;
|
||||
border-bottom: 10px solid transparent;
|
||||
}
|
||||
.video-wrapper:hover .play-button {
|
||||
background: rgba(255, 255, 255, 1);
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
|
||||
}
|
Loading…
Reference in New Issue