Repository: expo/expo
File: docs/ui/components/VideoBoxLink/index.tsx (TypeScript)

Code before:
import { LinkBase, mergeClasses } from '@expo/styleguide';
import { ArrowUpRightIcon } from '@expo/styleguide-icons/outline/ArrowUpRightIcon';
import { PlaySolidIcon } from '@expo/styleguide-icons/solid/PlaySolidIcon';
import { type ReactNode } from 'react';

import { StructuredData } from '~/ui/components/StructuredData';
import { CALLOUT, LABEL } from '~/ui/components/Text';

type VideoBoxLinkProps = {
  title: string;
  description: ReactNode;
  videoId: string;
  time?: number;
  className?: string;
};

export function VideoBoxLink({ title, description, videoId, time, className }: VideoBoxLinkProps) {
  const videoStructuredData = {
    '@context': 'https://schema.org',
    '@type': 'VideoObject',
    name: title,
    description: title,
    thumbnailUrl: `https://i3.ytimg.com/vi/${videoId}/maxresdefault.jpg`,
    embedUrl: `https://www.youtube.com/embed/${videoId}`,
    contentUrl: `https://www.youtube.com/watch?v=${videoId}`,
  };

  return (
    <>
      <StructuredData data={videoStructuredData} id={`video-${videoId}`} />
      <LinkBase
        openInNewTab
        href={`https://www.youtube.com/watch?v=${videoId}${time ? `&t=${time}` : ''}`}
        className={mergeClasses(
          'group relative flex items-stretch overflow-hidden rounded-lg border border-default bg-default shadow-xs transition',
          'hocus:bg-subtle hocus:shadow-sm',
          'max-sm-gutters:flex-col',
          '[&+hr]:!mt-6',
          className
        )}
        aria-label={`Watch video: ${title} (opens in new tab)`}>
        <div
          className={mergeClasses(
            'relative flex max-w-[200px] items-center justify-center overflow-hidden border-r border-secondary bg-element',
            'max-sm-gutters:max-w-full max-sm-gutters:border-b max-sm-gutters:border-r-0'
          )}>
          <img

Review comment (suggestion):
Description is [recommended](https://developers.google.com/search/docs/appearance/structured-data/video#video-object), but not required, I think we should omit it rather than setting it to the same value as the title.

Code after:
import { LinkBase, mergeClasses } from '@expo/styleguide';
import { ArrowUpRightIcon } from '@expo/styleguide-icons/outline/ArrowUpRightIcon';
import { PlaySolidIcon } from '@expo/styleguide-icons/solid/PlaySolidIcon';
import { type ReactNode } from 'react';

import { getVideoUploadDate } from '~/public/static/talks';
import { StructuredData } from '~/ui/components/StructuredData';
import { CALLOUT, LABEL } from '~/ui/components/Text';

type VideoBoxLinkProps = {
  title: string;
  description: ReactNode;
  videoId: string;
  time?: number;
  className?: string;
};

export function VideoBoxLink({ title, description, videoId, time, className }: VideoBoxLinkProps) {
  const uploadDate = getVideoUploadDate(videoId);
  const videoStructuredData = {
    '@context': 'https://schema.org',
    '@type': 'VideoObject',
    name: title,
    thumbnailUrl: `https://i3.ytimg.com/vi/${videoId}/maxresdefault.jpg`,
    embedUrl: `https://www.youtube.com/embed/${videoId}`,
    contentUrl: `https://www.youtube.com/watch?v=${videoId}`,
    ...(uploadDate && { uploadDate }),
  };

  return (
    <>
      <StructuredData data={videoStructuredData} id={`video-${videoId}`} />
      <LinkBase
        openInNewTab
        href={`https://www.youtube.com/watch?v=${videoId}${time ? `&t=${time}` : ''}`}
        className={mergeClasses(
          'group relative flex items-stretch overflow-hidden rounded-lg border border-default bg-default shadow-xs transition',
          'hocus:bg-subtle hocus:shadow-sm',
          'max-sm-gutters:flex-col',
          '[&+hr]:!mt-6',
          className
        )}
        aria-label={`Watch video: ${title} (opens in new tab)`}>
        <div
          className={mergeClasses(
            'relative flex max-w-[200px] items-center justify-center overflow-hidden border-r border-secondary bg-element',
            'max-sm-gutters:max-w-full max-sm-gutters:border-b max-sm-gutters:border-r-0'