"use client"

import NextImage from "next/image"

import type { ImageLoaderProps, ImageProps } from "next/image"

function imageLoader({ quality, src, width }: ImageLoaderProps) {
  return `${src}?w=${width}${quality ? "&q=" + quality : ""}`
}

// Next/Image adds & instead of ? before the params
export default function Image(props: ImageProps) {
  return <NextImage {...props} loader={imageLoader} />
}
