Make it look decent on mobile

This commit is contained in:
Greg Shuflin 2025-02-06 02:17:57 -08:00
parent 8d15df1af7
commit 8ab86bb6c8
3 changed files with 98 additions and 5 deletions

View File

@ -6,11 +6,72 @@
padding: 20px; padding: 20px;
box-shadow: 2px 0 5px rgba(0,0,0,0.3); box-shadow: 2px 0 5px rgba(0,0,0,0.3);
overflow-y: auto; overflow-y: auto;
transition: transform 0.3s ease;
}
.sidebar-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
}
.sidebar-close {
display: none;
background: none;
border: none;
color: var(--text-color);
cursor: pointer;
padding: 0.5rem;
font-size: 1.2rem;
}
.hamburger-menu {
display: none;
background: none;
border: none;
color: var(--text-color);
cursor: pointer;
padding: 0.5rem;
font-size: 1.2rem;
margin-right: 0.5rem;
}
/* Hover effect for both hamburger and close buttons */
.hamburger-menu:hover,
.sidebar-close:hover {
color: var(--primary-red);
}
@media (max-width: 768px) {
.sidebar {
position: fixed;
top: 0;
left: 0;
z-index: 1000;
transform: translateX(-100%);
}
.sidebar.active {
transform: translateX(0);
}
.sidebar-close {
display: block;
}
.hamburger-menu {
display: block;
}
body.with-sidebar {
display: block;
}
} }
.sidebar h2 { .sidebar h2 {
color: var(--primary-red); color: var(--primary-red);
margin-top: 0; margin: 0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;

View File

@ -1,3 +1,29 @@
// Add at the beginning of the file
document.addEventListener('DOMContentLoaded', function() {
// Mobile menu functionality
const hamburgerMenu = document.getElementById('hamburgerMenu');
const sidebarClose = document.getElementById('sidebarClose');
const sidebar = document.getElementById('sidebar');
function toggleSidebar() {
sidebar.classList.toggle('active');
}
hamburgerMenu.addEventListener('click', toggleSidebar);
sidebarClose.addEventListener('click', toggleSidebar);
// Close sidebar when clicking outside on mobile
document.addEventListener('click', function(event) {
const isMobile = window.innerWidth <= 768;
if (isMobile &&
!sidebar.contains(event.target) &&
!hamburgerMenu.contains(event.target) &&
sidebar.classList.contains('active')) {
sidebar.classList.remove('active');
}
});
});
// Fetch and display feeds // Fetch and display feeds
async function fetchFeeds() { async function fetchFeeds() {
try { try {

View File

@ -35,16 +35,22 @@
</article> </article>
</dialog> </dialog>
<aside class="sidebar"> <aside class="sidebar" id="sidebar">
<h2> <div class="sidebar-header">
Feeds <h2>Feeds</h2>
</h2> <button class="sidebar-close" id="sidebarClose">
<i class="fas fa-times"></i>
</button>
</div>
<nav id="feedList"> <nav id="feedList">
</nav> </nav>
</aside> </aside>
<div class="main-content-area"> <div class="main-content-area">
<header class="top-bar"> <header class="top-bar">
<button class="hamburger-menu" id="hamburgerMenu">
<i class="fas fa-bars"></i>
</button>
<button class="add-feed-button" id="addFeedButton" title="Add Feed"> <button class="add-feed-button" id="addFeedButton" title="Add Feed">
<i class="fas fa-plus"></i> <i class="fas fa-plus"></i>
</button> </button>