import { Cloudinary } from '@cloudinary/url-gen'
import { Props } from '../attributes'
import { CloudinarySrcset } from './srcset.js'
//
// create html strings for elements
//
export function CloudinaryImage (cloudName) {
const cld = new Cloudinary({
cloud: { cloudName },
url: { secure: true }
})
return { Image }
// const { filename, alt, loading, fetchpriority, className } = props
// return html for a local file
function Image (props:Props):string {
const { className, sizes, filename, decoding,
loading, fetchpriority, alt, srcset } = props
const _class = props.class || className
const { defaultSrcset, getSrcset } = CloudinarySrcset(cld)
return `