---
import type { Photo } from '@/types/shared';
import { Image } from '@astrojs/image/components';

export interface Props {
  src: Photo;
  alt: string;
  class?: string;
  width?: number;
  height?: number;
}

const { src, ...props } = Astro.props;

const isRemoteImage = typeof src === 'string';
---

{
  isRemoteImage ? (
    <img src={src} {...props} />
  ) : (
    <Image format="webp" fit="cover" loading="eager" src={src} {...props} />
  )
}
