Skip to content

Instantly share code, notes, and snippets.

View tioluwani94's full-sized avatar

Tioluwani Kolawole tioluwani94

  • Lagos, Nigeria
View GitHub Profile
@tioluwani94
tioluwani94 / Image.tsx
Created January 9, 2021 21:03
Integrate NextJs `next/image` with Chakra-UI styling
import { chakra, ThemingProps, useStyleConfig } from '@chakra-ui/react'
import NextImage, { ImageProps as NextImageProps } from 'next/image'
import { ReactElement } from 'react'
import { Sizes } from '../../theme/variables/image'
// TODO review props when NextJs is updated so we don't have to defined it here
/**
* ? Because NextJs typing is preventing auto-suggest for layout, width and height,
* ? we declare the styles differently in this component and will manage the switch
* ? to NextJs typings when calling NextJs `next/image` component