|
| 1 | +--- |
| 2 | +import { ArrowRight, Calendar, User } from 'lucide-react'; |
| 3 | +
|
| 4 | +interface Props { |
| 5 | + slug: string; |
| 6 | + title: string; |
| 7 | + description: string; |
| 8 | + date: Date | string; |
| 9 | + author: string; |
| 10 | + category: string; |
| 11 | + tags?: string[]; |
| 12 | +} |
| 13 | +
|
| 14 | +const { slug, title, description, date, author, category, tags = [] } = Astro.props; |
| 15 | +
|
| 16 | +const formattedDate = new Date(date).toLocaleDateString('en-US', { |
| 17 | + year: 'numeric', |
| 18 | + month: 'short', |
| 19 | + day: 'numeric', |
| 20 | + timeZone: 'UTC', |
| 21 | +}); |
| 22 | +--- |
| 23 | + |
| 24 | +<article class="blog-card"> |
| 25 | + <a href={`/blog/${slug}`} class="blog-card-link" aria-label={title}> |
| 26 | + <div class="blog-card-header"> |
| 27 | + <span class="category-pill">{category}</span> |
| 28 | + <span class="blog-date"> |
| 29 | + <Calendar size={13} /> |
| 30 | + {formattedDate} |
| 31 | + </span> |
| 32 | + </div> |
| 33 | + |
| 34 | + <h2 class="blog-card-title">{title}</h2> |
| 35 | + <p class="blog-card-desc">{description}</p> |
| 36 | + |
| 37 | + <div class="blog-card-footer"> |
| 38 | + <div class="blog-author"> |
| 39 | + <User size={14} /> |
| 40 | + <span>{author}</span> |
| 41 | + </div> |
| 42 | + <span class="read-more"> |
| 43 | + Read article <ArrowRight size={14} /> |
| 44 | + </span> |
| 45 | + </div> |
| 46 | + </a> |
| 47 | +</article> |
| 48 | + |
| 49 | +<style> |
| 50 | + .blog-card { |
| 51 | + background: #080808; |
| 52 | + border: 1px solid rgba(255, 255, 255, 0.08); |
| 53 | + transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); |
| 54 | + display: flex; |
| 55 | + flex-direction: column; |
| 56 | + position: relative; |
| 57 | + } |
| 58 | + |
| 59 | + .blog-card:hover { |
| 60 | + border-color: rgba(0, 245, 212, 0.3); |
| 61 | + transform: translateY(-4px); |
| 62 | + box-shadow: 0 12px 30px -10px rgba(0, 245, 212, 0.1); |
| 63 | + } |
| 64 | + |
| 65 | + .blog-card-link { |
| 66 | + padding: 2rem; |
| 67 | + display: flex; |
| 68 | + flex-direction: column; |
| 69 | + height: 100%; |
| 70 | + text-decoration: none; |
| 71 | + color: inherit; |
| 72 | + } |
| 73 | + |
| 74 | + .blog-card-header { |
| 75 | + display: flex; |
| 76 | + justify-content: space-between; |
| 77 | + align-items: center; |
| 78 | + margin-bottom: 1.25rem; |
| 79 | + } |
| 80 | + |
| 81 | + .category-pill { |
| 82 | + font-size: 0.72rem; |
| 83 | + font-weight: 600; |
| 84 | + text-transform: uppercase; |
| 85 | + letter-spacing: 0.08em; |
| 86 | + padding: 0.2rem 0.6rem; |
| 87 | + background: rgba(0, 245, 212, 0.08); |
| 88 | + border: 1px solid rgba(0, 245, 212, 0.2); |
| 89 | + color: #00f5d4; |
| 90 | + } |
| 91 | + |
| 92 | + .blog-date { |
| 93 | + display: flex; |
| 94 | + align-items: center; |
| 95 | + gap: 0.35rem; |
| 96 | + font-size: 0.8rem; |
| 97 | + color: #71717a; |
| 98 | + font-family: 'JetBrains Mono', monospace; |
| 99 | + } |
| 100 | + |
| 101 | + .blog-card-title { |
| 102 | + font-size: 1.35rem; |
| 103 | + font-weight: 700; |
| 104 | + color: #fff; |
| 105 | + line-height: 1.3; |
| 106 | + margin: 0 0 0.85rem; |
| 107 | + letter-spacing: -0.015em; |
| 108 | + } |
| 109 | + |
| 110 | + .blog-card:hover .blog-card-title { |
| 111 | + color: #00f5d4; |
| 112 | + } |
| 113 | + |
| 114 | + .blog-card-desc { |
| 115 | + font-size: 0.95rem; |
| 116 | + color: #a1a1aa; |
| 117 | + line-height: 1.6; |
| 118 | + margin: 0 0 2rem; |
| 119 | + flex-grow: 1; |
| 120 | + } |
| 121 | + |
| 122 | + .blog-card-footer { |
| 123 | + display: flex; |
| 124 | + justify-content: space-between; |
| 125 | + align-items: center; |
| 126 | + padding-top: 1.25rem; |
| 127 | + border-top: 1px solid rgba(255, 255, 255, 0.06); |
| 128 | + } |
| 129 | + |
| 130 | + .blog-author { |
| 131 | + display: flex; |
| 132 | + align-items: center; |
| 133 | + gap: 0.45rem; |
| 134 | + font-size: 0.85rem; |
| 135 | + color: #71717a; |
| 136 | + } |
| 137 | + |
| 138 | + .read-more { |
| 139 | + display: flex; |
| 140 | + align-items: center; |
| 141 | + gap: 0.35rem; |
| 142 | + font-size: 0.85rem; |
| 143 | + font-weight: 600; |
| 144 | + color: #00f5d4; |
| 145 | + transition: gap 0.2s ease; |
| 146 | + } |
| 147 | + |
| 148 | + .blog-card:hover .read-more { |
| 149 | + gap: 0.55rem; |
| 150 | + } |
| 151 | +</style> |
0 commit comments