Deskripsi:
- Upload foto profil ke storage
- Upload background profile ke storge
## No Issue
This commit is contained in:
2024-09-25 14:04:18 +08:00
parent 5670feb08c
commit 827b7c7bc1
54 changed files with 812 additions and 936 deletions

View File

@@ -0,0 +1,44 @@
"use client";
import { Button, FileButton } from "@mantine/core";
import { IconCamera } from "@tabler/icons-react";
import { MainColor } from "../color";
export function ComponentGlobal_ButtonUploadFileImage({
onSetFile,
onSetImage,
}: {
onSetFile: File | any;
onSetImage: any | null;
}) {
return (
<FileButton
onChange={async (files: any | null) => {
try {
const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())])
);
onSetFile(files);
onSetImage(buffer);
} catch (error) {
console.log(error);
}
}}
accept="image/png,image/jpeg"
>
{(props) => (
<Button
{...props}
radius={"xl"}
leftIcon={<IconCamera />}
bg={MainColor.yellow}
color="yellow"
c={"black"}
>
Upload
</Button>
)}
</FileButton>
);
}