import type { Alignment } from '@curvenote/blocks';
import type { Image as ImageNode } from 'myst-spec';
import type { NodeRenderer } from './types';
function alignToMargin(align: string) {
switch (align) {
case 'left':
return { marginRight: 'auto' };
case 'right':
return { marginLeft: 'auto' };
case 'center':
return { margin: '0 auto' };
default:
return {};
}
}
function Picture({
src,
srcOptimized,
urlSource,
align = 'center',
alt,
width,
}: {
src: string;
srcOptimized?: string;
urlSource?: string;
alt?: string;
width?: string;
align?: Alignment;
}) {
const image = (
);
if (!srcOptimized) return image;
return (
{image}
);
}
export const Image: NodeRenderer = (node) => {
return (
);
};
const IMAGE_RENDERERS = {
image: Image,
};
export default IMAGE_RENDERERS;