| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>SiteBuilder Pro - Create Professional Websites</title> |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <script src="https://unpkg.com/feather-icons"></script> |
| <link href="https://cdn.jsdelivr.net/npm/dragula@3.7.3/dist/dragula.min.css" rel="stylesheet"> |
| <style> |
| .builder-container { |
| display: grid; |
| grid-template-columns: 250px 1fr 250px; |
| height: 100vh; |
| } |
| .component { |
| cursor: move; |
| padding: 10px; |
| margin: 5px 0; |
| background: white; |
| border: 1px dashed #ccc; |
| border-radius: 4px; |
| } |
| .component:hover { |
| background: #f0f7ff; |
| border-color: #3b82f6; |
| } |
| .canvas { |
| background: #f8fafc; |
| min-height: 100%; |
| padding: 20px; |
| } |
| .preview-item { |
| margin-bottom: 15px; |
| position: relative; |
| } |
| .preview-item:hover { |
| outline: 2px dashed #3b82f6; |
| } |
| .remove-btn { |
| position: absolute; |
| right: 5px; |
| top: 5px; |
| background: white; |
| border-radius: 50%; |
| width: 20px; |
| height: 20px; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| cursor: pointer; |
| box-shadow: 0 1px 3px rgba(0,0,0,0.1); |
| z-index: 10; |
| } |
| </style> |
| </head> |
| <body class="bg-gray-100"> |
| <header class="bg-white shadow-sm"> |
| <div class="container mx-auto px-4 py-4 flex justify-between items-center"> |
| <div class="flex items-center space-x-3"> |
| <div class="w-10 h-10 rounded-lg bg-blue-500 flex items-center justify-center text-white"> |
| <i data-feather="globe" class="w-5 h-5"></i> |
| </div> |
| <h1 class="text-xl font-bold text-gray-800">SiteBuilder Pro</h1> |
| </div> |
| <div class="flex items-center space-x-4"> |
| <button id="preview-btn" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300"> |
| <i data-feather="eye" class="w-4 h-4 mr-2"></i> Preview |
| </button> |
| <button id="export-btn" class="px-4 py-2 bg-blue-500 text-white rounded-md hover:bg-blue-600"> |
| <i data-feather="download" class="w-4 h-4 mr-2"></i> Export |
| </button> |
| <button id="save-btn" class="px-4 py-2 bg-green-500 text-white rounded-md hover:bg-green-600"> |
| <i data-feather="save" class="w-4 h-4 mr-2"></i> Save |
| </button> |
| </div> |
| </div> |
| </header> |
|
|
| <div class="builder-container"> |
| |
| <div class="bg-white p-4 border-r overflow-y-auto"> |
| <h3 class="font-medium text-gray-700 mb-3">Components</h3> |
| <div class="space-y-2"> |
| <div class="component" draggable="true" data-type="header"> |
| <div class="flex items-center"> |
| <i data-feather="header" class="w-4 h-4 mr-2 text-blue-500"></i> |
| Header |
| </div> |
| </div> |
| <div class="component" draggable="true" data-type="hero"> |
| <div class="flex items-center"> |
| <i data-feather="image" class="w-4 h-4 mr-2 text-purple-500"></i> |
| Hero Section |
| </div> |
| </div> |
| <div class="component" draggable="true" data-type="features"> |
| <div class="flex items-center"> |
| <i data-feather="grid" class="w-4 h-4 mr-2 text-green-500"></i> |
| Features Grid |
| </div> |
| </div> |
| <div class="component" draggable="true" data-type="testimonials"> |
| <div class="flex items-center"> |
| <i data-feather="users" class="w-4 h-4 mr-2 text-yellow-500"></i> |
| Testimonials |
| </div> |
| </div> |
| <div class="component" draggable="true" data-type="contact"> |
| <div class="flex items-center"> |
| <i data-feather="mail" class="w-4 h-4 mr-2 text-red-500"></i> |
| Contact Form |
| </div> |
| </div> |
| <div class="component" draggable="true" data-type="footer"> |
| <div class="flex items-center"> |
| <i data-feather="footer" class="w-4 h-4 mr-2 text-gray-500"></i> |
| Footer |
| </div> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div id="canvas" class="canvas"> |
| <div id="preview-area"></div> |
| </div> |
|
|
| |
| <div class="bg-white p-4 border-l overflow-y-auto"> |
| <h3 class="font-medium text-gray-700 mb-3">Properties</h3> |
| <div id="properties-panel"> |
| <p class="text-gray-500 text-sm">Select a component to edit its properties</p> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div id="preview-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden"> |
| <div class="bg-white rounded-lg w-full max-w-6xl h-5/6 overflow-hidden"> |
| <div class="flex justify-between items-center p-4 border-b"> |
| <h3 class="text-lg font-medium">Preview</h3> |
| <button id="close-preview" class="text-gray-500 hover:text-gray-700"> |
| <i data-feather="x" class="w-5 h-5"></i> |
| </button> |
| </div> |
| <div class="h-full overflow-auto p-4"> |
| <iframe id="preview-iframe" class="w-full h-full border-none"></iframe> |
| </div> |
| </div> |
| </div> |
|
|
| <script src="https://cdn.jsdelivr.net/npm/dragula@3.7.3/dist/dragula.min.js"></script> |
| <script> |
| feather.replace(); |
| |
| // Initialize drag and drop |
| dragula([document.getElementById('canvas')], { |
| accepts: function(el, target) { |
| return target.id === 'canvas'; |
| } |
| }); |
| |
| // Component templates |
| const componentTemplates = { |
| header: ` |
| <header class="bg-white shadow-sm py-4 px-6"> |
| <div class="container mx-auto flex justify-between items-center"> |
| <div class="flex items-center space-x-3"> |
| <div class="w-10 h-10 rounded-lg bg-blue-500 flex items-center justify-center text-white"> |
| <i data-feather="globe" class="w-5 h-5"></i> |
| </div> |
| <h2 class="text-xl font-bold">Your Logo</h2> |
| </div> |
| <nav class="hidden md:flex space-x-6"> |
| <a href="#" class="text-gray-600 hover:text-blue-500">Home</a> |
| <a href="#" class="text-gray-600 hover:text-blue-500">About</a> |
| <a href="#" class="text-gray-600 hover:text-blue-500">Services</a> |
| <a href="#" class="text-gray-600 hover:text-blue-500">Contact</a> |
| </nav> |
| <button class="md:hidden"> |
| <i data-feather="menu" class="w-6 h-6"></i> |
| </button> |
| </div> |
| </header> |
| `, |
| hero: ` |
| <section class="bg-blue-50 py-16 px-4"> |
| <div class="container mx-auto text-center max-w-3xl"> |
| <h1 class="text-4xl font-bold text-gray-800 mb-4">Build Beautiful Websites</h1> |
| <p class="text-xl text-gray-600 mb-8">Create professional sites with our drag and drop builder</p> |
| <div class="flex justify-center space-x-4"> |
| <button class="px-6 py-3 bg-blue-500 text-white rounded-lg hover:bg-blue-600">Get Started</button> |
| <button class="px-6 py-3 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50">Learn More</button> |
| </div> |
| </div> |
| </section> |
| `, |
| features: ` |
| <section class="py-16 px-4 bg-white"> |
| <div class="container mx-auto"> |
| <h2 class="text-3xl font-bold text-center text-gray-800 mb-12">Features</h2> |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-8"> |
| <div class="bg-gray-50 p-6 rounded-lg"> |
| <div class="w-12 h-12 rounded-lg bg-blue-500 flex items-center justify-center text-white mb-4"> |
| <i data-feather="code" class="w-6 h-6"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-2">Drag & Drop</h3> |
| <p class="text-gray-600">Easily build your site with our intuitive interface</p> |
| </div> |
| <div class="bg-gray-50 p-6 rounded-lg"> |
| <div class="w-12 h-12 rounded-lg bg-purple-500 flex items-center justify-center text-white mb-4"> |
| <i data-feather="smartphone" class="w-6 h-6"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-2">Responsive</h3> |
| <p class="text-gray-600">Your site will look great on all devices</p> |
| </div> |
| <div class="bg-gray-50 p-6 rounded-lg"> |
| <div class="w-12 h-12 rounded-lg bg-green-500 flex items-center justify-center text-white mb-4"> |
| <i data-feather="zap" class="w-6 h-6"></i> |
| </div> |
| <h3 class="text-xl font-semibold mb-2">Fast Loading</h3> |
| <p class="text-gray-600">Optimized for performance and speed</p> |
| </div> |
| </div> |
| </div> |
| </section> |
| `, |
| testimonials: ` |
| <section class="py-16 px-4 bg-gray-50"> |
| <div class="container mx-auto max-w-4xl"> |
| <h2 class="text-3xl font-bold text-center text-gray-800 mb-12">What Our Customers Say</h2> |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-8"> |
| <div class="bg-white p-6 rounded-lg shadow-sm"> |
| <div class="flex items-center mb-4"> |
| <div class="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center text-blue-500 mr-4"> |
| <i data-feather="user" class="w-5 h-5"></i> |
| </div> |
| <div> |
| <h4 class="font-medium">John Smith</h4> |
| <p class="text-sm text-gray-500">CEO, Company Inc.</p> |
| </div> |
| </div> |
| <p class="text-gray-600">"This builder saved me so much time and money. Highly recommended!"</p> |
| </div> |
| <div class="bg-white p-6 rounded-lg shadow-sm"> |
| <div class="flex items-center mb-4"> |
| <div class="w-12 h-12 rounded-full bg-purple-100 flex items-center justify-center text-purple-500 mr-4"> |
| <i data-feather="user" class="w-5 h-5"></i> |
| </div> |
| <div> |
| <h4 class="font-medium">Sarah Johnson</h4> |
| <p class="text-sm text-gray-500">Marketing Director</p> |
| </div> |
| </div> |
| <p class="text-gray-600">"Incredibly easy to use and the results are professional-grade."</p> |
| </div> |
| </div> |
| </div> |
| </section> |
| `, |
| contact: ` |
| <section class="py-16 px-4 bg-white"> |
| <div class="container mx-auto max-w-2xl"> |
| <h2 class="text-3xl font-bold text-center text-gray-800 mb-8">Contact Us</h2> |
| <form class="space-y-6"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-1">Name</label> |
| <input type="text" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-blue-500 focus:border-blue-500"> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-1">Email</label> |
| <input type="email" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-blue-500 focus:border-blue-500"> |
| </div> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-1">Message</label> |
| <textarea rows="4" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-blue-500 focus:border-blue-500"></textarea> |
| </div> |
| <button type="submit" class="w-full py-3 bg-blue-500 text-white rounded-md hover:bg-blue-600">Send Message</button> |
| </form> |
| </div> |
| </section> |
| `, |
| footer: ` |
| <footer class="bg-gray-800 text-white py-12 px-4"> |
| <div class="container mx-auto"> |
| <div class="grid grid-cols-1 md:grid-cols-4 gap-8"> |
| <div> |
| <h3 class="text-xl font-bold mb-4">SiteBuilder Pro</h3> |
| <p class="text-gray-400">Creating beautiful websites for everyone.</p> |
| </div> |
| <div> |
| <h4 class="font-medium mb-4">Quick Links</h4> |
| <ul class="space-y-2"> |
| <li><a href="#" class="text-gray-400 hover:text-white">Home</a></li> |
| <li><a href="#" class="text-gray-400 hover:text-white">About</a></li> |
| <li><a href="#" class="text-gray-400 hover:text-white">Features</a></li> |
| <li><a href="#" class="text-gray-400 hover:text-white">Pricing</a></li> |
| </ul> |
| </div> |
| <div> |
| <h4 class="font-medium mb-4">Resources</h4> |
| <ul class="space-y-2"> |
| <li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li> |
| <li><a href="#" class="text-gray-400 hover:text-white">Documentation</a></li> |
| <li><a href="#" class="text-gray-400 hover:text-white">Support</a></li> |
| </ul> |
| </div> |
| <div> |
| <h4 class="font-medium mb-4">Connect</h4> |
| <div class="flex space-x-4"> |
| <a href="#" class="text-gray-400 hover:text-white"><i data-feather="facebook" class="w-5 h-5"></i></a> |
| <a href="#" class="text-gray-400 hover:text-white"><i data-feather="twitter" class="w-5 h-5"></i></a> |
| <a href="#" class="text-gray-400 hover:text-white"><i data-feather="instagram" class="w-5 h-5"></i></a> |
| <a href="#" class="text-gray-400 hover:text-white"><i data-feather="linkedin" class="w-5 h-5"></i></a> |
| </div> |
| </div> |
| </div> |
| <div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400"> |
| <p>© 2023 SiteBuilder Pro. All rights reserved.</p> |
| </div> |
| </div> |
| </footer> |
| ` |
| }; |
| |
| // Add components to canvas |
| document.querySelectorAll('.component').forEach(component => { |
| component.addEventListener('dragstart', function(e) { |
| e.dataTransfer.setData('text/plain', this.getAttribute('data-type')); |
| }); |
| }); |
| |
| const canvas = document.getElementById('canvas'); |
| const previewArea = document.getElementById('preview-area'); |
| |
| canvas.addEventListener('dragover', function(e) { |
| e.preventDefault(); |
| }); |
| |
| canvas.addEventListener('drop', function(e) { |
| e.preventDefault(); |
| const componentType = e.dataTransfer.getData('text/plain'); |
| if (componentType) { |
| const newComponent = document.createElement('div'); |
| newComponent.className = 'preview-item'; |
| newComponent.innerHTML = ` |
| <div class="remove-btn"> |
| <i data-feather="x" class="w-3 h-3"></i> |
| </div> |
| ${componentTemplates[componentType]} |
| `; |
| previewArea.appendChild(newComponent); |
| feather.replace(); |
| |
| // Add click event to remove button |
| newComponent.querySelector('.remove-btn').addEventListener('click', function() { |
| newComponent.remove(); |
| }); |
| } |
| }); |
| |
| // Preview functionality |
| const previewBtn = document.getElementById('preview-btn'); |
| const previewModal = document.getElementById('preview-modal'); |
| const closePreview = document.getElementById('close-preview'); |
| const previewIframe = document.getElementById('preview-iframe'); |
| |
| previewBtn.addEventListener('click', function() { |
| previewIframe.srcdoc = ` |
| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <script src="https://unpkg.com/feather-icons"></script> |
| <title>Preview</title> |
| </head> |
| <body> |
| ${previewArea.innerHTML} |
| <script>feather.replace();</script> |
| </body> |
| </html> |
| `; |
| previewModal.classList.remove('hidden'); |
| }); |
|
|
| closePreview.addEventListener('click', function() { |
| previewModal.classList.add('hidden'); |
| }); |
|
|
| // Export functionality |
| document.getElementById('export-btn').addEventListener('click', function() { |
| const htmlContent = ` |
| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Your Website</title> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <script src="https://unpkg.com/feather-icons"></script> |
| </head> |
| <body> |
| ${previewArea.innerHTML} |
| <script>feather.replace();</script> |
| </body> |
| </html> |
| `; |
|
|
| const blob = new Blob([htmlContent], {type: 'text/html'}); |
| const url = URL.createObjectURL(blob); |
| const a = document.createElement('a'); |
| a.href = url; |
| a.download = 'website.html'; |
| document.body.appendChild(a); |
| a.click(); |
| document.body.removeChild(a); |
| URL.revokeObjectURL(url); |
| }); |
|
|
| // Save functionality |
| document.getElementById('save-btn').addEventListener('click', function() { |
| alert('Website saved successfully! (In a real app, this would save to your account)'); |
| }); |
| </script> |
| </body> |
| </html> |