diff --git a/admin-dashboard.html b/admin-dashboard.html index 7971a03..0b31a15 100644 --- a/admin-dashboard.html +++ b/admin-dashboard.html @@ -686,7 +686,7 @@

Náhled banneru

@@ -1503,41 +1503,83 @@ function updateBannerPreview() { // Create banner content based on template let bannerContent = ''; + const bannerLink = document.getElementById('bannerLink')?.value || ''; + const bannerTextContent = bannerText || 'Náhled banneru'; if (hasImage && currentImage) { // Get image dimensions from inputs or use defaults const imageWidth = parseInt(document.getElementById('bannerImageWidth')?.value || '300'); const imageHeight = parseInt(document.getElementById('bannerImageHeight')?.value || '200'); + const imagePosition = document.getElementById('bannerImagePosition')?.value || 'right'; // Create image element with template styles and dynamic dimensions const imgStyle = ` - ${template.imageStyle || ''} + max-width: 100%; + height: auto; width: ${imageWidth}px; - height: ${imageHeight}px; - object-fit: cover; + max-height: ${imageHeight}px; + object-fit: contain; border-radius: ${template.borderRadius || '0'}px; + ${imagePosition === 'left' ? 'float: left; margin-right: 20px;' : ''} + ${imagePosition === 'right' ? 'float: right; margin-left: 20px;' : ''} + ${imagePosition === 'center' ? 'display: block; margin: 0 auto;' : ''} `; - const imgElement = ` - `; + // Create image container + let imgContainer = ` + `; + + // Wrap image with link if URL is provided + if (bannerLink) { + imgContainer = ` + + ${imgContainer} + `; + } // Create text content with template styles - const textContent = bannerText || 'Náhled banneru'; + const textStyle = ` + font-size: ${document.getElementById('bannerFontSize')?.value || '16'}px; + color: ${document.getElementById('bannerTextColor')?.value || '#000'}; + text-align: ${document.getElementById('bannerTextAlign')?.value || 'left'}; + margin: 0; + padding: 10px 0; + line-height: 1.5; + ${template.textStyle || ''} + `; + const textElement = ` -