summaryrefslogtreecommitdiff
path: root/components/Sidebar/OrgImage.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-09 18:53:09 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-09 18:53:09 +0200
commitcbbe66126c5281c2d6e18487dd76516f6e77d4f8 (patch)
tree402293afa2fa7b4a8568ec2492571926af88b33e /components/Sidebar/OrgImage.tsx
parent6deb6247f63f5aaa25550dc0398d50221c5383c1 (diff)
fix: fetching error
Diffstat (limited to 'components/Sidebar/OrgImage.tsx')
-rw-r--r--components/Sidebar/OrgImage.tsx28
1 files changed, 28 insertions, 0 deletions
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<any>(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 <Image src={`http://localhost:35901/img/${fullPath}`} alt="" width={100} height={100} />
+}