import { Chip } from "components/Chip"; import { Img } from "components/Img"; import { InsetBox } from "components/InsetBox"; import { Markdawn } from "components/Markdown/Markdawn"; import { GetContentTextQuery, UploadImageFragment } from "graphql/generated"; import { prettyInlineTitle, prettySlug, slugify } from "helpers/formatters"; import { ImageQuality } from "helpers/img"; import { filterHasAttributes } from "helpers/others"; import { useLocalData } from "contexts/LocalDataContext"; import { useLightBox } from "contexts/LightBoxContext"; /* * ╭─────────────╮ * ───────────────────────────────────────╯ COMPONENT ╰─────────────────────────────────────────── */ interface Props { pre_title?: string | null | undefined; title: string | null | undefined; subtitle?: string | null | undefined; description?: string | null | undefined; type?: NonNullable< NonNullable["data"][number]["attributes"] >["type"]; categories?: NonNullable< NonNullable["data"][number]["attributes"] >["categories"]; thumbnail?: UploadImageFragment | null | undefined; languageSwitcher?: JSX.Element; } // ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ export const ThumbnailHeader = ({ pre_title, title, subtitle, thumbnail, type, categories, description, languageSwitcher, }: Props): JSX.Element => { const { langui } = useLocalData(); const { showLightBox } = useLightBox(); return ( <>
{thumbnail ? ( showLightBox([thumbnail])} /> ) : (
)}

{pre_title}

{title}

{subtitle}

{type?.data?.attributes && (

{langui.type}

)} {categories && categories.data.length > 0 && (

{langui.categories}

{filterHasAttributes(categories.data, ["attributes", "id"] as const).map( (category) => ( ) )}
)} {languageSwitcher}
{description && {}} ); };