-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLuxeBlogPage.jsx
More file actions
294 lines (270 loc) · 12.3 KB
/
LuxeBlogPage.jsx
File metadata and controls
294 lines (270 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import {
ArrowRightIcon,
MagnifyingGlassIcon,
ListBulletsIcon,
GridFourIcon,
FolderIcon,
} from '@phosphor-icons/react';
import { fetchAllBlogPosts } from '../../utils/dataUtils';
import Seo from '../../components/Seo';
import LuxeArt from '../../components/LuxeArt';
const FILTERS = [
{ id: 'all', label: 'All' },
{ id: 'dev', label: 'Dev' },
{ id: 'ai', label: 'AI' },
{ id: 'feat', label: 'Feat' },
{ id: 'rant', label: 'Rant' },
{ id: 'series', label: 'Series' },
{ id: 'gist', label: 'Gist' },
{ id: 'd&d', label: 'D&D' },
];
const LuxeBlogPage = () => {
const [displayItems, setDisplayItems] = useState([]);
const [loading, setLoading] = useState(true);
const [activeFilter, setActiveFilter] = useState('all');
const [searchQuery, setSearchQuery] = useState('');
const [layoutMode, setLayoutMode] = useState('grid');
useEffect(() => {
const fetchPosts = async () => {
try {
const { processedPosts } = await fetchAllBlogPosts();
// Flatten series for the index, or keep them?
// For Luxe, individual posts usually look better in a grid.
// But let's respect the grouping if possible.
// Actually, let's flatten for a pure chronological feed.
// Wait, the original BlogPage groups them. Let's keep individual posts for simplicity and "clean" feed.
// Or copy the logic exactly. Let's copy the logic.
const seriesMap = new Map();
const individualPosts = [];
processedPosts.forEach((post) => {
if (post.series) {
if (!seriesMap.has(post.series.slug)) {
seriesMap.set(post.series.slug, {
title: post.series.title,
slug: post.series.slug,
date: post.series.date || post.date,
updated: post.series.updated || post.updated,
image: post.series.image,
isSeries: true,
posts: [],
tags: post.tags,
category: post.category,
description: post.series.description || post.description,
});
}
seriesMap.get(post.series.slug).posts.push(post);
} else {
individualPosts.push(post);
}
});
const combinedItems = [
...Array.from(seriesMap.values()),
...individualPosts,
];
combinedItems.sort(
(a, b) =>
new Date(b.updated || b.date) - new Date(a.updated || a.date),
);
setDisplayItems(combinedItems);
} catch (error) {
console.error('Error fetching blog data:', error);
} finally {
setLoading(false);
}
};
fetchPosts();
}, []);
const filteredItems = displayItems.filter((item) => {
const matchesFilter =
activeFilter === 'all' ||
item.category === activeFilter ||
(activeFilter === 'series' && item.isSeries);
const matchesSearch =
!searchQuery ||
item.title?.toLowerCase().includes(searchQuery.toLowerCase()) ||
item.description?.toLowerCase().includes(searchQuery.toLowerCase());
return matchesFilter && matchesSearch;
});
return (
<div className="min-h-screen bg-[#F5F5F0] text-[#1A1A1A] font-sans selection:bg-[#C0B298] selection:text-black pt-24 pb-20">
<Seo title="Fezcodex | Journal" description="Archive of thoughts." />
<div className="max-w-[1800px] mx-auto px-6 md:px-12">
{/* Header */}
<header className="mb-20 pt-12 border-b border-[#1A1A1A]/10 pb-12">
<h1 className="font-playfairDisplay text-7xl md:text-9xl text-[#1A1A1A] mb-6">
The Journal
</h1>
<div className="flex flex-col md:flex-row justify-between items-end gap-8">
<p className="font-outfit text-sm text-[#1A1A1A]/60 max-w-lg leading-relaxed">
A curated collection of engineering notes, architectural
decisions, and digital essays.
</p>
{/* Controls */}
<div className="flex flex-col md:flex-row gap-6 w-full md:w-auto">
{/* Search */}
<div className="relative group border-b border-[#1A1A1A]/20 focus-within:border-[#1A1A1A] transition-colors min-w-[200px]">
<input
type="text"
placeholder="Search..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
className="w-full bg-transparent py-2 outline-none font-outfit text-sm placeholder-[#1A1A1A]/30"
/>
<MagnifyingGlassIcon className="absolute right-0 top-1/2 -translate-y-1/2 text-[#1A1A1A]/40" />
</div>
{/* Filters */}
<div className="flex gap-2 overflow-x-auto no-scrollbar flex-1 md:flex-none">
{FILTERS.map((f) => (
<button
key={f.id}
onClick={() => setActiveFilter(f.id)}
className={`px-4 py-2 rounded-full font-outfit text-xs uppercase tracking-widest whitespace-nowrap transition-all ${
activeFilter === f.id
? 'bg-[#1A1A1A] text-white shadow-lg shadow-black/10'
: 'border border-[#1A1A1A]/10 hover:border-[#1A1A1A] text-[#1A1A1A]/60'
}`}
>
{f.label}
</button>
))}
</div>
{/* Layout Switcher */}
<div className="flex bg-white rounded-full p-1 border border-[#1A1A1A]/5 shadow-sm">
<button
onClick={() => setLayoutMode('grid')}
className={`p-2 rounded-full transition-all ${layoutMode === 'grid' ? 'bg-[#1A1A1A] text-white shadow-md' : 'text-[#1A1A1A]/40 hover:text-[#1A1A1A]'}`}
title="Grid View"
>
<GridFourIcon size={18} />
</button>
<button
onClick={() => setLayoutMode('list')}
className={`p-2 rounded-full transition-all ${layoutMode === 'list' ? 'bg-[#1A1A1A] text-white shadow-md' : 'text-[#1A1A1A]/40 hover:text-[#1A1A1A]'}`}
title="List View"
>
<ListBulletsIcon size={18} />
</button>
</div>
</div>
</div>
</header>
{/* Content Area */}
{loading ? (
<div className="py-32 text-center font-outfit text-[#1A1A1A]/40 text-xs uppercase tracking-[0.2em] animate-pulse">
Synchronizing Archive...
</div>
) : layoutMode === 'grid' ? (
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-16 animate-fade-in">
{filteredItems.map((item) => (
<Link
key={item.slug}
to={
item.isSeries
? `/blog/series/${item.slug}`
: `/blog/${item.slug}`
}
className="group block"
>
<div className="relative aspect-[4/5] bg-[#EBEBEB] overflow-hidden mb-6 border border-[#1A1A1A]/5 shadow-sm group-hover:shadow-2xl transition-all duration-700">
{/* Art/Image */}
<div className="absolute inset-0 transition-transform duration-1000 group-hover:scale-105">
<LuxeArt
seed={item.title}
className="w-full h-full opacity-80 mix-blend-multiply"
/>
</div>
{/* Date Badge */}
<div className="absolute top-4 left-4">
<span className="bg-white/80 backdrop-blur-sm px-3 py-1 font-outfit text-[10px] uppercase tracking-widest border border-[#1A1A1A]/5">
{new Date(item.date).toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})}
</span>
</div>
</div>
<div className="space-y-3">
<div className="flex items-center gap-3">
<span className="font-outfit text-[10px] uppercase tracking-widest text-[#8D4004] font-bold">
{item.category}
</span>
{item.isSeries && (
<span className="font-outfit text-[10px] uppercase tracking-widest text-[#1A1A1A]/40 border border-[#1A1A1A]/10 px-1.5 py-0.5 rounded-sm bg-white/50 flex items-center gap-1">
<FolderIcon size={12} weight="fill" /> Series
</span>
)}
</div>
<h2 className="font-playfairDisplay text-3xl text-[#1A1A1A] group-hover:italic transition-all leading-tight">
{item.title}
</h2>
<p className="font-outfit text-sm text-[#1A1A1A]/60 line-clamp-2 leading-relaxed">
{item.description}
</p>
<div className="pt-4 flex items-center gap-2 text-[#1A1A1A]/40 font-outfit text-[10px] uppercase tracking-[0.2em] group-hover:text-[#8D4004] group-hover:gap-4 transition-all">
Read Entry <ArrowRightIcon />
</div>
</div>
</Link>
))}
</div>
) : (
<div className="max-w-5xl mx-auto flex flex-col divide-y divide-[#1A1A1A]/5 animate-fade-in">
{filteredItems.map((item) => (
<Link
key={item.slug}
to={
item.isSeries
? `/blog/series/${item.slug}`
: `/blog/${item.slug}`
}
className="group py-12 first:pt-0 flex flex-col md:flex-row gap-8 items-start md:items-center"
>
<div className="w-full md:w-48 lg:w-64 shrink-0">
<div className="relative aspect-[16/9] md:aspect-square bg-[#EBEBEB] overflow-hidden border border-[#1A1A1A]/5 group-hover:shadow-xl transition-all duration-500">
<LuxeArt
seed={item.title}
className="w-full h-full opacity-60 mix-blend-multiply transition-transform duration-1000 group-hover:scale-110"
/>
</div>
</div>
<div className="flex-1 space-y-4">
<div className="flex items-center gap-4 text-[10px] font-outfit uppercase tracking-[0.2em]">
<span className="text-[#8D4004] font-bold">
{item.category}
</span>
<span className="text-[#1A1A1A]/30">/</span>
<span className="text-[#1A1A1A]/40">
{new Date(item.date).toLocaleDateString('en-US', {
month: 'long',
day: 'numeric',
year: 'numeric',
})}
</span>
{item.isSeries && (
<span className="bg-[#1A1A1A]/5 px-2 py-0.5 rounded text-[9px] text-[#1A1A1A]/60 flex items-center gap-1">
<FolderIcon size={12} weight="bold" /> Series
</span>
)}
</div>
<h2 className="font-playfairDisplay text-3xl md:text-4xl lg:text-5xl text-[#1A1A1A] group-hover:italic group-hover:translate-x-2 transition-all duration-500 leading-tight">
{item.title}
</h2>
<p className="font-outfit text-sm text-[#1A1A1A]/60 line-clamp-2 max-w-2xl leading-relaxed italic">
{item.description}
</p>
</div>
<div className="hidden md:flex shrink-0 w-12 h-12 rounded-full border border-[#1A1A1A]/10 items-center justify-center group-hover:bg-[#1A1A1A] group-hover:text-white transition-all duration-500">
<ArrowRightIcon size={20} />
</div>
</Link>
))}
</div>
)}
</div>
</div>
);
};
export default LuxeBlogPage;