import Chip from "components/Chip"; import { GetVideosPreviewQuery } from "graphql/generated"; import Link from "next/link"; import { getVideoThumbnailURL, prettyDate, prettyDuration, prettyShortenNumber, } from "queries/helpers"; interface Props { video: Exclude< Exclude< GetVideosPreviewQuery["videos"], null | undefined >["data"][number]["attributes"], null | undefined >; } export default function PostPreview(props: Props): JSX.Element { const { video } = props; return (
{video.title}
play_circle_outline
{prettyDuration(video.duration)}

event {prettyDate(video.published_date)}

visibility {prettyShortenNumber(video.views)}

{video.channel?.data?.attributes && (

person {video.channel.data.attributes.title}

)}

{video.title}

{video.categories?.data.map((category) => ( {category.attributes?.short} ))}
); }