import React from 'react';

interface ImageBlockProps {
  src?: string;
  alt?: string;
  caption?: string;
  fullWidth?: boolean;
}

export function ImageBlock({ src = '', alt = '', caption = '', fullWidth = false }: ImageBlockProps) {
  if (!src) return null;
  return (
    <figure className={`${fullWidth ? 'w-full' : 'container max-w-4xl mx-auto px-4'} py-8`}>
      <img
        src={src}
        alt={alt}
        className="w-full rounded-xl shadow-sm"
        loading="lazy"
      />
      {caption && (
        <figcaption className="text-center text-sm text-text-light-gray mt-3">{caption}</figcaption>
      )}
    </figure>
  );
}
