"use client";
import clsx from "clsx";
import NextImage from "next/image";
import { memo, useEffect, useState } from "react";
interface ImageProps {
alt?: string;
src: string;
width: number;
height: number;
}
/**
* used for local preview
*/
const Image = memo(({ src, alt, width, height }: ImageProps) => {
const [mounted, setMounted] = useState(false);
useEffect(() => {
setMounted(true);
}, []);
return (
);
});
export default Image;
// https://github.com/vercel/next.js/blob/canary/examples/image-component/pages/shimmer.js
const shimmer = (w, h) => `
`;
const toBase64 = (str) =>
typeof window === "undefined"
? Buffer.from(str).toString("base64")
: window.btoa(str);