import { html } from '@design.estate/dees-element';
import { injectCssVariables } from '../../00variables.js';
import type { DeesMobileGallery } from './dees-mobile-gallery.js';
export const demoFunc = () => {
injectCssVariables();
// Sample images for demo
const sampleImages = [
{
id: '1',
url: 'https://picsum.photos/800/1200?random=1',
thumbnailUrl: 'https://picsum.photos/100/100?random=1',
filename: 'receipt_001.jpg',
},
{
id: '2',
url: 'https://picsum.photos/1200/800?random=2',
thumbnailUrl: 'https://picsum.photos/100/100?random=2',
filename: 'shopping_photo.jpg',
},
{
id: '3',
url: 'https://picsum.photos/800/800?random=3',
thumbnailUrl: 'https://picsum.photos/100/100?random=3',
filename: 'receipt_002.jpg',
},
{
id: '4',
url: 'https://example.com/document.pdf',
filename: 'invoice.pdf',
mimeType: 'application/pdf',
},
];
return html`
Basic Gallery
{
const gallery = document.createElement('dees-mobile-gallery') as DeesMobileGallery;
gallery.items = sampleImages.slice(0, 3);
gallery.config = {
showFilename: true,
showActions: true,
allowDownload: true,
allowDelete: false,
};
gallery.addEventListener('close', () => gallery.remove());
gallery.addEventListener('download', (e: CustomEvent) => {
console.log('Download requested:', e.detail);
});
document.body.appendChild(gallery);
}}
>Open Gallery (3 images)
Fullscreen gallery with swipe navigation on mobile, arrow keys on desktop.
Single Image
{
const gallery = document.createElement('dees-mobile-gallery') as DeesMobileGallery;
gallery.items = [sampleImages[0]];
gallery.config = {
showFilename: true,
allowDownload: true,
};
gallery.addEventListener('close', () => gallery.remove());
document.body.appendChild(gallery);
}}
>View Single Image
Single image view without navigation controls.
With Delete Action
{
const gallery = document.createElement('dees-mobile-gallery') as DeesMobileGallery;
gallery.items = sampleImages.slice(0, 3);
gallery.config = {
showFilename: true,
allowDownload: true,
allowDelete: true,
};
gallery.addEventListener('close', () => gallery.remove());
gallery.addEventListener('delete', (e: CustomEvent) => {
console.log('Delete requested:', e.detail);
gallery.remove();
});
document.body.appendChild(gallery);
}}
>Gallery with Delete
Shows delete action button in red.
Start at Specific Index
{
const gallery = document.createElement('dees-mobile-gallery') as DeesMobileGallery;
gallery.items = sampleImages.slice(0, 3);
gallery.config = {
startIndex: 2,
showFilename: true,
allowDownload: true,
};
gallery.addEventListener('close', () => gallery.remove());
document.body.appendChild(gallery);
}}
>Open at Image 3
Opens gallery starting at the third image.
With PDF
{
const gallery = document.createElement('dees-mobile-gallery') as DeesMobileGallery;
gallery.items = sampleImages;
gallery.config = {
startIndex: 3,
showFilename: true,
allowDownload: true,
};
gallery.addEventListener('close', () => gallery.remove());
document.body.appendChild(gallery);
}}
>Gallery with PDF
PDF files show a placeholder with filename.
Static Factory Method
{
const { DeesMobileGallery } = await import('./dees-mobile-gallery.js');
const result = await DeesMobileGallery.show(
sampleImages.slice(0, 3),
{
showFilename: true,
allowDownload: true,
allowDelete: true,
}
);
console.log('Gallery result:', result);
}}
>Use Static show()
Uses the static factory method that returns a promise.
Minimal Mode
{
const gallery = document.createElement('dees-mobile-gallery') as DeesMobileGallery;
gallery.items = sampleImages.slice(0, 3);
gallery.config = {
showFilename: false,
showActions: false,
};
gallery.addEventListener('close', () => gallery.remove());
document.body.appendChild(gallery);
}}
>Minimal Gallery
No filename or action buttons - just images.
`;
};