Files
web-at-transit-mock/ui/partials/blog.html
T
2026-09-23 00:53:04 +07:00

169 lines
8.1 KiB
HTML

<style>
/* ===== หน้าบทความ — ข้อมูลจาก partials/blog-data/ (ระบบเดียวกับ about) ===== */
.mu-hero-lead {
margin: 14px auto 0;
max-width: 640px;
color: #5b3b71;
font-size: .95rem;
}
.mu-blog-wrap { padding: 26px 0 52px; }
/* --- แถบสลับมุมมอง (ตาราง / รายการ) --- */
.mu-blog-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
margin-bottom: 18px;
}
.mu-blog-count { margin: 0; color: #6f7b95; font-size: .88rem; }
.mu-view-switch {
margin-left: auto;
display: inline-flex;
gap: 2px;
background: #f0edf7;
border: 1px solid #e4dcf2;
border-radius: 999px;
padding: 3px;
}
.mu-view-btn {
display: inline-flex;
align-items: center;
gap: 6px;
border: 0;
background: transparent;
color: #6d28d9;
font-family: inherit;
font-weight: 700;
font-size: .8rem;
min-height: 36px;
padding: 6px 14px;
border-radius: 999px;
cursor: pointer;
transition: background .15s ease, color .15s ease;
}
.mu-view-btn .ic { width: 15px; height: 15px; }
.mu-view-btn.active { background: #fff; color: #7a4cc0; box-shadow: 0 1px 4px rgba(63, 43, 94, .18); }
.mu-view-btn:focus-visible { outline: 2px solid #7a4cc0; outline-offset: 2px; }
/* --- โหมดตาราง (grid) --- */
#blog-list.mode-grid {
display: grid;
grid-template-columns: 1fr;
gap: 18px;
}
.mu-blog-card {
display: flex;
flex-direction: column;
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 18px;
overflow: hidden;
box-shadow: 0 10px 26px rgba(63, 43, 94, .07);
text-decoration: none;
color: inherit;
transition: transform .18s ease, box-shadow .18s ease;
}
.mu-blog-card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(63, 43, 94, .14); }
.mu-blog-card .mu-cover { aspect-ratio: 16 / 9; }
.mu-blog-card .mu-cover.no-img { background: linear-gradient(135deg, #7a4cc0, #3071b8); }
.mu-blog-card .mu-cover.no-img::after { background: linear-gradient(180deg, rgba(15,23,42,0) 40%, rgba(15,23,42,.4) 100%); }
.mu-blog-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.mu-blog-meta { display: flex; align-items: center; gap: 8px; color: #6f7b95; font-size: .78rem; }
.mu-blog-meta time { font-variant-numeric: tabular-nums; }
.mu-blog-card h2 { margin: 0; font-size: 1.02rem; color: #1f2a44; font-weight: 800; line-height: 1.4; }
.mu-blog-excerpt { margin: 0; color: #4a5568; font-size: .88rem; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mu-blog-more { margin-top: auto; padding-top: 6px; color: #7a4cc0; font-weight: 700; font-size: .85rem; }
/* --- โหมดรายการ (list) --- */
#blog-list.mode-list { display: flex; flex-direction: column; gap: 14px; }
.mu-blog-row {
display: grid;
grid-template-columns: 108px 1fr;
gap: 14px;
align-items: center;
background: #fff;
border: 1px solid #ebe8f4;
border-radius: 16px;
padding: 12px;
box-shadow: 0 8px 20px rgba(63, 43, 94, .06);
text-decoration: none;
color: inherit;
transition: border-color .15s ease, box-shadow .15s ease;
}
.mu-blog-row:hover { border-color: #d8c9f2; box-shadow: 0 12px 26px rgba(63, 43, 94, .12); }
.mu-blog-row .thumb {
width: 108px; height: 84px;
border-radius: 12px;
object-fit: cover;
display: block;
background: linear-gradient(135deg, #7a4cc0, #3071b8);
}
.mu-blog-row h2 { margin: 4px 0 6px; font-size: .98rem; color: #1f2a44; font-weight: 800; line-height: 1.4; }
.mu-blog-row .mu-blog-excerpt { -webkit-line-clamp: 2; }
.mu-blog-empty { color: #6f7b95; text-align: center; padding: 34px 0; }
.mu-blog-skel { height: 220px; border-radius: 18px; background: linear-gradient(90deg, #f4f2fa 25%, #ece8f6 37%, #f4f2fa 63%); background-size: 400% 100%; animation: muSkelB 1.4s ease infinite; }
@keyframes muSkelB { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
/* --- หน้าอ่านบทความ --- */
.mu-post { background: #fff; border: 1px solid #ebe8f4; border-radius: 20px; overflow: hidden; box-shadow: 0 12px 30px rgba(63, 43, 94, .08); }
.mu-post .mu-cover { aspect-ratio: 16 / 8; }
.mu-post-body { padding: 20px 18px 26px; }
.mu-post-body h1 { margin: 6px 0 12px; font-size: 1.35rem; color: #1f2a44; font-weight: 800; line-height: 1.4; }
.mu-post-body p { margin: 0 0 14px; color: #4a5568; font-size: .96rem; line-height: 1.9; }
.mu-post-body p:last-child { margin-bottom: 0; }
.mu-post-back {
display: inline-flex; align-items: center; gap: 6px;
margin-bottom: 16px; color: #7a4cc0; font-weight: 700;
text-decoration: none; font-size: .9rem;
}
.mu-post-back:hover { text-decoration: underline; }
/* แท็บเล็ตขึ้นไป: การ์ด 2 คอลัมน์ → 3 คอลัมน์ */
@media (min-width: 640px) {
#blog-list.mode-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
#blog-list.mode-grid { grid-template-columns: repeat(3, 1fr); }
.mu-post-body { padding: 26px 30px 34px; }
}
</style>
<!-- ============ HERO ============ -->
<section class="mu-hero">
<img class="mu-hero-map" src="../.image/network/overview-map.png" alt="" aria-hidden="true" decoding="async">
<div class="mu-blob one"></div>
<div class="mu-blob two"></div>
<div class="mu-blob three"></div>
<div class="mu-container mu-hero-content">
<span class="mu-badge"><svg class="ic" aria-hidden="true"><use href="#ic-message-circle"/></svg> <span data-i18n="nav.blog">บ่นไปเรื่อย</span></span>
<h1><span data-i18n="blog.title">บ่นไปเรื่อย</span><br><span class="mu-gradient-text" data-i18n="blog.subtitle">หน้านี้ก็เหมือนไดอารี่ของเรา อยากบ่นอะไรก็บ่น</span></h1>
<p class="mu-hero-lead" data-i18n="blog.lead">ขอบคุณที่เข้ามาอ่านบางบทความก็มีสาระบางบทความก็ไม่มีสาระ </p>
</div>
</section>
<!-- ============ รายการบทความ (โหลดจาก blog-data: text1.json + pic1, ...) ============ -->
<section class="mu-blog-wrap">
<div class="mu-container">
<div class="mu-blog-bar" id="blog-bar" hidden>
<p class="mu-blog-count" id="blog-count"></p>
<div class="mu-view-switch" role="group" aria-label="มุมมอง">
<button type="button" class="mu-view-btn" data-view="grid">
<svg class="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="7" height="7" x="3" y="3" rx="1"/><rect width="7" height="7" x="14" y="3" rx="1"/><rect width="7" height="7" x="14" y="14" rx="1"/><rect width="7" height="7" x="3" y="14" rx="1"/></svg>
<span data-i18n="blog.viewGrid">ตาราง</span>
</button>
<button type="button" class="mu-view-btn" data-view="list">
<svg class="ic" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" x2="21" y1="6" y2="6"/><line x1="8" x2="21" y1="12" y2="12"/><line x1="8" x2="21" y1="18" y2="18"/><line x1="3" x2="3.01" y1="6" y2="6"/><line x1="3" x2="3.01" y1="12" y2="12"/><line x1="3" x2="3.01" y1="18" y2="18"/></svg>
<span data-i18n="blog.viewList">รายการ</span>
</button>
</div>
</div>
<div id="blog-list" aria-live="polite">
<div class="mu-blog-skel"></div>
</div>
</div>
</section>
<script src="./partials/blog.init.js"></script>