Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
waheeb71 authored Sep 4, 2024
1 parent a6fb78b commit b65b8e5
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PDF Viewer</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>PDF Viewer</h1>
<ul id="pdf-list"></ul>
</div>

<script src="script.js"></script>
</body>
</html>
21 changes: 21 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
document.addEventListener("DOMContentLoaded", function() {
const pdfList = document.getElementById("pdf-list");

// Fetch the list of PDF files from the API
fetch("https://fastapi-wt2k.onrender.com/pdfs/")
.then(response => response.json())
.then(data => {
const pdfFiles = data.pdf_files;
pdfFiles.forEach(file => {
const listItem = document.createElement("li");
const link = document.createElement("a");
link.href = `https://fastapi-wt2k.onrender.com/pdfs/${file}`;
link.textContent = file;
listItem.appendChild(link);
pdfList.appendChild(listItem);
});
})
.catch(error => {
console.error("Error fetching PDF files:", error);
});
});
41 changes: 41 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
}

h1 {
margin-bottom: 20px;
}

ul {
list-style-type: none;
padding: 0;
}

li {
margin: 10px 0;
}

a {
text-decoration: none;
color: #007bff;
font-weight: bold;
}

a:hover {
text-decoration: underline;
}

0 comments on commit b65b8e5

Please sign in to comment.