"use client";
import { useState } from "react";
import PropTypes from "prop-types";
export default function ProviderIcon({
src,
alt,
size = 32,
className = "",
fallbackText = "?",
fallbackColor,
}) {
const [errored, setErrored] = useState(false);
if (!src || errored) {
return (
{fallbackText}
);
}
return (
setErrored(true)}
/>
);
}
ProviderIcon.propTypes = {
src: PropTypes.string,
alt: PropTypes.string,
size: PropTypes.number,
className: PropTypes.string,
fallbackText: PropTypes.string,
fallbackColor: PropTypes.string,
};