Fashion Blog Post Generator
Create a chic first draft of your fashion article in seconds.
Review your generated blog post below. You can copy the text or download it as a PDF.
${content}
`; }).join(''); // 4. Generate Conclusion post.conclusion = `Ultimately, ${data.postTopic.toLowerCase()} is your personal style signature. It's about experimenting, having fun, and finding the pieces that make you feel like the best version of yourself. Use these tips as a starting point, but never be afraid to break the mold and create a look that is entirely your own.`; generatedPostHTML = `${post.title}
${post.intro}
${post.body}Final Thoughts
${post.conclusion}
`; elements.outputContainer.innerHTML = generatedPostHTML; }; const handleDownloadPdf = () => { const { jsPDF } = window.jspdf; if (!jsPDF) { console.error("jsPDF is not loaded."); return; } const data = getFormData(); const doc = new jsPDF({ orientation: 'portrait', unit: 'in', format: 'letter' }); const tempDiv = document.createElement('div'); tempDiv.innerHTML = generatedPostHTML; const margin = 0.75; const pageWidth = doc.internal.pageSize.getWidth(); const usableWidth = pageWidth - (margin * 2); let currentY = margin; // PDF Header Decoration doc.setFillColor('#fdf4ff'); // fuchsia-50 doc.rect(0, 0, pageWidth, 1.5, 'F'); doc.setDrawColor('#c026d3'); // fuchsia-600 doc.setLineWidth(0.01); doc.line(margin, 1.4, pageWidth - margin, 1.4); // Title doc.setFont('times', 'bold'); doc.setFontSize(24); doc.setTextColor('#581c87'); // purple-900 const titleText = tempDiv.querySelector('h2').innerText; const titleLines = doc.splitTextToSize(titleText, usableWidth); doc.text(titleLines, pageWidth / 2, 0.8, { align: 'center' }); currentY = 1.8; // Body Content doc.setFont('times', 'normal'); doc.setFontSize(12); doc.setTextColor('#374151'); // gray-700 doc.setLineHeightFactor(1.5); Array.from(tempDiv.children).forEach(el => { if (el.tagName === 'H2') return; // Skip title if (currentY > 10) { doc.addPage(); currentY = margin; } let text = el.innerText || el.textContent || ''; if (el.tagName === 'H3') { currentY += 0.2; doc.setFont('times', 'bold'); doc.setFontSize(16); doc.setTextColor('#86198f'); // fuchsia-800 doc.text(text, margin, currentY); doc.setFont('times', 'normal'); doc.setFontSize(12); currentY += 0.35; } else if (el.tagName === 'P') { const pLines = doc.splitTextToSize(text, usableWidth); doc.text(pLines, margin, currentY); currentY += (pLines.length * 0.27); } }); doc.save('Fashion-Blog-Post.pdf'); }; // --- Event Listeners --- elements.tabDefine.addEventListener('click', () => switchTab('define')); elements.tabReview.addEventListener('click', () => switchTab('review')); elements.nextBtn.addEventListener('click', () => currentTab === 'define' && switchTab('review')); elements.prevBtn.addEventListener('click', () => currentTab === 'review' && switchTab('define')); elements.downloadPdfBtn.addEventListener('click', handleDownloadPdf); });