2022-12-12 13:45:24 +00:00
|
|
|
import { useState } from "react";
|
|
|
|
import Image, { ImageProps } from "next/image";
|
|
|
|
|
2022-12-18 09:45:49 +00:00
|
|
|
import ICNSLogo from "../../public/images/icns-logo-120x120.png";
|
2022-12-16 15:53:40 +00:00
|
|
|
import styled from "styled-components";
|
2022-12-12 13:45:24 +00:00
|
|
|
|
2022-12-16 15:53:40 +00:00
|
|
|
export const ChainImage = ({ src, ...props }: ImageProps) => {
|
|
|
|
const [srcState, setSrcState] = useState(src);
|
2022-12-12 13:45:24 +00:00
|
|
|
|
2022-12-15 04:25:07 +00:00
|
|
|
return (
|
2022-12-16 15:53:40 +00:00
|
|
|
<ImageWrapper>
|
|
|
|
<Image
|
|
|
|
{...props}
|
|
|
|
src={srcState}
|
|
|
|
alt="chain image"
|
|
|
|
sizes="3rem"
|
2022-12-18 09:45:49 +00:00
|
|
|
onError={() => setSrcState(ICNSLogo)}
|
2022-12-16 15:53:40 +00:00
|
|
|
/>
|
|
|
|
</ImageWrapper>
|
2022-12-15 04:25:07 +00:00
|
|
|
);
|
2022-12-12 13:45:24 +00:00
|
|
|
};
|
2022-12-16 15:53:40 +00:00
|
|
|
|
|
|
|
const ImageWrapper = styled.div`
|
2022-12-17 12:34:14 +00:00
|
|
|
position: relative;
|
|
|
|
width: 3rem;
|
|
|
|
height: 3rem;
|
|
|
|
|
2022-12-16 15:53:40 +00:00
|
|
|
img {
|
|
|
|
border-radius: 50%;
|
|
|
|
}
|
|
|
|
`;
|