Skip to content

Commit ed4958f

Browse files
committed
留言板 2_2
1 parent 0f16268 commit ed4958f

1 file changed

Lines changed: 33 additions & 7 deletions

File tree

src/pages/guestbook/index.astro

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function getReactionEmoji(reaction: string) {
253253
.comment-item {
254254
display: flex;
255255
position: relative;
256-
padding-left: 40px; /* Space for avatar */
256+
padding-left: 40px; /* Space for avatar on desktop */
257257
margin-bottom: 1.5rem;
258258
transition: box-shadow 0.3s ease;
259259
}
@@ -268,6 +268,7 @@ function getReactionEmoji(reaction: string) {
268268
top: 0;
269269
width: 32px;
270270
height: 32px;
271+
display: block; /* Show on desktop */
271272
}
272273

273274
.user-avatar {
@@ -294,6 +295,10 @@ function getReactionEmoji(reaction: string) {
294295
flex-wrap: wrap;
295296
}
296297

298+
.comment-header .user-avatar-mobile {
299+
display: none; /* Hide on desktop */
300+
}
301+
297302
.owner-comment .comment-header {
298303
background: #e6f2ff; /* Lighter blue for admin */
299304
}
@@ -319,6 +324,18 @@ function getReactionEmoji(reaction: string) {
319324
margin-left: 4px;
320325
}
321326

327+
@media (max-width: 768px) {
328+
.owner-badge {
329+
padding: 1px 5px;
330+
}
331+
.owner-badge::before {
332+
content: 'A'; /* Compact admin indicator for mobile */
333+
}
334+
.owner-badge span {
335+
display: none; /* Hide original text */
336+
}
337+
}
338+
322339
.user-name {
323340
color: var(--text-color);
324341
font-weight: 600;
@@ -529,13 +546,17 @@ function getReactionEmoji(reaction: string) {
529546
display: none;
530547
}
531548
.comment-item {
532-
padding-left: 40px; /* Adjust for avatar inside header */
549+
padding-left: 10px; /* Adjust for avatar inside header */
533550
}
534551
.user-avatar-link {
535-
display: block; /* Show original avatar link */
552+
display: none; /* Hide original avatar link */
536553
}
537554
.comment-header .user-avatar-mobile {
538-
display: none; /* Hide mobile avatar */
555+
display: block; /* Show mobile avatar */
556+
width: 24px;
557+
height: 24px;
558+
border-radius: 50%;
559+
margin-right: 8px;
539560
}
540561
.comment-source {
541562
display: none; /* Hide article source on mobile */
@@ -552,8 +573,8 @@ function getReactionEmoji(reaction: string) {
552573
margin-left: auto;
553574
}
554575
.github-link::before {
555-
content: ''; /* No icon */
556-
font-size: 0;
576+
content: ''; /* Arrow icon */
577+
font-size: 14px;
557578
}
558579
}
559580

@@ -609,8 +630,13 @@ function getReactionEmoji(reaction: string) {
609630
</a>
610631
<div class={comment.author.login.toLowerCase() === "catcodeme" ? "comment-content-wrapper owner-comment" : "comment-content-wrapper"}>
611632
<div class="comment-header">
633+
<img
634+
src={comment.author.avatarUrl}
635+
alt={comment.author.login}
636+
class="user-avatar-mobile"
637+
/>
612638
<a href={comment.author.url} class="user-name" target="_blank" rel="noopener noreferrer">{comment.author.login}</a>
613-
{comment.author.login.toLowerCase() === "catcodeme" && <span class="owner-badge">Admin</span>}
639+
{comment.author.login.toLowerCase() === "catcodeme" && <span class="owner-badge"><span>Admin</span></span>}
614640
<span class="comment-time">
615641
{timeAgo(comment.createdAt)}
616642
</span>

0 commit comments

Comments
 (0)