forked from LaconicNetwork/icns-frontend
Merge branch 'main' of github.com:interchain-name/icns-frontend
This commit is contained in:
commit
75656943a1
@ -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 (
|
||||||
<Image
|
<ImageWrapper>
|
||||||
{...props}
|
<Image
|
||||||
src={src}
|
{...props}
|
||||||
sizes="3rem"
|
src={srcState}
|
||||||
onError={() => setSrc(KeplrIcon)}
|
alt="chain image"
|
||||||
/>
|
sizes="3rem"
|
||||||
|
onError={() => setSrcState(KeplrIcon)}
|
||||||
|
/>
|
||||||
|
</ImageWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ImageWrapper = styled.div`
|
||||||
|
img {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
Loading…
Reference in New Issue
Block a user