Spaces:
Running
Running
| class CustomAdPreview extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| width: 100%; | |
| } | |
| .ad-container { | |
| background: white; | |
| border-radius: 12px; | |
| overflow: hidden; | |
| transition: all 0.3s ease; | |
| } | |
| .ad-container:hover { | |
| transform: scale(1.02); | |
| } | |
| </style> | |
| <div class="card-hover"> | |
| <div class="flex items-center justify-between mb-4"> | |
| <h3 class="text-xl font-semibold">Creative Preview</h3> | |
| <button class="p-2 rounded-lg hover:bg-gray-700 transition-colors"> | |
| <i data-feather="refresh-cw" class="w-4 h-4"></i> | |
| </button> | |
| </div> | |
| <div class="ad-container shadow-2xl"> | |
| <!-- Ad Image --> | |
| <div class="h-48 bg-gradient-to-br from-blue-400 to-purple-500 relative overflow-hidden"> | |
| <img src="http://static.photos/finance/640x360/42" alt="Ad Creative" class="w-full h-full object-cover"> | |
| <div class="absolute top-4 right-4 bg-black bg-opacity-50 text-white px-2 py-1 rounded text-xs"> | |
| Image Ad | |
| </div> | |
| </div> | |
| <!-- Ad Content --> | |
| <div class="p-4 text-gray-900"> | |
| <h4 class="font-bold text-lg mb-2">Get Your Auto Insurance Quote Today!</h4> | |
| <p class="text-sm text-gray-600 mb-3"> | |
| Compare rates from top providers. Save up to $500 annually on your auto insurance. | |
| </p> | |
| <div class="flex items-center justify-between text-xs text-gray-500"> | |
| <span>Sponsored • Quora Ads</span> | |
| <button class="bg-blue-600 text-white px-3 py-1 rounded hover:bg-blue-700 transition-colors"> | |
| Learn More | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Ad URL Preview --> | |
| <div class="px-4 py-3 bg-gray-100 border-t"> | |
| <div class="text-xs text-gray-600 truncate"> | |
| example.com/auto-insurance | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mt-4 text-center text-gray-400 text-sm"> | |
| <p>This is how your ad appears to users on Quora</p> | |
| </div> | |
| <!-- Quick Actions --> | |
| <div class="mt-6 grid grid-cols-2 gap-3"> | |
| <button class="flex items-center justify-center space-x-2 p-3 bg-gray-800 rounded-lg hover:bg-gray-700 transition-colors"> | |
| <i data-feather="eye" class="w-4 h-4"></i> | |
| <span>View Full</span> | |
| </button> | |
| <button class="flex items-center justify-center space-x-2 p-3 bg-blue-600 rounded-lg hover:bg-blue-700 transition-colors"> | |
| <i data-feather="external-link" class="w-4 h-4"></i> | |
| <span>Test URL</span> | |
| </button> | |
| </div> | |
| </div> | |
| `; | |
| setTimeout(() => { | |
| if (this.shadowRoot.querySelector('[data-feather]')) { | |
| feather.replace(); | |
| } | |
| }, 100); | |
| } | |
| } | |
| customElements.define('custom-ad-preview', CustomAdPreview); |