import { v2 } from "@govtechsg/open-attestation";
import React, { FunctionComponent } from "react";

export interface ImageRenderer {
  attachment: v2.Attachment;
}

export const ImageRenderer: FunctionComponent<ImageRenderer> = ({ attachment }) => {
  const imageBase64 = `data:${attachment.type};base64,${attachment.data}`;

  return (
    <div>
      <img src={imageBase64} alt={attachment.filename} />
    </div>
  );
};
