From a3e78aec0bb9058bb34f7963246863cfc7b6ed12 Mon Sep 17 00:00:00 2001 From: Jaydip Sanghani <91427591+jellydeck@users.noreply.github.com> Date: Fri, 8 Aug 2025 14:58:30 +0530 Subject: [PATCH] added github links --- src/components/editor/Navbar.tsx | 85 ++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 32 deletions(-) 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 ? ( -- 2.51.2