{['#ffffff', '#f8fafc', '#f1f5f9', '#18181b', '#0f172a'].map((c) => (
{columnOptions.map((n) => (
))}
{gapOptions.map((g) => (
))}
{images.map((img, i) => (
))}
);
};
/* ---------- Craft config ---------- */
Gallery.craft = {
displayName: 'Gallery',
props: {
images: defaultImages,
columns: 3,
gap: '16px',
style: { backgroundColor: '#ffffff' },
lightbox: false,
},
rules: {
canDrag: () => true,
canMoveIn: () => false,
canMoveOut: () => true,
},
related: {
settings: GallerySettings,
},
};
/* ---------- HTML export ---------- */
(Gallery as any).toHtml = (props: GalleryProps, _childrenHtml: string) => {
const sectionStyle = cssPropsToString({
padding: '60px 20px',
...props.style,
});
const images = props.images || defaultImages;
const columns = props.columns || 3;
const gap = props.gap || '16px';
const lightbox = props.lightbox || false;
const galleryId = 'gallery_' + Math.random().toString(36).slice(2, 8);
const items = images.map((img) => {
const caption = img.caption
? `