From 0e311b0aa214a9744f547bc3fc652ea82834c253 Mon Sep 17 00:00:00 2001 From: Brandon Egger Date: Tue, 22 Aug 2023 13:02:12 -0500 Subject: [PATCH] add resource table separate icon component --- src/components/ResourceTable.tsx | 48 ++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/components/ResourceTable.tsx b/src/components/ResourceTable.tsx index a61f5b3..40e82e6 100644 --- a/src/components/ResourceTable.tsx +++ b/src/components/ResourceTable.tsx @@ -9,12 +9,50 @@ import { ClipboardDocumentListIcon } from "@heroicons/react/24/outline"; import Image from "next/image"; import Link from "next/link"; import { translateEnumPlatform, translateEnumSkill } from "~/utils/enumWordLut"; -import { type ChangeEvent } from "react"; +import { useEffect, type ChangeEvent, useState } from "react"; import { ChevronDownIcon } from "@heroicons/react/24/outline"; import { type ParsedUrlQuery, type ParsedUrlQueryInput } from "querystring"; import { useRouter } from "next/router"; import { PriceIcon } from "~/prices/Icons"; +export const ResourcePhoto = ({ resource }: { resource: AuditoryResource }) => { + const [blobSrc, setBlobSrc] = useState(undefined); + + useEffect(() => { + if (!resource.photo?.data) { + return; + } + + const blob = new Blob([resource.photo.data], { type: "image/png" }); + setBlobSrc(URL.createObjectURL(blob)); + }, []); + + const commonProps = { + width: 512, + height: 512, + }; + + if (resource.photo?.data) { + return ( + {`${resource.name} + ); + } + + return ( + {`${resource.name} + ); +}; + export const ResourceInfo = ({ resource, showMoreInfo, @@ -46,13 +84,7 @@ export const ResourceInfo = ({ {showMoreInfo ? (
- {`${resource.name} + more info