tomodachi-share/src/components/profile-picture.tsx
2026-03-13 22:07:10 +00:00

11 lines
394 B
TypeScript

"use client";
import Image, { ImageProps } from "next/image";
import { useState } from "react";
export default function ProfilePicture(props: Partial<ImageProps>) {
const { src, ...rest } = props;
const [imgSrc, setImgSrc] = useState(src);
return <Image width={128} height={128} {...rest} src={imgSrc || "/guest.png"} alt={"profile picture"} onError={() => setImgSrc("/guest.png")} />;
}