From cbbe66126c5281c2d6e18487dd76516f6e77d4f8 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Sat, 9 Oct 2021 18:53:09 +0200 Subject: fix: fetching error --- components/Sidebar/OrgImage.tsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 components/Sidebar/OrgImage.tsx (limited to 'components/Sidebar/OrgImage.tsx') diff --git a/components/Sidebar/OrgImage.tsx b/components/Sidebar/OrgImage.tsx new file mode 100644 index 0000000..e8773e2 --- /dev/null +++ b/components/Sidebar/OrgImage.tsx @@ -0,0 +1,28 @@ +import React, { useEffect, useState } from 'react' +import Image from 'next/image' +import path from 'path' +//import '../../../public/placeholder.png' + +export interface OrgImageProps { + src: string + file: string +} + +export const OrgImage = (props: OrgImageProps) => { + const { src, file } = props + + const [image, setImage] = useState(null) + const dir = path.dirname(file) + const fullPath = encodeURIComponent(encodeURIComponent(path.join(dir, src))) + + /* ) +* .then((res) => res.blob()) +* .then((res) => setImage(res)) +* .catch((e) => { +* setImage(null) +* console.error(e) +* }) +}, [fullPath]) */ + + return +} -- cgit v1.2.3