summaryrefslogtreecommitdiff
path: root/src/core/components/elements/Image/Image.jsx
blob: d7b19821822cddbbf467bc93ad56a9e8783beccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { LazyLoadImage } from 'react-lazy-load-image-component'
import 'react-lazy-load-image-component/src/effects/opacity.css'

/**
 * The `Image` component is used to display lazy-loaded images.
 *
 * @param {Object} props - Props passed to the `Image` component.
 * @param {string} props.src - URL of the image to be displayed.
 * @param {string} props.alt - Alternative text to be displayed if the image is not found.
 * @returns {JSX.Element} - Rendered `Image` component.
 */
const Image = ({ ...props }) => {
  return (
    <LazyLoadImage
      {...props}
      src={props.src || '/images/noimage.jpeg'}
      placeholderSrc='/images/indoteknik-placeholder.png'
      effect='opacity'
      alt={props.src ? props.alt : 'Image Not Found - Indoteknik'}
      wrapperClassName='bg-white'
      loading='eager'
    />
  )
}

export default Image