personal website

Commit 67ac5d03

67ac5d03d019Merged

Justin Dorfman <[email protected]> · 7 months ago · 1 file · ~1 modified

Description

fix: resolve shorts carousel distortion and reorder newest-to-oldest (#62)

The shorts carousel viewport was stretching thumbnails beyond their natural 9:16 aspect ratio, causing black bars and distorted covers. Removed flex-grow from thumbnail containers, centralized iframe positioning into CSS, and reordered shorts by publish date (newest first).

Details

Commit
67ac5d03d019
Parent
e8f47059c786

index.htmlmodifiedView file

@@ -22,7 +22,7 @@
2222 --muted: #1e1e22;
2323 --muted-foreground: #8b8b8b;
2424 --border: #2a2a30;
25- --accent: #4ecdc4;
25+ --accent: #9DCBFF;
2626 --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
2727 --font-mono: ui-monospace, 'SF Mono', Menlo, Monaco, 'Cascadia Mono', monospace;
2828 --radius: 0.5rem;
@@ -296,6 +296,14 @@
296296 overflow: hidden;
297297 }
298298
299+ .video-thumbnail iframe {
300+ position: absolute;
301+ top: 0;
302+ left: 0;
303+ width: 100%;
304+ height: 100%;
305+ }
306+
299307 .video-thumbnail-16-9 {
300308 aspect-ratio: 16 / 9;
301309 }
@@ -411,6 +419,92 @@
411419 display: block;
412420 margin: 2rem auto 0;
413421 }
422+
423+ /* Shorts Carousel */
424+ .shorts-carousel {
425+ display: flex;
426+ flex-direction: column;
427+ }
428+
429+ .shorts-carousel-viewport {
430+ overflow: hidden;
431+ }
432+
433+ .shorts-carousel-track {
434+ display: grid;
435+ grid-auto-flow: column;
436+ grid-auto-columns: 100%;
437+ height: 100%;
438+ transition: transform 0.3s ease;
439+ }
440+
441+ .shorts-slide {
442+ display: flex;
443+ flex-direction: column;
444+ justify-content: center;
445+ overflow: hidden;
446+ }
447+
448+ .shorts-slide .video-thumbnail {
449+ flex: none;
450+ width: 100%;
451+ }
452+
453+ .shorts-carousel-controls {
454+ display: flex;
455+ align-items: center;
456+ justify-content: center;
457+ gap: 1rem;
458+ padding: 0.75rem 1rem;
459+ border-top: 1px solid var(--border);
460+ }
461+
462+ .shorts-arrow {
463+ display: flex;
464+ align-items: center;
465+ justify-content: center;
466+ width: 2rem;
467+ height: 2rem;
468+ border-radius: 50%;
469+ border: 1px solid var(--border);
470+ background: transparent;
471+ color: var(--muted-foreground);
472+ font-size: 1.25rem;
473+ cursor: pointer;
474+ transition: all 0.2s ease;
475+ line-height: 1;
476+ }
477+
478+ .shorts-arrow:hover {
479+ border-color: var(--muted-foreground);
480+ color: var(--foreground);
481+ background-color: var(--muted);
482+ }
483+
484+ .shorts-dots {
485+ display: flex;
486+ align-items: center;
487+ gap: 0.5rem;
488+ }
489+
490+ .shorts-dot {
491+ width: 0.5rem;
492+ height: 0.5rem;
493+ border-radius: 50%;
494+ border: none;
495+ background-color: var(--border);
496+ cursor: pointer;
497+ padding: 0;
498+ transition: background-color 0.2s ease;
499+ }
500+
501+ .shorts-dot:hover {
502+ background-color: var(--muted-foreground);
503+ }
504+
505+ .shorts-dot.active {
506+ background-color: var(--accent);
507+ }
414508 </style>
415509 </head>
416510 <body>
@@ -454,23 +548,99 @@
454548 <div class="work-inner">
455549 <h2 class="work-title">Featured Work</h2>
456550 <div class="video-grid">
457- <!-- Vertical Video Card -->
458- <article class="video-card video-card-vertical">
459- <div class="video-thumbnail video-thumbnail-9-16">
460- <iframe
461- src="https://www.youtube.com/embed/C6jUbQo92Ig"
462- title="Quick Tips Series"
463- frameborder="0"
464- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
465- allowfullscreen
466- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
467- </iframe>
551+ <!-- Shorts Carousel -->
552+ <div class="shorts-carousel video-card video-card-vertical" tabindex="0" aria-label="YouTube Shorts gallery">
553+ <div class="shorts-carousel-viewport">
554+ <div class="shorts-carousel-track">
555+ <article class="shorts-slide">
556+ <div class="video-thumbnail video-thumbnail-9-16">
557+ <iframe
558+ src="https://www.youtube.com/embed/bHIBfzMspt4"
559+ title="Free Sourcegraph MCP server for open source repos"
560+ frameborder="0"
561+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
562+ allowfullscreen>
563+ </iframe>
564+ </div>
565+ <div class="video-info">
566+ <span class="video-category">Shorts / Social</span>
567+ <h3 class="video-card-title">Free Sourcegraph MCP server for open source repos</h3>
568+ </div>
569+ </article>
570+ <article class="shorts-slide">
571+ <div class="video-thumbnail video-thumbnail-9-16">
572+ <iframe
573+ data-src="https://www.youtube.com/embed/rmiQkoAMoag"
574+ title="GitHub Copilot + MCP Server: Search C++ Repositories for Vulnerabilities in VS Code"
575+ frameborder="0"
576+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
577+ allowfullscreen>
578+ </iframe>
579+ </div>
580+ <div class="video-info">
581+ <span class="video-category">Shorts / Social</span>
582+ <h3 class="video-card-title">GitHub Copilot + MCP Server: Search C++ Repositories for Vulnerabilities in VS Code</h3>
583+ </div>
584+ </article>
585+ <article class="shorts-slide">
586+ <div class="video-thumbnail video-thumbnail-9-16">
587+ <iframe
588+ data-src="https://www.youtube.com/embed/7flz-d-V6AY"
589+ title="Connect Claude Code to Sourcegraph's MCP Server"
590+ frameborder="0"
591+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
592+ allowfullscreen>
593+ </iframe>
594+ </div>
595+ <div class="video-info">
596+ <span class="video-category">Shorts / Social</span>
597+ <h3 class="video-card-title">Connect Claude Code to Sourcegraph's MCP Server</h3>
598+ </div>
599+ </article>
600+ <article class="shorts-slide">
601+ <div class="video-thumbnail video-thumbnail-9-16">
602+ <iframe
603+ data-src="https://www.youtube.com/embed/C6jUbQo92Ig"
604+ title="Using Sourcegraph's MCP server with the Amp coding agent"
605+ frameborder="0"
606+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
607+ allowfullscreen>
608+ </iframe>
609+ </div>
610+ <div class="video-info">
611+ <span class="video-category">Shorts / Social</span>
612+ <h3 class="video-card-title">Using Sourcegraph's MCP server with the Amp coding agent</h3>
613+ </div>
614+ </article>
615+ <article class="shorts-slide">
616+ <div class="video-thumbnail video-thumbnail-9-16">
617+ <iframe
618+ data-src="https://www.youtube.com/embed/PY234vXSkvM"
619+ title="Ask Questions About Your Codebase in Slack"
620+ frameborder="0"
621+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
622+ allowfullscreen>
623+ </iframe>
624+ </div>
625+ <div class="video-info">
626+ <span class="video-category">Shorts / Social</span>
627+ <h3 class="video-card-title">Ask Questions About Your Codebase in Slack</h3>
628+ </div>
629+ </article>
630+ </div>
468631 </div>
469- <div class="video-info">
470- <span class="video-category">Shorts / Social</span>
471- <h3 class="video-card-title">using Sourcegraph's MCP server with the Amp coding agent</h3>
632+ <div class="shorts-carousel-controls">
633+ <button class="shorts-arrow shorts-arrow-prev" aria-label="Previous short">&#8249;</button>
634+ <div class="shorts-dots">
635+ <button class="shorts-dot active" aria-label="Short 1" aria-current="true"></button>
636+ <button class="shorts-dot" aria-label="Short 2"></button>
637+ <button class="shorts-dot" aria-label="Short 3"></button>
638+ <button class="shorts-dot" aria-label="Short 4"></button>
639+ <button class="shorts-dot" aria-label="Short 5"></button>
640+ </div>
641+ <button class="shorts-arrow shorts-arrow-next" aria-label="Next short">&#8250;</button>
472642 </div>
473- </article>
643+ </div>
474644
475645 <!-- Horizontal Video Card 1 -->
476646 <article class="video-card video-card-horizontal">
@@ -693,6 +863,47 @@
693863 button.textContent = 'More';
694864 }
695865 }
866+
867+ (function initShortsCarousel() {
868+ const carousel = document.querySelector('.shorts-carousel');
869+ const track = carousel.querySelector('.shorts-carousel-track');
870+ const slides = track.querySelectorAll('.shorts-slide');
871+ const dots = carousel.querySelectorAll('.shorts-dot');
872+ const prevBtn = carousel.querySelector('.shorts-arrow-prev');
873+ const nextBtn = carousel.querySelector('.shorts-arrow-next');
874+ let current = 0;
875+
876+ function goTo(index) {
877+ if (index < 0) index = slides.length - 1;
878+ if (index >= slides.length) index = 0;
879+
880+ const iframe = slides[index].querySelector('iframe');
881+ if (iframe.dataset.src && !iframe.src) {
882+ iframe.src = iframe.dataset.src;
883+ }
884+
885+ track.style.transform = 'translateX(-' + (index * 100) + '%)';
886+
887+ dots[current].classList.remove('active');
888+ dots[current].removeAttribute('aria-current');
889+ dots[index].classList.add('active');
890+ dots[index].setAttribute('aria-current', 'true');
891+
892+ current = index;
893+ }
894+
895+ prevBtn.addEventListener('click', function() { goTo(current - 1); });
896+ nextBtn.addEventListener('click', function() { goTo(current + 1); });
897+
898+ dots.forEach(function(dot, i) {
899+ dot.addEventListener('click', function() { goTo(i); });
900+ });
901+
902+ carousel.addEventListener('keydown', function(e) {
903+ if (e.key === 'ArrowLeft') { e.preventDefault(); goTo(current - 1); }
904+ if (e.key === 'ArrowRight') { e.preventDefault(); goTo(current + 1); }
905+ });
906+ })();
696907 </script>
697908 </body>
698909 </html>