Merge branch 'main' of github.com:interchain-name/icns-frontend

This commit is contained in:
HeesungB 2022-12-17 01:25:28 +09:00
commit 75656943a1

View File

@ -2,16 +2,26 @@ import { useState } from "react";
import Image, { ImageProps } from "next/image"; import Image, { ImageProps } from "next/image";
import KeplrIcon from "../../public/images/svg/keplr-icon.svg"; import KeplrIcon from "../../public/images/svg/keplr-icon.svg";
import styled from "styled-components";
export const ChainImage = (props: ImageProps) => { export const ChainImage = ({ src, ...props }: ImageProps) => {
const [src, setSrc] = useState(props.src); const [srcState, setSrcState] = useState(src);
return ( return (
<ImageWrapper>
<Image <Image
{...props} {...props}
src={src} src={srcState}
alt="chain image"
sizes="3rem" sizes="3rem"
onError={() => setSrc(KeplrIcon)} onError={() => setSrcState(KeplrIcon)}
/> />
</ImageWrapper>
); );
}; };
const ImageWrapper = styled.div`
img {
border-radius: 50%;
}
`;