Skip to content

Commit

Permalink
Modify design of thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
marshallku committed Feb 13, 2025
1 parent 715369d commit a89c84f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions apps/blog/src/components/YoutubeThumbnailExtractor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
import { useCallback, useState } from "react";

const VIDEO_SIZE_NAMES = ["hq720", "sddefault", "hqdefault", "mqdefault", "default"];
const VIDEO_SIZES = [
[1280, 720],
[640, 480],
[480, 360],
[320, 180],
[120, 90],
];

const extractVideoId = (videoUrl: string) => {
const videoPattern = /youtu\.?be(\.com)?\/(live\/)?(shorts\/|watch\?v=|embed\/)?([^&?\s]+)/;
Expand Down Expand Up @@ -50,8 +57,13 @@ function YoutubeThumbnailExtractor() {
<div className="result" style={{ display: videoId ? "block" : "none" }}>
<div className="result__title">Thumbnails</div>
<div className="result__thumbnail">
{thumbnails.map((thumbnail) => (
<img key={thumbnail} src={thumbnail} alt={thumbnail} />
{thumbnails.map((thumbnail, index) => (
<figure key={thumbnail}>
<img src={thumbnail} alt={thumbnail} />
<figcaption>
{VIDEO_SIZES[index][0]} * {VIDEO_SIZES[index][1]}
</figcaption>
</figure>
))}
</div>
</div>
Expand Down

1 comment on commit a89c84f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Visual regression test result - success

Component Story Success Viewport MisMatch Percentage
components-button string-children phone 0.00%
components-button string-children tablet 0.10%
input-input default phone 0.00%
input-input default tablet 0.10%
input-input line phone 0.00%
input-input line tablet 0.04%
input-input box phone 0.00%
input-input box tablet 0.04%
components-profile default phone 0.00%
components-profile default tablet 0.00%
input-textarea line phone 0.00%
input-textarea line tablet 0.04%
input-textarea box phone 0.00%
input-textarea box tablet 0.04%
typography-typography default phone 0.00%
typography-typography default tablet 0.07%

Please sign in to comment.