|
| 1 | +import React from 'react'; |
| 2 | +import { Link } from 'react-router-dom'; |
| 3 | +import { ArrowRight } from '@phosphor-icons/react'; |
| 4 | +import { motion } from 'framer-motion'; |
| 5 | +import GenerativeArt from './GenerativeArt'; |
| 6 | + |
| 7 | +const PostTile = ({ post }) => { |
| 8 | + const dateStr = new Date(post.updated || post.date).toLocaleDateString('en-GB', { |
| 9 | + year: 'numeric', |
| 10 | + month: 'short', |
| 11 | + day: '2-digit', |
| 12 | + }); |
| 13 | + |
| 14 | + return ( |
| 15 | + <motion.div |
| 16 | + whileHover={{ y: -5 }} |
| 17 | + className="group relative flex flex-col overflow-hidden rounded-sm bg-zinc-900 border border-white/10 h-full" |
| 18 | + > |
| 19 | + <Link to={post.isSeries ? `/blog/series/${post.slug}` : `/blog/${post.slug}`} className="flex flex-col h-full"> |
| 20 | + {/* Visual Header */} |
| 21 | + <div className="relative h-32 w-full overflow-hidden border-b border-white/5"> |
| 22 | + <GenerativeArt |
| 23 | + seed={post.title} |
| 24 | + className="w-full h-full opacity-40 transition-transform duration-700 ease-out group-hover:scale-110" |
| 25 | + /> |
| 26 | + <div className="absolute inset-0 bg-gradient-to-t from-zinc-900 to-transparent" /> |
| 27 | + |
| 28 | + <div className="absolute bottom-3 left-4 flex items-center gap-2"> |
| 29 | + <span className="px-2 py-0.5 text-[9px] font-mono font-bold uppercase tracking-widest text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 rounded-sm"> |
| 30 | + {post.category || 'Post'} |
| 31 | + </span> |
| 32 | + {post.isSeries && ( |
| 33 | + <span className="px-2 py-0.5 text-[9px] font-mono font-bold uppercase tracking-widest text-amber-400 bg-amber-500/10 border border-amber-500/20 rounded-sm"> |
| 34 | + Series |
| 35 | + </span> |
| 36 | + )} |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + |
| 40 | + {/* Content */} |
| 41 | + <div className="flex flex-col flex-grow p-5"> |
| 42 | + <span className="font-mono text-[10px] text-gray-500 uppercase tracking-widest mb-2"> |
| 43 | + {dateStr} |
| 44 | + </span> |
| 45 | + |
| 46 | + <h3 className="text-lg font-medium font-sans uppercase text-white mb-3 group-hover:text-emerald-400 transition-colors line-clamp-2 leading-tight"> |
| 47 | + {post.title} |
| 48 | + </h3> |
| 49 | + |
| 50 | + <div className="mt-auto pt-4 flex items-center justify-between border-t border-white/5"> |
| 51 | + <span className="text-[10px] font-mono font-bold uppercase tracking-widest text-gray-500 group-hover:text-white transition-colors"> |
| 52 | + Read Intel |
| 53 | + </span> |
| 54 | + <ArrowRight weight="bold" size={14} className="text-emerald-500 transform -translate-x-2 opacity-0 transition-all duration-300 group-hover:translate-x-0 group-hover:opacity-100" /> |
| 55 | + </div> |
| 56 | + </div> |
| 57 | + </Link> |
| 58 | + </motion.div> |
| 59 | + ); |
| 60 | +}; |
| 61 | + |
| 62 | +export default PostTile; |
0 commit comments