Compare commits

...

2 Commits

Author SHA1 Message Date
d6439e36d7 feat: Finished initial individual post layout
All checks were successful
Deploy Blog to Folder / deploy (push) Successful in 5s
2025-08-22 23:20:15 -04:00
abb4861389 feat: Finished all blog posts layout page 2025-08-22 22:47:43 -04:00
20 changed files with 134 additions and 66 deletions

View File

@ -2,6 +2,25 @@
margin-bottom: 2rem;
}
.post-layout {
display: flex;
flex-direction: column;
}
.post-layout main {
flex: 1;
}
.post-layout main .thumbnail {
width: 100%;
height: 375px;
object-fit: contain;
object-position: center;
}
.post-layout main > div {
background-color: rgba(255, 255, 255, .71);
padding: 2rem;
height: 100%;
}
.posts {
display: grid;
grid-template-columns: 1fr;
@ -9,13 +28,32 @@
grid-column-gap: 2rem;
grid-row-gap: 2rem;
}
.posts > a {
text-decoration: none;
color: rgba(var(--black), .76);
}
.posts > div {
width: 100%;
}
.post-card {
background-color: white;
border-radius: 1rem;
box-shadow: 0 2px 4px rgba(var(--black), .21);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.post-card:hover {
transform: translate(-4px, -4px); /* Up and left by 4px */
box-shadow: 0 8px 16px rgba(var(--black), 0.3); /* deeper shadow for “lifted” look */
}
.post-card > img {
width: 100%;
object-fit: cover;
object-position: center;
border-top-left-radius: 1rem;
border-top-right-radius: 1rem;
}
.post-card .post-body {
padding: 2rem;
}
@media (min-width: 992px) {

38
public/js/navbar.js Normal file
View File

@ -0,0 +1,38 @@
const mobileNav = document.getElementById('mobile-nav');
function toggleMobileNav() {
if (mobileNav.classList.contains('show')) {
removeBackdrop()
} else {
const backdrop = document.createElement('div');
backdrop.className = 'mobile-nav-backdrop';
document.body.appendChild(backdrop);
backdrop.addEventListener('click', () => {
mobileNav.classList.remove('show');
removeBackdrop();
});
setTimeout(() => backdrop.classList.add('show'), 10);
}
mobileNav.classList.toggle('show');
}
function removeBackdrop() {
const backdrop = document.querySelector('.mobile-nav-backdrop');
if (backdrop) {
backdrop.classList.remove('show');
setTimeout(() => {
backdrop.remove();
}, 250);
}
}
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape') {
if (mobileNav.classList.contains('show')) {
mobileNav.classList.remove('show');
removeBackdrop();
}
}
});
document.getElementById('mobile-nav-btn').addEventListener('click', toggleMobileNav);
document.getElementById('mobile-nav-close-btn').addEventListener('click', toggleMobileNav);

View File

@ -1,2 +1,3 @@
<script type="module" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
<script nomodule src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
<script src="/js/navbar.js"></script>

View File

@ -23,46 +23,5 @@
</footer>
{% include "components/scripts.liquid" %}
<script>
// TODO: move to script file
const mobileNav = document.getElementById('mobile-nav');
function toggleMobileNav() {
if (mobileNav.classList.contains('show')) {
removeBackdrop()
} else {
const backdrop = document.createElement('div');
backdrop.className = 'mobile-nav-backdrop';
document.body.appendChild(backdrop);
backdrop.addEventListener('click', () => {
mobileNav.classList.remove('show');
removeBackdrop();
});
setTimeout(() => backdrop.classList.add('show'), 10);
}
mobileNav.classList.toggle('show');
}
function removeBackdrop() {
const backdrop = document.querySelector('.mobile-nav-backdrop');
if (backdrop) {
backdrop.classList.remove('show');
setTimeout(() => {
backdrop.remove();
}, 250);
}
}
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape') {
if (mobileNav.classList.contains('show')) {
mobileNav.classList.remove('show');
removeBackdrop();
}
}
});
document.getElementById('mobile-nav-btn').addEventListener('click', toggleMobileNav);
document.getElementById('mobile-nav-close-btn').addEventListener('click', toggleMobileNav);
</script>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% include "components/meta-tags.liquid" %}
{% include "components/headers.liquid" %}
<link rel="stylesheet" href="/css/posts.css">
<title>{{ title | default: metadata.title }} - Cyper's Blog</title>
</head>
<body class="post-layout">
<header>
{% include "components/navbars.liquid" %}
</header>
<main>
<div class="container">
<h1>{{ title }}</h1>
<p class="timestamp">{{ date | date: "%B %-d, %Y" }}</p>
<img class="thumbnail" src="{{ thumbnail }}">
{{ content }}
</div>
</main>
<footer>
{% include "components/footer.liquid" %}
</footer>
{% include "components/scripts.liquid" %}
</body>
</html>

View File

@ -31,7 +31,7 @@ css: about.css
help even one person or introduce a new perspective to someone, then this blog has served its purpose and I can be happy.
</p>
<p>
While this blog isn't my "safe space" per se, it is a place where I will express my unfiltered thoughts and opinions. I encourage everyone else to do the same, and to please be respectful of others' opinions while doing so.
This blog is a place where I will express my unfiltered thoughts and opinions. I encourage everyone else to do the same, and to please be respectful of others' opinions while doing so.
</p>
</div>
</div>

View File

@ -1,7 +1,7 @@
---
title: Example post 1
date: 2025-08-01
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
First post! Content change

View File

@ -1,7 +1,7 @@
---
title: Example post 10
date: 2025-08-10
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 3
date: 2025-08-11
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 12
date: 2025-08-12
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 2 - for Paz
date: 2025-08-02
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 3
date: 2025-08-03
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 4
date: 2025-08-04
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 5
date: 2025-08-05
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 6
date: 2025-08-06
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 7
date: 2025-08-07
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 8
date: 2025-08-08
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,7 +1,7 @@
---
title: Example post 9
date: 2025-08-09
thumbnail: https://dummyimage.com/1280x720/fff/aaa
thumbnail: https://dummyimage.com/1280x720/ccc/fff
---
Second post!

View File

@ -1,4 +1,4 @@
{
"layout": "layout.liquid",
"layout": "post-layout.liquid",
"tags": "posts"
}

View File

@ -18,17 +18,19 @@ css: posts.css
</div>
<div class="container posts">
{% for post in pagination.items %}
<div class="post-card">
{% if post.data.thumbnail %}
<img src="{{ post.data.thumbnail }}" alt="{{ post.data.title }}" />
{% endif %}
<div class="post-body">
<p class="post-date">{{ post.date | date: "%B %-d, %Y" }}</p>
<h1>{{ post.data.title }}</h1>
<p>{{ post.data.context }}</p>
<!-- <p>Views {} | Likes {}</p> -->
<a href="{{ post.url }}">
<div class="post-card">
{% if post.data.thumbnail %}
<img src="{{ post.data.thumbnail }}" alt="{{ post.data.title }}" />
{% endif %}
<div class="post-body">
<p class="post-date">{{ post.date | date: "%B %-d, %Y" }}</p>
<h1>{{ post.data.title }}</h1>
<p>{{ post.data.context }}</p>
<!-- <p>Views {} | Likes {}</p> -->
</div>
</div>
</div>
</a>
{% endfor %}
</div>
</div>