Stitch-styled PDF viewer + .icon-btn helper for modal icon buttons

The Anzeigen / Download / Löschen icons inside the documents modal
and the close X of every modal sit outside <table>, so the previous
"table button" reset didn't reach them — the global blue button
styling shone through.

- Introduce a generic `.icon-btn` class that mirrors the table reset
  (transparent background, no padding, inherit colour). The reset
  rule is now `table button, .icon-btn`.
- Tag the documents modal close button and the view/download/delete
  buttons inside each document card with `icon-btn`. Tailwind classes
  (`text-outline hover:text-primary` etc.) still win for colour.
- Rebuild the PDF viewer modal in Stitch style: clean white card,
  light header with picture_as_pdf glyph + title, body on a soft grey
  surface, footer with chevron navigation buttons and zoom icons.
  Toggle hidden/flex instead of the legacy `.show` class. Removed the
  matching .pdf-viewer-* / .pdf-nav-btn / .pdf-zoom-btn CSS that no
  longer applies.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kerimatilganandClaude Opus 4.7 committed 2026-05-15 18:13:50 +02:00
1 parent 40bd1b8009
commit 45c0c0047f
2 files changed
+56 -157

No files matched your search

+47 -152
View File
@@ -156,11 +156,13 @@
box-shadow: inset 0 -2px 0 0 #b4c5ff; box-shadow: inset 0 -2px 0 0 #b4c5ff;
} }
/* Buttons inside data tables are icon-only by default in the new /* Reset for icon-only buttons (table actions, modal close,
Stitch style. The legacy `button { background, padding, color }` pdf zoom). The legacy global `button { background, padding,
rules would otherwise turn them into solid blue blobs — class- color }` would otherwise turn them into solid blue blobs.
level Tailwind utilities still win for explicit backgrounds. */ Tailwind utilities like `bg-primary` still win since they
table button { share class specificity but come later in the cascade. */
table button,
.icon-btn {
background: transparent; background: transparent;
color: inherit; color: inherit;
padding: 0; padding: 0;
@@ -650,141 +652,15 @@
} }
/* PDF Viewer Styles */ /* PDF Viewer Styles */
.pdf-viewer-modal { /* PDF viewer modal now styled with Tailwind in the markup.
display: none; Only keep the canvas container neutral so the PDF page stands
position: fixed; out against the body background. */
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.8);
z-index: 3000;
animation: fadeIn 0.3s ease;
}
.pdf-viewer-modal.show {
display: flex;
align-items: center;
justify-content: center;
}
.pdf-viewer-content {
background: white;
border-radius: 12px;
width: 90%;
height: 90%;
max-width: 1200px;
max-height: 800px;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
animation: slideIn 0.3s ease;
display: flex;
flex-direction: column;
}
.pdf-viewer-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 15px 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.pdf-viewer-title {
font-size: 18px;
font-weight: 600;
margin: 0;
}
.pdf-viewer-close {
background: none;
border: none;
color: white;
font-size: 24px;
cursor: pointer;
width: 30px;
height: 30px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.3s ease;
}
.pdf-viewer-close:hover {
background: rgba(255, 255, 255, 0.2);
}
.pdf-viewer-body {
flex: 1;
overflow: auto;
padding: 20px;
background: #f5f5f5;
}
.pdf-canvas-container { .pdf-canvas-container {
text-align: center; text-align: center;
background: white; background: white;
border-radius: 8px; border-radius: 8px;
padding: 20px; padding: 16px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1); box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.pdf-controls {
background: white;
padding: 15px;
border-top: 1px solid #ddd;
display: flex;
justify-content: center;
align-items: center;
gap: 15px;
}
.pdf-nav-btn {
background: #3498db;
color: white;
border: none;
padding: 8px 16px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
transition: background 0.3s ease;
}
.pdf-nav-btn:hover {
background: #2980b9;
}
.pdf-nav-btn:disabled {
background: #bdc3c7;
cursor: not-allowed;
}
.pdf-page-info {
font-size: 14px;
color: #2c3e50;
font-weight: 500;
}
.pdf-zoom-controls {
display: flex;
align-items: center;
gap: 10px;
}
.pdf-zoom-btn {
background: #27ae60;
color: white;
border: none;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
}
.pdf-zoom-btn:hover {
background: #219a52;
} }
/* Enhanced Tarifoptionen Styling */ /* Enhanced Tarifoptionen Styling */
@@ -1862,7 +1738,7 @@
<span class="material-symbols-outlined text-primary">description</span> <span class="material-symbols-outlined text-primary">description</span>
<h3 class="text-title-sm text-on-surface">Dokumente</h3> <h3 class="text-title-sm text-on-surface">Dokumente</h3>
</div> </div>
<button onclick="closeDocumentsModal()" class="text-outline hover:text-on-surface transition-colors" title="Schließen"> <button onclick="closeDocumentsModal()" class="icon-btn text-outline hover:text-on-surface transition-colors" title="Schließen">
<span class="material-symbols-outlined">close</span> <span class="material-symbols-outlined">close</span>
</button> </button>
</div> </div>
@@ -1883,27 +1759,46 @@
</div> </div>
<!-- PDF Viewer Modal --> <!-- PDF Viewer Modal -->
<div id="pdfViewerModal" class="pdf-viewer-modal"> <div id="pdfViewerModal" class="pdf-viewer-modal fixed inset-0 z-[1100] hidden items-center justify-center bg-black/50 p-margin">
<div class="pdf-viewer-content"> <div class="bg-surface-container-lowest rounded-xl shadow-[0_10px_30px_rgba(0,0,0,0.25)] border border-outline-variant/30 w-full max-w-[1100px] h-[90vh] flex flex-col overflow-hidden">
<div class="pdf-viewer-header"> <div class="flex items-center justify-between px-lg py-md border-b border-outline-variant">
<h3 class="pdf-viewer-title" id="pdfViewerTitle">📋 PDF Viewer</h3> <div class="flex items-center gap-sm min-w-0">
<button class="pdf-viewer-close" onclick="closePdfViewer()">&times;</button> <span class="material-symbols-outlined text-primary shrink-0">picture_as_pdf</span>
<h3 class="text-title-sm text-on-surface truncate" id="pdfViewerTitle">PDF Viewer</h3>
</div> </div>
<div class="pdf-viewer-body"> <button onclick="closePdfViewer()" class="icon-btn text-outline hover:text-on-surface transition-colors" title="Schließen">
<span class="material-symbols-outlined">close</span>
</button>
</div>
<div class="flex-1 overflow-auto bg-surface-container-low/50 flex items-start justify-center p-md">
<div class="pdf-canvas-container"> <div class="pdf-canvas-container">
<canvas id="pdfCanvas"></canvas> <canvas id="pdfCanvas"></canvas>
</div> </div>
</div> </div>
<div class="pdf-controls"> <div class="flex items-center justify-between gap-md px-lg py-md border-t border-outline-variant bg-surface-container-low/50">
<button class="pdf-nav-btn" id="prevPageBtn" onclick="prevPage()">◀ Vorherige</button> <div class="flex items-center gap-sm">
<div class="pdf-page-info"> <button id="prevPageBtn" onclick="prevPage()"
Seite <span id="currentPage">1</span> von <span id="totalPages">1</span> class="bg-surface-container-high text-on-surface border border-outline-variant hover:bg-surface-variant transition-colors rounded-lg px-md py-sm text-body-sm flex items-center gap-xs disabled:opacity-50 disabled:cursor-not-allowed">
<span class="material-symbols-outlined text-[18px]">chevron_left</span>
Vorherige
</button>
<span class="text-body-sm text-on-surface-variant">
Seite <span id="currentPage" class="font-label-numeric text-on-surface">1</span> von <span id="totalPages" class="font-label-numeric text-on-surface">1</span>
</span>
<button id="nextPageBtn" onclick="nextPage()"
class="bg-surface-container-high text-on-surface border border-outline-variant hover:bg-surface-variant transition-colors rounded-lg px-md py-sm text-body-sm flex items-center gap-xs disabled:opacity-50 disabled:cursor-not-allowed">
Nächste
<span class="material-symbols-outlined text-[18px]">chevron_right</span>
</button>
</div> </div>
<button class="pdf-nav-btn" id="nextPageBtn" onclick="nextPage()">Nächste ▶</button> <div class="flex items-center gap-sm">
<div class="pdf-zoom-controls"> <button onclick="zoomOut()" class="icon-btn text-outline hover:text-primary transition-colors p-1" title="Verkleinern">
<button class="pdf-zoom-btn" onclick="zoomOut()">-</button> <span class="material-symbols-outlined text-[22px]">remove</span>
<span id="zoomLevel">100%</span> </button>
<button class="pdf-zoom-btn" onclick="zoomIn()">+</button> <span id="zoomLevel" class="font-label-numeric text-label-numeric text-on-surface min-w-[48px] text-center">100%</span>
<button onclick="zoomIn()" class="icon-btn text-outline hover:text-primary transition-colors p-1" title="Vergrößern">
<span class="material-symbols-outlined text-[22px]">add</span>
</button>
</div> </div>
</div> </div>
</div> </div>
+9 -5
View File
@@ -825,15 +825,15 @@ async function showDocuments(schaltungId) {
</div> </div>
<div class="flex items-center gap-xs shrink-0"> <div class="flex items-center gap-xs shrink-0">
${showView ? `<button data-doc-action="view" data-id="${doc.id}" data-name="${safeName}" title="Anzeigen" ${showView ? `<button data-doc-action="view" data-id="${doc.id}" data-name="${safeName}" title="Anzeigen"
class="text-outline hover:text-primary transition-colors p-1"> class="icon-btn text-outline hover:text-primary transition-colors p-1">
<span class="material-symbols-outlined text-[20px]">visibility</span> <span class="material-symbols-outlined text-[20px]">visibility</span>
</button>` : ''} </button>` : ''}
<button data-doc-action="download" data-id="${doc.id}" title="Download" <button data-doc-action="download" data-id="${doc.id}" title="Download"
class="text-outline hover:text-primary transition-colors p-1"> class="icon-btn text-outline hover:text-primary transition-colors p-1">
<span class="material-symbols-outlined text-[20px]">download</span> <span class="material-symbols-outlined text-[20px]">download</span>
</button> </button>
<button data-doc-action="delete" data-id="${doc.id}" data-name="${safeName}" data-schaltung-id="${schaltungId}" title="Löschen" <button data-doc-action="delete" data-id="${doc.id}" data-name="${safeName}" data-schaltung-id="${schaltungId}" title="Löschen"
class="text-outline hover:text-error transition-colors p-1"> class="icon-btn text-outline hover:text-error transition-colors p-1">
<span class="material-symbols-outlined text-[20px]">delete</span> <span class="material-symbols-outlined text-[20px]">delete</span>
</button> </button>
</div> </div>
@@ -3487,7 +3487,9 @@ async function viewPdfDocument(documentId, filename) {
await renderPage(currentPage); await renderPage(currentPage);
// Show modal // Show modal
document.getElementById('pdfViewerModal').classList.add('show'); const m = document.getElementById('pdfViewerModal');
m.classList.remove('hidden');
m.classList.add('flex');
// Update navigation buttons // Update navigation buttons
updateNavigationButtons(); updateNavigationButtons();
@@ -3572,7 +3574,9 @@ function updateZoomLevel() {
} }
function closePdfViewer() { function closePdfViewer() {
document.getElementById('pdfViewerModal').classList.remove('show'); const m = document.getElementById('pdfViewerModal');
m.classList.add('hidden');
m.classList.remove('flex');
// Cleanup // Cleanup
currentPdf = null; currentPdf = null;