import { Button } from '@/components/ui/button'; import { ScrollArea } from '@/components/ui/scroll-area'; import { IMAGES } from '@/data/images'; import { ADD_IMAGE, dispatcher } from '@designcombo/core'; import { nanoid } from 'nanoid'; export const Images = () => { const handleAddImage = (src: string) => { dispatcher?.dispatch(ADD_IMAGE, { payload: { id: nanoid(), details: { src: src, }, }, options: { trackId: 'main', }, }); }; return (
Photos
{IMAGES.map((image, index) => { return (
handleAddImage(image.src)} key={index} className="flex items-center justify-center w-full bg-zinc-950 pb-2 overflow-hidden cursor-pointer" > image
); })}
); }; function modifyImageUrl(url: string): string { const uploadIndex = url.indexOf('/upload'); if (uploadIndex === -1) { throw new Error('Invalid URL: /upload not found'); } const modifiedUrl = url.slice(0, uploadIndex + 7) + '/w_0.05,c_scale' + url.slice(uploadIndex + 7); return modifiedUrl; }