From 83d1a1c558293e1b14c9a5847628e7661f749c66 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Mon, 21 Oct 2024 14:54:11 +0700
Subject: initial commit

---
 app/lib/camera/component/pakageCamera.tsx | 44 +++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 app/lib/camera/component/pakageCamera.tsx

(limited to 'app/lib/camera/component/pakageCamera.tsx')

diff --git a/app/lib/camera/component/pakageCamera.tsx b/app/lib/camera/component/pakageCamera.tsx
new file mode 100644
index 0000000..e0c7158
--- /dev/null
+++ b/app/lib/camera/component/pakageCamera.tsx
@@ -0,0 +1,44 @@
+import React from "react";
+import useCameraStore from "../hooks/useCameraStore";
+import { IconButton } from "@mui/material";
+import { PhotoCameraFrontOutlined } from "@mui/icons-material";
+
+const PackageCamera: React.FC = () => {
+  const { setImagePackage } = useCameraStore();
+  const handleCapture = (event: React.ChangeEvent<HTMLInputElement>) => {
+    const file = event.target.files?.[0];
+    if (file) {
+      const reader = new FileReader();
+      reader.onloadend = () => {
+        setImagePackage(reader.result as string);
+      };
+      reader.readAsDataURL(file);
+    }
+  };
+
+  return (
+    <div className="px-4 py-8 items-center border-2 rounded-md shadow-sm w-[49%] text-center ">
+      <input
+        type="file"
+        accept="image/*"
+        capture="environment"
+        onChange={handleCapture}
+        className="hidden"
+        id="pakageCameraInput"
+      />
+      <label htmlFor="pakageCameraInput" className="text-gray-600">
+        <IconButton
+          color="primary"
+          aria-label="upload picture"
+          component="span"
+        >
+          <PhotoCameraFrontOutlined fontSize="large" />
+        </IconButton>
+        <br />
+        Foto Penerima
+      </label>
+    </div>
+  );
+};
+
+export default PackageCamera;
-- 
cgit v1.2.3

