Skip to content

Commit 762d70f

Browse files
committed
A bunch of design tweaks
1 parent 1747768 commit 762d70f

File tree

2 files changed

+56
-33
lines changed

2 files changed

+56
-33
lines changed

src/css/tailwind.css

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -347,46 +347,62 @@ details[open] .summary-swap-open {
347347
@apply p-4;
348348
@apply my-8;
349349
@apply mx-auto;
350-
@apply border-blue-100;
351350
@apply border;
351+
border-color: #5A5F75;
352352
@apply rounded-full;
353353
@apply block;
354354
@apply w-full;
355355
}
356+
@supports (box-shadow: none) {
357+
.ais-SearchBox-input:focus {
358+
outline: none;
359+
box-shadow: 0 0 1px 4px #E7017A;
360+
}
361+
}
356362
.aspect-ratio-youtube {
357363
padding-top: 74.9295775%;
358364
}
359365
.jamstacktv-card,
360366
.jamstacktv-img {
361367
border-radius: 1em 0 1em 1em;
362368
}
369+
.jamstacktv-img {
370+
width: 100%;
371+
}
372+
.jamstacktv-duration {
373+
@apply inline-block;
374+
@apply px-1;
375+
@apply bg-black;
376+
@apply text-sm;
377+
@apply font-bold;
378+
position: absolute;
379+
right: .25em;
380+
bottom: .25em;
381+
}
363382
.jamstacktv-time {
364383
display: inline-block;
365-
font-size: 0.6666666666667em; /* 16px /24 */
366-
border-right: 1px solid;
367-
padding: 0 .75em 0 0;
368-
margin-right: .75em;
369-
font-weight: 500;
370-
@apply border-gray-400;
384+
margin-right: 0.25em; /* 4px /16 */
371385
}
372386
.jamstacktv-time > b {
373387
display: inline-block;
374388
width: 0;
375389
height: 0;
376-
border-top: .4em solid transparent;
377-
border-bottom: .4em solid transparent;
378-
border-left: .4em solid currentColor;
379-
margin: 0 2px 0 0;
390+
border-top: 5px solid transparent;
391+
border-bottom: 5px solid transparent;
392+
border-left: 7px solid currentColor;
380393
}
381394
.jamstacktv-time > b + b {
382-
margin-left: 0;
383-
margin-right: .25em;
395+
margin-right: 3px;
384396
}
385397
.jamstacktv-item {
386398
display: flex;
387399
flex-direction: column;
388400
justify-content: center;
389401
}
402+
.jamstacktv-item mark {
403+
@apply bg-pink-900;
404+
@apply text-white;
405+
}
390406
.jamstacktv-meta {
391407
@apply leading-normal;
392408
}

