diff --git a/src/components/editor/Navbar.tsx b/src/components/editor/Navbar.tsx index b0478b2..ab5aa8d 100644 --- a/src/components/editor/Navbar.tsx +++ b/src/components/editor/Navbar.tsx @@ -15,7 +15,8 @@ import { Heart, Twitter, X, - CheckCircle + CheckCircle, + Github } from 'lucide-react'; import { toast } from 'sonner'; import { useMockupStore } from '@/contexts/MockupContext'; @@ -50,39 +51,39 @@ export function Navbar() { const imgElement = mockupElement.querySelector('img') as HTMLImageElement; if (!imgElement) throw new Error('Image element not found'); - - // For fixed margin mode: capture the entire canvas (image + background margins) - const canvas = await html2canvas(mockupElement, { - scale: qualityMultiplier * 2, - useCORS: true, - allowTaint: true, - backgroundColor: null, - // Capture the entire mockup element without any cropping - }); - const mimeType = `image/${format.toLowerCase()}`; - const imageQuality = format === 'JPEG' ? 1 : undefined; + // For fixed margin mode: capture the entire canvas (image + background margins) + const canvas = await html2canvas(mockupElement, { + scale: qualityMultiplier * 2, + useCORS: true, + allowTaint: true, + backgroundColor: null, + // Capture the entire mockup element without any cropping + }); + + const mimeType = `image/${format.toLowerCase()}`; + const imageQuality = format === 'JPEG' ? 1 : undefined; + + canvas.toBlob( + (blob) => { + if (blob) { + const url = URL.createObjectURL(blob); + const a = document.createElement('a'); + a.href = url; + a.download = `mockup-${Date.now()}.${format.toLowerCase()}`; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + URL.revokeObjectURL(url); + } else { + throw new Error('Failed to create blob'); + } + }, + mimeType, + imageQuality + ); + - canvas.toBlob( - (blob) => { - if (blob) { - const url = URL.createObjectURL(blob); - const a = document.createElement('a'); - a.href = url; - a.download = `mockup-${Date.now()}.${format.toLowerCase()}`; - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - URL.revokeObjectURL(url); - } else { - throw new Error('Failed to create blob'); - } - }, - mimeType, - imageQuality - ); - - } catch (error) { console.error('Export error:', error); throw error; @@ -232,6 +233,16 @@ export function Navbar() { )} + + @@ -379,6 +390,16 @@ export function Navbar() { )}
+ + + {isMobile ? (