forked from keephq/keep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support linked providers for non existing providers (keephq#1162)
- Loading branch information
Showing
3 changed files
with
103 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { useState } from "react"; | ||
import Image from "next/image"; | ||
|
||
const ImageWithFallback = (props: any) => { | ||
const { src, fallbackSrc, alt, width, height, className, ...rest } = props; | ||
const [imgSrc, setImgSrc] = useState(src); | ||
|
||
return ( | ||
// eslint-disable-next-line jsx-a11y/alt-text | ||
<Image | ||
{...rest} | ||
src={imgSrc} | ||
width={width} | ||
height={height} | ||
alt={alt} | ||
className={className} | ||
onError={() => { | ||
setImgSrc(fallbackSrc); | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default ImageWithFallback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters