Skip to content

Instantly share code, notes, and snippets.

@fariasmateuss
Created February 20, 2022 02:54
Show Gist options
  • Save fariasmateuss/c187cd5a5a77628ca83b845763729a97 to your computer and use it in GitHub Desktop.
Save fariasmateuss/c187cd5a5a77628ca83b845763729a97 to your computer and use it in GitHub Desktop.
Next Image
import NextImage, { ImageProps } from 'next/image'
interface Props extends ImageProps {
noRounded?: boolean
}
const Image = (props: Props) => {
const isStatic = typeof props.src != `string`
return (
<div
className={`${
!props.noRounded && `rounded-md`
} overflow-hidden inline-flex`}
>
<NextImage
src={props.src}
blurDataURL={!isStatic && (props.src as string)}
placeholder="blur"
{...props}
/>
</div>
)
}
export default Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment