diff --git a/static/css/styles.css b/static/css/styles.css index 32891476..e2d3e460 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -33,12 +33,6 @@ header { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } -main { - max-width: 1200px; - margin: 0 auto; - padding: 1rem; -} - footer { text-align: center; padding: 1rem; @@ -73,27 +67,6 @@ footer { outline: none; } -.search-container button, -.download-button { - padding: 0.75rem 1.5rem; - background: var(--primary-color); - color: white; - border: none; - border-radius: 4px; - cursor: pointer; - font-size: 1rem; - transition: background-color 0.3s ease; -} - -.download-button { - width: 100%; -} - -.search-container button:hover, -.download-button:hover { - background: var(--primary-dark); -} - /* Table Styles */ .table-responsive { margin-bottom: 1rem; @@ -214,7 +187,7 @@ tbody tr:hover { .details-container { background: white; - padding: 2rem; + padding: 0.25rem 0.25rem 2rem 3rem; border-radius: 4px; max-width: 800px; width: 90%; diff --git a/static/js/main.js b/static/js/main.js index b7e3b686..a8a03730 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -47,11 +47,15 @@ document.addEventListener('DOMContentLoaded', () => { }, showLoading(element) { - element.style.display = 'block'; + element.removeAttribute('hidden'); }, hideLoading(element) { - element.style.display = 'none'; + element.setAttribute('hidden', ''); + }, + + showAccordion(element) { + UIkit.accordion(element).toggle(1, true); }, async fetchJson(url, options = {}) { @@ -90,9 +94,9 @@ document.addEventListener('DOMContentLoaded', () => { try { STATE.isSearching = true; - elements.resultsSection.classList.remove('collapsed'); utils.showLoading(elements.searchLoading); + utils.showAccordion(elements.resultsSection); const data = await utils.fetchJson( `${API_ENDPOINTS.search}?query=${encodeURIComponent(query)}` ); @@ -161,12 +165,12 @@ document.addEventListener('DOMContentLoaded', () => { createActionCell(book) { const buttonDetails = utils.createElement('button', { - className: 'details-button', + className: 'uk-button uk-button-default uk-align-center uk-margin-small', onclick: () => bookDetails.show(book.id) }, [utils.createElement('span', { textContent: 'Details' })]); const downloadButton = utils.createElement('button', { - className: 'download-button', + className: 'uk-button uk-button-primary uk-align-center uk-margin-small', onclick: () => bookDetails.downloadBook(book) }, [utils.createElement('span', { textContent: 'Download' })]); @@ -221,9 +225,13 @@ document.addEventListener('DOMContentLoaded', () => { generateDetailsHTML(book) { return ` -
- Book Preview -
+ +
+
+ Book Preview + +
+

${book.title || 'No title available'}

Author: ${book.author || 'N/A'}

Publisher: ${book.publisher || 'N/A'}

@@ -232,12 +240,18 @@ document.addEventListener('DOMContentLoaded', () => {

Format: ${book.format || 'N/A'}

Size: ${book.size || 'N/A'}

+ + +
- ${this.generateInfoList(book.info)} -
- - -
+ `; }, @@ -250,7 +264,7 @@ document.addEventListener('DOMContentLoaded', () => { `) .join(''); - return ``; + return ``; }, async downloadBook(book) { @@ -263,7 +277,6 @@ document.addEventListener('DOMContentLoaded', () => { ); modal.close(); - elements.resultsSection.classList.add('collapsed'); status.fetch(); } catch (error) { console.error('Download error:', error); @@ -405,11 +418,6 @@ document.addEventListener('DOMContentLoaded', () => { } }); - // Results section toggle - elements.resultsHeading.addEventListener('click', () => { - elements.resultsSection.classList.toggle('collapsed'); - }); - // Modal close on overlay click elements.modalOverlay.addEventListener('click', (e) => { if (e.target === elements.modalOverlay) { diff --git a/templates/index.html b/templates/index.html index 4f9e470e..8722d6f6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,97 +9,108 @@ + + + + + +
-

Book Search & Download

+

Book Search & Download

- -
-
- - -
-
+
+ +
+
+ +
+
- - - - - - -
-

Download Status

-
- - Loading... -
-
- - - - - - - - - - - - -
StatusBook IDTitlePreview
-
-
-

Calibre Web Book Downloader.

+

Calibre Web Book Downloader

+