Skip to content

Commit dff9c37

Browse files
committed
fixed the dark-mode issue in author page
1 parent 8d810e3 commit dff9c37

File tree

1 file changed

+56
-48
lines changed

1 file changed

+56
-48
lines changed

src/pages/News/AuthorPage.tsx

Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ const AuthorPage: React.FC = () => {
159159
return (
160160
<>
161161
<Header />
162-
<div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-green-50">
162+
<div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-green-50 dark:from-gray-900 dark:via-gray-900 dark:to-gray-800">
163163
<div className="container mx-auto px-4 py-8 max-w-7xl">
164164
{/* Back Button */}
165165
<motion.button
166166
onClick={() => navigate(-1)}
167-
className="mb-6 px-4 py-2 flex items-center text-blue-600 hover:text-blue-700 transition-colors rounded-md hover:bg-blue-50"
167+
className="mb-6 px-4 py-2 flex items-center text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors rounded-md hover:bg-blue-50 dark:hover:bg-blue-900/30"
168168
whileHover={{ scale: 1.05 }}
169169
whileTap={{ scale: 0.95 }}
170170
>
@@ -174,7 +174,7 @@ const AuthorPage: React.FC = () => {
174174

175175
{/* Author Header */}
176176
<motion.div
177-
className="bg-white rounded-2xl shadow-xl p-4 sm:p-6 lg:p-8 mb-8"
177+
className="bg-white dark:bg-gray-800 rounded-2xl shadow-xl dark:shadow-2xl dark:shadow-black/20 p-4 sm:p-6 lg:p-8 mb-8"
178178
initial={{ opacity: 0, y: 20 }}
179179
animate={{ opacity: 1, y: 0 }}
180180
transition={{ duration: 0.5 }}
@@ -186,7 +186,7 @@ const AuthorPage: React.FC = () => {
186186
<img
187187
src={author.avatar}
188188
alt={author.name}
189-
className="w-24 h-24 sm:w-28 sm:h-28 lg:w-32 lg:h-32 rounded-full object-cover border-4 border-blue-100"
189+
className="w-24 h-24 sm:w-28 sm:h-28 lg:w-32 lg:h-32 rounded-full object-cover border-4 border-blue-100 dark:border-blue-900"
190190
/>
191191
) : (
192192
<div className="w-24 h-24 sm:w-28 sm:h-28 lg:w-32 lg:h-32 bg-blue-100 rounded-full flex items-center justify-center">
@@ -197,17 +197,19 @@ const AuthorPage: React.FC = () => {
197197

198198
{/* Author Info */}
199199
<div className="flex-1 text-center sm:text-left">
200-
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-gray-900 mb-2">
200+
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-gray-900 dark:text-white mb-2">
201201
{author.name}
202202
</h1>
203203
<div className="flex flex-col sm:flex-row sm:items-center gap-2 mb-3">
204-
<span className="text-lg lg:text-xl text-blue-600 font-medium">
204+
<span className="text-lg lg:text-xl text-blue-600 dark:text-blue-400 font-medium">
205205
{author.title}
206206
</span>
207207
{author.organization && (
208208
<>
209-
<span className="hidden sm:inline text-gray-400">at</span>
210-
<div className="flex items-center justify-center sm:justify-start gap-1 text-gray-700">
209+
<span className="hidden sm:inline text-gray-400 dark:text-gray-500">
210+
at
211+
</span>
212+
<div className="flex items-center justify-center sm:justify-start gap-1 text-gray-700 dark:text-gray-300">
211213
<Building className="w-4 h-4" />
212214
<span className="font-medium">
213215
{author.organization}
@@ -216,21 +218,21 @@ const AuthorPage: React.FC = () => {
216218
</>
217219
)}
218220
</div>
219-
<p className="text-gray-600 text-base lg:text-lg mb-4 max-w-2xl">
221+
<p className="text-gray-600 dark:text-gray-300 text-base lg:text-lg mb-4 max-w-2xl">
220222
{author.description}
221223
</p>
222224

223225
{/* Quick Stats */}
224-
<div className="flex flex-wrap justify-center sm:justify-start gap-4 text-sm text-gray-600">
225-
<div className="flex items-center gap-1 bg-blue-50 px-3 py-1 rounded-full">
226+
<div className="flex flex-wrap justify-center sm:justify-start gap-4 text-sm text-gray-600 dark:text-gray-300">
227+
<div className="flex items-center gap-1 bg-blue-50 dark:bg-blue-900/30 px-3 py-1 rounded-full">
226228
<BookOpen className="w-4 h-4" />
227229
<span>
228230
{posts.length}{' '}
229231
{posts.length === 1 ? 'Article' : 'Articles'}
230232
</span>
231233
</div>
232234
{author.organization && (
233-
<div className="flex items-center gap-1 bg-gray-50 px-3 py-1 rounded-full">
235+
<div className="flex items-center gap-1 bg-gray-50 dark:bg-gray-700/50 px-3 py-1 rounded-full">
234236
<Building className="w-4 h-4" />
235237
<span>{author.organization}</span>
236238
</div>
@@ -249,16 +251,16 @@ const AuthorPage: React.FC = () => {
249251
transition={{ duration: 0.5, delay: 0.2 }}
250252
>
251253
{/* About Section */}
252-
<div className="bg-white rounded-2xl shadow-xl p-4 sm:p-6 lg:p-8 mb-6 lg:mb-8">
254+
<div className="bg-white dark:bg-gray-800 rounded-2xl shadow-xl dark:shadow-2xl dark:shadow-black/20 p-4 sm:p-6 lg:p-8 mb-6 lg:mb-8">
253255
<MarkdownRenderer content={author.content} />
254256
</div>
255257

256258
{/* Articles Section */}
257-
<div className="bg-white rounded-2xl shadow-xl p-4 sm:p-6 lg:p-8">
259+
<div className="bg-white dark:bg-gray-800 rounded-2xl shadow-xl dark:shadow-2xl dark:shadow-black/20 p-4 sm:p-6 lg:p-8">
258260
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6">
259261
<div className="flex items-center gap-2">
260-
<BookOpen className="w-5 h-5 text-blue-600" />
261-
<h3 className="text-xl lg:text-2xl font-bold text-gray-900">
262+
<BookOpen className="w-5 h-5 text-blue-600 dark:text-blue-400" />
263+
<h3 className="text-xl lg:text-2xl font-bold text-gray-900 dark:text-white">
262264
Articles ({filteredPosts.length})
263265
</h3>
264266
</div>
@@ -268,21 +270,21 @@ const AuthorPage: React.FC = () => {
268270
<div className="flex flex-col sm:flex-row gap-3">
269271
{/* Search */}
270272
<div className="relative">
271-
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4" />
273+
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 dark:text-gray-500 w-4 h-4" />
272274
<input
273275
type="text"
274276
placeholder="Search articles..."
275277
value={searchTerm}
276278
onChange={(e) => setSearchTerm(e.target.value)}
277-
className="pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm w-full sm:w-auto"
279+
className="pl-10 pr-4 py-2 border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent text-sm w-full sm:w-auto placeholder-gray-400 dark:placeholder-gray-500"
278280
/>
279281
</div>
280282

281283
{/* Category Filter */}
282284
<select
283285
value={selectedCategory}
284286
onChange={(e) => setSelectedCategory(e.target.value)}
285-
className="px-3 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm"
287+
className="px-3 py-2 border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 focus:border-transparent text-sm"
286288
>
287289
{getUniqueCategories().map((category) => (
288290
<option key={category} value={category}>
@@ -297,20 +299,22 @@ const AuthorPage: React.FC = () => {
297299
onChange={(e) =>
298300
setSortBy(e.target.value as 'date' | 'title')
299301
}
300-
className="px-3 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm"
302+
className="px-3 py-2 border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700
303+
text-gray-900 dark:text-gray-100 rounded-lg focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400
304+
focus:border-transparent text-sm"
301305
>
302306
<option value="date">Sort by Date</option>
303307
<option value="title">Sort by Title</option>
304308
</select>
305309

306310
{/* View Toggle */}
307-
<div className="flex bg-gray-100 rounded-lg p-1">
311+
<div className="flex bg-gray-100 dark:bg-gray-700 rounded-lg p-1">
308312
<button
309313
onClick={() => setViewMode('grid')}
310314
className={`p-2 rounded-md transition-colors ${
311315
viewMode === 'grid'
312-
? 'bg-white text-blue-600 shadow-sm'
313-
: 'text-gray-600'
316+
? 'bg-white dark:bg-gray-600 text-blue-600 dark:text-blue-400 shadow-sm dark:shadow-black/20'
317+
: 'text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400'
314318
}`}
315319
>
316320
<Grid className="w-4 h-4" />
@@ -319,8 +323,8 @@ const AuthorPage: React.FC = () => {
319323
onClick={() => setViewMode('list')}
320324
className={`p-2 rounded-md transition-colors ${
321325
viewMode === 'list'
322-
? 'bg-white text-blue-600 shadow-sm'
323-
: 'text-gray-600'
326+
? 'bg-white dark:bg-gray-600 text-blue-600 dark:text-blue-400 shadow-sm dark:shadow-black/20'
327+
: 'text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400'
324328
}`}
325329
>
326330
<List className="w-4 h-4" />
@@ -336,12 +340,12 @@ const AuthorPage: React.FC = () => {
336340
<div className="text-4xl mb-4">
337341
{searchTerm || selectedCategory !== 'All' ? '🔍' : '📝'}
338342
</div>
339-
<h4 className="text-lg font-semibold text-gray-700 mb-2">
343+
<h4 className="text-lg font-semibold text-gray-700 dark:text-gray-200 mb-2">
340344
{searchTerm || selectedCategory !== 'All'
341345
? 'No matching articles'
342346
: 'No articles published yet'}
343347
</h4>
344-
<p className="text-gray-600">
348+
<p className="text-gray-600 dark:text-gray-400">
345349
{searchTerm || selectedCategory !== 'All'
346350
? 'Try adjusting your search or filter criteria'
347351
: 'Articles will appear here when published'}
@@ -374,8 +378,8 @@ const AuthorPage: React.FC = () => {
374378
<motion.article
375379
key={post.slug}
376380
className={`
377-
border border-gray-200 rounded-lg hover:border-blue-300 hover:shadow-md
378-
transition-all duration-300 cursor-pointer group bg-white
381+
border border-gray-200 dark:border-gray-700 rounded-lg hover:border-blue-300 dark:hover:border-blue-500 hover:shadow-md dark:hover:shadow-blue-500/10
382+
transition-all duration-300 cursor-pointer group bg-white dark:bg-gray-800
379383
${viewMode === 'list' ? 'flex gap-4 p-4' : 'p-4'}
380384
`}
381385
onClick={() => handlePostClick(post)}
@@ -396,14 +400,14 @@ const AuthorPage: React.FC = () => {
396400
)}
397401

398402
<div className="flex-1">
399-
<h4 className="font-semibold text-gray-900 mb-2 line-clamp-2 group-hover:text-blue-600 transition-colors">
403+
<h4 className="font-semibold text-gray-900 dark:text-gray-100 mb-2 line-clamp-2 group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors">
400404
{post.title}
401405
</h4>
402-
<p className="text-sm text-gray-600 mb-3 line-clamp-2">
406+
<p className="text-sm text-gray-600 dark:text-gray-300 mb-3 line-clamp-2">
403407
{post.excerpt}
404408
</p>
405409

406-
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-2 text-xs text-gray-500">
410+
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-2 text-xs text-gray-500 dark:text-gray-400">
407411
<div className="flex items-center gap-3">
408412
<div className="flex items-center gap-1">
409413
<Calendar className="w-3 h-3" />
@@ -421,7 +425,7 @@ const AuthorPage: React.FC = () => {
421425
</div>
422426
)}
423427
</div>
424-
<span className="px-2 py-1 bg-blue-100 text-blue-600 rounded-full text-xs font-medium">
428+
<span className="px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 rounded-full text-xs font-medium">
425429
{post.category}
426430
</span>
427431
</div>
@@ -436,13 +440,14 @@ const AuthorPage: React.FC = () => {
436440
<div className="text-center mt-8">
437441
<motion.button
438442
onClick={handleShowMore}
439-
className="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium flex items-center gap-2 mx-auto"
443+
className="px-6 py-3 bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800 text-white
444+
rounded-lg transition-colors font-medium flex items-center gap-2 mx-auto shadow-md dark:shadow-blue-500/20"
440445
whileHover={{ scale: 1.05 }}
441446
whileTap={{ scale: 0.95 }}
442447
>
443448
Load More Articles
444449
<ChevronDown className="w-4 h-4" />
445-
<span className="text-xs bg-blue-500 px-2 py-1 rounded-full">
450+
<span className="text-xs bg-blue-500 dark:bg-blue-600 px-2 py-1 rounded-full">
446451
+{Math.min(6, filteredPosts.length - displayCount)}
447452
</span>
448453
</motion.button>
@@ -461,30 +466,33 @@ const AuthorPage: React.FC = () => {
461466
transition={{ duration: 0.5, delay: 0.3 }}
462467
>
463468
{/* Author Stats Card */}
464-
<div className="bg-white rounded-2xl shadow-xl p-6 mb-6">
465-
<h3 className="text-lg font-bold text-gray-900 mb-4">
469+
<div className="bg-white dark:bg-gray-800 rounded-2xl shadow-xl dark:shadow-2xl dark:shadow-black/20 p-6 mb-6">
470+
<h3 className="text-lg font-bold text-gray-900 dark:text-white mb-4">
466471
Profile Stats
467472
</h3>
468473
<div className="space-y-3">
469474
<div className="flex justify-between items-center">
470-
<span className="text-gray-600">Total Articles</span>
471-
<span className="font-semibold text-blue-600">
475+
<span className="text-gray-600 dark:text-gray-300">
476+
Total Articles
477+
</span>
478+
<span className="font-semibold text-blue-600 dark:text-blue-400">
472479
{posts.length}
473480
</span>
474481
</div>
475482
<div className="flex justify-between items-center">
476-
<span className="text-gray-600">Categories</span>
477-
<span className="font-semibold text-gray-900">
483+
<span className="text-gray-600 dark:text-gray-300">
484+
Categories
485+
</span>
486+
<span className="font-semibold text-gray-900 dark:text-white">
478487
{getUniqueCategories().length - 1}
479488
</span>
480489
</div>
481490
</div>
482-
</div>
483-
491+
</div>{' '}
484492
{/* Categories Card */}
485493
{getUniqueCategories().length > 2 && (
486-
<div className="bg-white rounded-2xl shadow-xl p-6">
487-
<h3 className="text-lg font-bold text-gray-900 mb-4">
494+
<div className="bg-white dark:bg-gray-800 rounded-2xl shadow-xl dark:shadow-2xl dark:shadow-black/20 p-6">
495+
<h3 className="text-lg font-bold text-gray-900 dark:text-white mb-4">
488496
Categories
489497
</h3>
490498
<div className="space-y-2">
@@ -500,14 +508,14 @@ const AuthorPage: React.FC = () => {
500508
onClick={() => setSelectedCategory(category)}
501509
className={`w-full flex justify-between items-center p-2 rounded-lg transition-colors text-left ${
502510
selectedCategory === category
503-
? 'bg-blue-50 text-blue-700'
504-
: 'hover:bg-gray-50'
511+
? 'bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300'
512+
: 'hover:bg-gray-50 dark:hover:bg-gray-700/50 text-gray-700 dark:text-gray-300'
505513
}`}
506514
>
507515
<span className="text-sm font-medium">
508516
{category}
509517
</span>
510-
<span className="text-xs bg-gray-100 px-2 py-1 rounded-full">
518+
<span className="text-xs bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded-full">
511519
{count}
512520
</span>
513521
</button>

0 commit comments

Comments
 (0)