src/site/tv.njk

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ title: Jamstack TV
33
layout: layouts/base.njk
44
---
55
{# This search index data is populated by the code at https://github.com/netlify/jamstack-tv-search-data #}
6-
{# <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/themes/reset-min.css" integrity="sha256-t2ATOGCtAIZNnzER679jwcFcKYfLlw01gli6F6oszk8=" crossorigin="anonymous"> #}
7-
{# <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/themes/satellite-min.css" integrity="sha256-TehzF/2QvNKhGQrrNpoOb2Ck4iGZ1J/DI4pkd2oUsBc=" crossorigin="anonymous"> #}
8-
<div class="p-8">
6+
7+
<div class="p-8 max-w-6xl mx-auto">
8+
<h1 class="text-center">{{ title }}</h1>
99
<div id="searchbox"></div>
1010
<div id="hits"></div>
1111
</div>
@@ -21,10 +21,25 @@ const search = instantsearch({
2121
});
2222
2323
{% raw %}
24+
function pad(num) { return num < 10 ? `0${num}` : num; }
25+
26+
function getDurationString(duration) {
27+
let secondsInOne = {
28+
hour: 60*60,
29+
minute: 60
30+
};
31+
32+
let hours = Math.floor(duration / secondsInOne.hour);
33+
let minutes = Math.floor((duration % secondsInOne.hour) / secondsInOne.minute);
34+
let seconds = Math.floor(duration % secondsInOne.minute);
35+
36+
return `${hours ? `${hours}:`: ""}${hours ? pad(minutes) : minutes}:${pad(seconds)}`;
37+
}
38+
2439
search.addWidgets([
2540
instantsearch.widgets.searchBox({
2641
container: '#searchbox',
27-
placeholder: 'Search Video Content',
42+
//placeholder: 'Search Video Content',
2843
showReset: false,
2944
showSubmit: false,
3045
}),
@@ -43,20 +58,11 @@ search.addWidgets([
4358
let obj = {
4459
...item,
4560
url: `https://www.youtube.com/watch?v=${item.video.id}}&t=${start}s`,
61+
displayDuration: getDurationString(item.video.duration),
4662
};
4763
4864
if(start > 10) { // only show for deep links > 10 seconds
49-
let secondsInOne = {
50-
hour: 60*60,
51-
minute: 60
52-
}
53-
54-
function pad(num) { return num < 10 ? `0${num}` : num; }
55-
let hours = Math.floor(start / secondsInOne.hour);
56-
let minutes = Math.floor((start % secondsInOne.hour) / secondsInOne.minute);
57-
let seconds = Math.floor(start % secondsInOne.minute);
58-
59-
obj.displayStart = `<span class="jamstacktv-time"><b></b><b></b>${hours ? `${pad(hours)}:`: ""}${hours ? pad(minutes) : minutes}:${pad(seconds)}</span>`;
65+
obj.displayStartInline = `<span class="jamstacktv-time"><b></b><b></b>${getDurationString(start)} /</span>`;
6066
//obj._highlightResult.caption.content = `…${obj._highlightResult.caption.content}`;
6167
} else {
6268
obj.wrapperClass = "jamstacktv-no-skip";
@@ -66,16 +72,17 @@ search.addWidgets([
6672
},
6773
templates: {
6874
item: `
69-
<a href="{{ url }}" class="grid grid-cols-4 gap-4 mb-4 group">
70-
<div class="aspect-ratio-youtube relative bg-gradient-card-sunrise card-shadow group-hover:card-shadow-sunrise jamstacktv-card">
71-
<img src="{{ video.thumbnails.medium }}" alt="{{ video.title }}" class="absolute top-0 jamstacktv-img">
75+
<a href="{{ url }}" class="grid grid-cols-3 gap-4 mb-4 group">
76+
<div class="aspect-ratio-youtube relative jamstacktv-card">
77+
<img src="{{ video.thumbnails.medium }}" alt="{{ video.title }}" class="jamstacktv-img absolute top-0 card-shadow bg-gradient-card-sunrise group-hover:card-shadow-sunrise">
78+
<span class="jamstacktv-duration">{{{ displayStartInline }}}{{ displayDuration }}</span>
7279
</div>
73-
<div class="col-span-3 jamstacktv-item {{ wrapperClass }}">
80+
<div class="col-span-2 jamstacktv-item {{ wrapperClass }}">
7481
<div class="jamstacktv-meta mb-1">
7582
<span class="jamstacktv-category">{{#helpers.highlight}}{ "attribute": "playlist.title" }{{/helpers.highlight}}</span>
7683
<span class="jamstacktv-title">{{#helpers.highlight}}{ "attribute": "video.title" }{{/helpers.highlight}}</span>
7784
</div>
78-
<strong class="jamstacktv-caption">{{{ displayStart }}}<span class="jamstacktv-caption-quote">{{#helpers.highlight}}{ "attribute": "caption.content" }{{/helpers.highlight}}</span></strong>
85+
<strong class="jamstacktv-caption"><span class="jamstacktv-caption-quote">{{#helpers.highlight}}{ "attribute": "caption.content" }{{/helpers.highlight}}</span></strong>
7986
</div>
8087
</div>
8188
`,

0 commit comments

Comments
 (0)