Deskripsi:
- Tampilan map
- Tampilan portofolio
- Kirim file ke wibu storage
## No Image
This commit is contained in:
2024-09-21 04:53:19 +08:00
parent 128da1eb32
commit 56548b4258
43 changed files with 620 additions and 589 deletions

View File

@@ -0,0 +1,79 @@
"use client";
import { AspectRatio, Box, Center, Image } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { useState } from "react";
import ComponentGlobal_Loader from "./loader";
export function ComponentGlobal_LoadImage({
url,
maw,
h,
}: {
url: string;
maw?: number;
h?: number;
}) {
const [isImage, setIsImage] = useState<boolean | null>(null);
useShallowEffect(() => {
onLoadImage();
}, []);
async function onLoadImage() {
try {
const res = await fetch(url);
if (res.ok) {
return setIsImage(true);
}
setIsImage(false);
} catch (error) {
console.log(error);
}
}
if (isImage === null)
return (
<Center h={h ? h : 250}>
<ComponentGlobal_Loader variant="dots" size={50} />
</Center>
);
if (!isImage)
return (
<>
<Center h={250}>
<Image
alt="No Image"
maw={150}
m={"auto"}
p={"xs"}
src={"/aset/global/no-image.svg"}
/>
</Center>
</>
);
return (
<>
{h ? (
<Image
height={h}
alt="Image"
maw={maw ? maw : 200}
m={"auto"}
p={"xs"}
src={url}
/>
) : (
<Image
alt="Image"
maw={maw ? maw : 200}
m={"auto"}
p={"xs"}
src={url}
/>
)}
</>
);
}

View File

@@ -2,6 +2,7 @@ import ComponentGlobal_BoxInformation from "./box_information";
import ComponentGlobal_AvatarAndAuthorName from "./comp_author_name_and_avatar";
import { ComponentGlobal_BoxUploadImage } from "./comp_box_upload_image";
import { ComponentGlobal_CardStyles } from "./comp_card_box_and_background";
import { ComponentGlobal_LoadImage } from "./comp_load_image";
import ComponentGlobal_CardLoadingOverlay from "./comp_loading_card";
import ComponentGlobal_TampilanAngkaRatusan from "./comp_tampilan_angka_ratusan";
import ComponentGlobal_TampilanRupiah from "./comp_tampilan_rupiah";
@@ -15,3 +16,4 @@ export { ComponentGlobal_BoxInformation };
export { ComponentGlobal_InputCountDown };
export { ComponentGlobal_CardStyles };
export { ComponentGlobal_BoxUploadImage };
export { ComponentGlobal_LoadImage };