Fixed nested comment layout

This commit is contained in:
Your Name committed 2025-04-27 19:03:55 +08:00
1 parent d6c636e576
commit 906f35100e
1 file changed
+216 -81
+216 -81
View File
@@ -7,57 +7,80 @@
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<title>Post - Behind the Desk</title> <title>Post - Behind the Desk</title>
<style> <style>
/* Add specific styles for single-post page if needed */
.single-post-container { .single-post-container {
max-width: 450px; /* Increased width for longer fields */ max-width: 600px;
margin-top: 2rem; margin-top: 2rem;
} }
.single-post-container h2 { .comment-section {
font-size: 1.2rem; margin-top: 2rem;
margin-bottom: 1rem;
color: #38315f; /* Updated text color */
} }
.single-post-container .field { .comment {
margin-bottom: 0.75rem; margin-top: 1.5rem;
padding-left: 0;
font-size: 0.9rem; /* Smaller text for comments */
} }
.single-post-container .label { .nested-comment {
margin-left: 1.5rem;
margin-top: 1rem;
border-left: 2px solid #ddd;
padding-left: 1rem;
font-size: 0.9rem; font-size: 0.9rem;
font-weight: normal;
color: #38315f; /* Updated text color */
margin-bottom: 0.25rem;
display: inline-block; /* HN style labels */
width: 100px; /* Align inputs */
} }
.single-post-container .input, .comment-header small.reply {
.single-post-container .textarea, text-decoration: underline;
.single-post-container .select select { font-size: 0.75rem;
cursor: pointer;
margin-left: 0.5rem;
display: inline-block;
}
.comment-header a.nav-link {
font-size: 0.75rem;
margin-left: 0.5rem;
text-decoration: underline;
color: #38315f;
}
.comment-header a.nav-link:hover {
color: #2d274a;
}
.upvote-arrow {
font-size: 0.9rem; font-size: 0.9rem;
max-width: 250px; /* Increased max-width for longer fields */ margin-right: 0.5rem;
display: inline-block; /* Align with label */ color: #6c757d;
width: calc(100% - 110px); /* Adjust width */
background-color: #ffffff; /* Ensure white background */
color: #363636; /* Default input text color */
border: 1px solid #dbdbdb; /* Standard Bulma border */
} }
.single-post-container .input:focus, .upvote-arrow:hover {
.single-post-container .textarea:focus, color: #ff6600;
.single-post-container .select select:focus {
border-color: #38315f; /* Highlight focus */
box-shadow: 0 0 0 0.125em rgba(56, 49, 95, 0.25);
} }
.single-post-container .button.is-primary { /* Target the specific button */ .reply-box {
margin-left: 2rem;
margin-top: 1rem;
}
.reply-box textarea {
margin-bottom: 0.5rem;
background-color: #f8f9fa;
border: 1px solid #dbdbdb;
font-size: 0.9rem; font-size: 0.9rem;
margin-left: 100px; /* Align button with inputs */
margin-top: 0.5rem;
background-color: #38315f; /* Updated button color */
color: #ffffff; /* White text for contrast */
border-color: transparent; /* Remove default border */
} }
.single-post-container .button.is-primary:hover { .comments-list {
background-color: #2d274a; /* Slightly darker on hover */ margin-top: 1rem;
} }
.single-post-container .select { .comment-header {
margin-left: auto; /* Align dropdown to the right */ margin-bottom: 0.3rem;
}
.comment-body p {
margin-bottom: 0.5rem;
}
.button.is-primary {
background-color: #38315f;
border-color: transparent;
color: #fff;
}
.button.is-primary:hover {
background-color: #2d274a;
}
textarea.textarea {
background-color: #f8f9fa;
border: 1px solid #dbdbdb;
color: #363636;
} }
</style> </style>
</head> </head>
@@ -65,39 +88,20 @@
<nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation"> <nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation">
<div class="container"> <div class="container">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item has-text-weight-bold" href="/"> <a class="navbar-item has-text-weight-bold" href="/">Behind the Desk</a>
Behind the Desk
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample"> <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span> <span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a> </a>
</div> </div>
<div id="navbarBasicExample" class="navbar-menu"> <div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start"> <div class="navbar-start">
<a class="navbar-item" href="/"> <a class="navbar-item" href="/">top 🔥</a>
top 🔥 <a class="navbar-item" href="#">new</a>
</a> <a class="navbar-item" href="#">nearby</a>
<a class="navbar-item" href="#"> <a class="navbar-item" href="#">past</a>
new <a class="navbar-item" href="#">ask</a>
</a> <a class="navbar-item" href="#">show</a>
<a class="navbar-item" href="#"> <a class="navbar-item" href="#">submit</a>
nearby
</a>
<a class="navbar-item" href="#">
past
</a>
<a class="navbar-item" href="#">
ask
</a>
<a class="navbar-item" href="#">
show
</a>
<a class="navbar-item" href="#">
submit
</a>
</div> </div>
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item"> <div class="navbar-item">
@@ -111,19 +115,20 @@
<main class="section main-content"> <main class="section main-content">
<div class="container single-post-container"> <div class="container single-post-container">
<article class="media"> <article class="media">
<div class="media-left is-align-self-flex-start pt-1"> <div class="media-left">
<a href="#" class="upvote-arrow" title="Upvote">▲</a> <a href="#" class="upvote-arrow" title="Upvote">▲</a>
</div> </div>
<div class="media-content"> <div class="media-content">
<div class="content"> <div class="content">
<p> <p>
<strong><a href="#" class="post-title">The saga of the disappearing ergonomic chair continues. <span class="update-tick">✏️</span></a></strong> <strong><a href="#" class="post-title">The saga of the disappearing ergonomic chair continues. ✏️</a></strong>
</p> </p>
<p> <p>
<small class="handle">@deskdetective</small> | <small class="time">1h ago</small> <a href="#" class="next-action">next</a> <small class="handle">@deskdetective</small> | <small class="time">1h ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
</p> </p>
<p> <p>
The saga of the disappearing ergonomic chair continues. Every time I leave my desk, it seems to vanish into thin air. I've started to suspect my colleagues are playing a prank on me. Has anyone else experienced this? Every time I leave my desk, it seems to vanish. Suspecting foul play at this point. Anyone else faced something like this?
</p> </p>
</div> </div>
</div> </div>
@@ -144,42 +149,172 @@
</div> </div>
</form> </form>
<h3>Comments</h3> <h3 class="mt-4">Comments</h3>
<div class="comments-list"> <div class="comments-list">
<!-- Example Comment 1 --> <!-- Main Comment -->
<div class="comment"> <div class="comment">
<div class="comment-header"> <div class="comment-header">
<small class="handle">@commenter1</small> <small class="time">2h ago</small> <small class="reply">reply</small> <a href="#" class="upvote-arrow">▲</a>
<small class="handle">@commenter1</small> <small class="time">2h ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div> </div>
<div class="comment-body"> <div class="comment-body">
<p>This is a comment on the post.</p> <p>Haha, this totally happened to me last year. We had a phantom chair thief at work and it became an ongoing office joke for months!</p>
</div> </div>
<!-- Nested Comment 1 -->
<!-- Nested Comment -->
<div class="nested-comment"> <div class="nested-comment">
<div class="comment-header"> <div class="comment-header">
<small class="handle">@nestedcommenter1</small> <small class="time">1h ago</small> <small class="reply">reply</small> <a href="#" class="upvote-arrow">▲</a>
<small class="handle">@nestedcommenter1</small> <small class="time">1h ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div> </div>
<div class="comment-body"> <div class="comment-body">
<p>This is a nested comment in response to the first comment.</p> <p>Did they ever catch who it was? 😂 I'd totally set up a hidden camera if it kept happening that much.</p>
</div>
<!-- Example Reply Box -->
<div class="reply-box">
<textarea class="textarea" placeholder="Reply to this comment..."></textarea>
<button class="button is-small is-primary">Reply</button>
</div> </div>
</div> </div>
</div> </div>
<!-- Example Comment 2 --> <!-- Another Comment -->
<div class="comment"> <div class="comment">
<div class="comment-header"> <div class="comment-header">
<small class="handle">@commenter2</small> <small class="time">3h ago</small> <small class="reply">reply</small> <a href="#" class="upvote-arrow">▲</a>
<small class="handle">@commenter2</small> <small class="time">3h ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div> </div>
<div class="comment-body"> <div class="comment-body">
<p>Another comment on the post.</p> <p>At my old job, chairs were so bad people would "borrow" a good one whenever someone went on vacation. A real survival of the fittest situation!</p>
</div> </div>
</div> </div>
<!-- Third Comment -->
<div class="comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@commenter3</small> <small class="time">5h ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div> </div>
<div class="comment-body">
<p>I recommend putting a bright sticker with your name on the chair. Makes it harder for people to pretend they didn't know it wasn't theirs.</p>
</div>
</div>
<!-- Main Comment -->
<div class="comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@commenter1</small> <small class="time">2h ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div>
<div class="comment-body">
<p>Haha, this totally happened to me last year. It was hilarious and annoying at the same time.</p>
</div>
<!-- Level 1 Nested Comment -->
<div class="nested-comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@nested1</small> <small class="time">1h 50m ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div>
<div class="comment-body">
<p>Honestly, office pranks can either build great vibes or cause chaos if not handled well 😂</p>
</div>
<!-- Level 2 Nested Comment -->
<div class="nested-comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@nested2</small> <small class="time">1h 40m ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div>
<div class="comment-body">
<p>Yeah, in our team it turned into an inside joke that lasted months. No HR complaints thankfully!</p>
</div>
<!-- Level 3 Nested Comment -->
<div class="nested-comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@nested3</small> <small class="time">1h 30m ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div>
<div class="comment-body">
<p>Ours got so bad management had to install chair locks (yes, seriously!).</p>
</div>
<!-- Example Reply Box -->
<div class="reply-box">
<textarea class="textarea" placeholder="Reply to this comment..."></textarea>
<button class="button is-small is-primary">Reply</button>
</div>
<!-- Level 4 Nested Comment -->
<div class="nested-comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@nested4</small> <small class="time">1h 20m ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div>
<div class="comment-body">
<p>😂 Chair locks?! That's next level commitment to stopping thefts.</p>
</div>
<!-- Level 5 Nested Comment -->
<div class="nested-comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@nested5</small> <small class="time">1h 10m ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div>
<div class="comment-body">
<p>I would LOVE to see the memo that went out announcing chair locks to employees 😆</p>
</div>
<!-- Level 6 Nested Comment -->
<div class="nested-comment">
<div class="comment-header">
<a href="#" class="upvote-arrow">▲</a>
<small class="handle">@nested6</small> <small class="time">1h 5m ago</small>
<a href="#" class="nav-link">parent</a> <a href="#" class="nav-link">next</a>
<small class="reply">reply</small>
</div>
<div class="comment-body">
<p>Imagine coming into work one day and finding your chair padlocked to the floor 😅</p>
</div>
</div>
</div> <!-- Level 5 -->
</div> <!-- Level 4 -->
</div> <!-- Level 3 -->
</div> <!-- Level 2 -->
</div> <!-- Level 1 -->
</div> <!-- Main Comment -->
</div>
</div> </div>
</div> </div>
</main> </main>
<!-- Simple script to toggle mobile menu -->
<script> <script>
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);