1- import React , { useState } from "react" ;
1+ import React , { ReactNode , useState } from "react" ;
22import { Post } from "@site/src/data/posts" ;
3- import { FaBookmark } from "react-icons/fa" ;
3+ import { FaBookmark , FaClock , FaFire , FaHourglassStart } from "react-icons/fa" ;
44import { HiOutlineAdjustments } from "react-icons/hi" ;
55import { Tooltip } from "react-tooltip" ;
66
@@ -50,39 +50,27 @@ const NewsletterSidebar: React.FC<SidebarProps> = ({
5050 return acc ;
5151 } , { } ) ;
5252
53- return (
54- < aside className = "w-full md:w-64 p-4 sticky top-0 bg-white border-r border-gray-200 min-h-screen transition-all duration-300" >
55- { /* Collapse Toggle */ }
56- < button
57- onClick = { ( ) => setCollapsed ( ( c ) => ! c ) }
58- className = "w-full flex justify-between items-center px-4 py-2 text-sm font-medium text-white bg-gradient-to-r from-purple-600 to-indigo-600 rounded-md shadow hover:opacity-90 transition mb-4"
59- >
60- < span > { collapsed ? "Show Filters" : "Hide Filters" } </ span >
61- < svg
62- className = { `w-4 h-4 transform transition-transform duration-200 ${
63- collapsed ? "rotate-0" : "rotate-180"
64- } `}
65- fill = "none"
66- stroke = "currentColor"
67- strokeWidth = { 2 }
68- viewBox = "0 0 24 24"
69- >
70- < path strokeLinecap = "round" strokeLinejoin = "round" d = "M19 9l-7 7-7-7" />
71- </ svg >
72- </ button >
53+ const sortIcons : { [ key : string ] : ReactNode } = {
54+ Latest : < FaClock className = "text-sm mr-1" /> ,
55+ Popular : < FaFire className = "text-sm mr-1" /> ,
56+ Oldest : < FaHourglassStart className = "text-sm mr-1" /> ,
57+ } ;
7358
74- { ! collapsed && (
75- < div className = "space-y-5" >
59+ return (
60+ < aside className = "w-full md:w-64 p-4 sticky top-0 backdrop-blur-lg bg-white/70 shadow-xl borderborder-gray-200 min-h-screen transition-all duration-300" >
61+ < div className = "w-full mb-6" >
62+ < h3 className = "text-sm font-semibold text-gray-600 mb-2 pl-1 tracking-wide" > Sort By</ h3 >
7663 { /* Sort by */ }
77- < div className = "flex items-center gap-1 bg-gray-100 p-1 rounded-full shadow-inner border border-gray-200" >
64+ < div className = "flex flex-wrap items-center gap-2 bg-gray-100 p-2 rounded-xl shadow-inner border border-gray-200" >
7865 { [ "Latest" , "Popular" , "Oldest" ] . map ( ( option ) => (
7966 < button
8067 key = { option }
8168 onClick = { ( ) => setSortBy ( option as "Latest" | "Popular" | "Oldest" ) }
82- className = { `px-3 py-2 rounded-full text-sm font-medium transition-all duration-300 ${
83- sortBy === option ? "bg-black text-white shadow " : "text-gray-600 hover:bg-white "
69+ className = { `flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all duration-200 font-medium shadow-sm border whitespace-nowrap ${
70+ sortBy === option ? "bg-gradient-to-r from- black to-gray-800 text-white" : "bg-white text-gray-700 border-gray-300 hover:bg-gray-50 "
8471 } `}
8572 >
73+ { sortIcons [ option ] }
8674 { option }
8775 </ button >
8876 ) ) }
@@ -109,7 +97,7 @@ const NewsletterSidebar: React.FC<SidebarProps> = ({
10997 < >
11098 < div className = "relative group" >
11199 < button
112- className = "px-3 py-1.5 bg-gray-100 hover:bg-gray-200 rounded-md text-sm text-gray-700"
100+ className = "px-3 py-1.5 bg-gray-100 hover:bg-gray-200 rounded-md text-sm text-gray-700 relative z-10 "
113101 data-tooltip-id = "tag-tooltip"
114102 data-tooltip-html = { hiddenTags
115103 . map (
@@ -125,7 +113,7 @@ const NewsletterSidebar: React.FC<SidebarProps> = ({
125113 < Tooltip
126114 id = "tag-tooltip"
127115 place = "top"
128- className = "whitespace-pre-line z-50 max-w-xs text-sm "
116+ className = "backdrop-blur-md bg-white/80 border border-gray-300 shadow-lg rounded-lg text-gray-800 text-sm p-2 z-50 transition-all duration-300 "
129117 clickable
130118 />
131119 </ div >
@@ -154,8 +142,9 @@ const NewsletterSidebar: React.FC<SidebarProps> = ({
154142 : "bg-white text-gray-700 border-gray-300 hover:bg-gray-100"
155143 } `}
156144 >
157- < FaBookmark className = { showSavedOnly ? "text-green-600" : "text-gray-500" } />
158- { showSavedOnly ? "Showing Saved" : "Show Saved Only" }
145+ < FaBookmark className = { `transition-transform duration-200 ${ showSavedOnly ? 'scale-110 text-green-600' : 'text-gray-500 hover:text-black' } ` }
146+ />
147+ { showSavedOnly ? "Viewing Saved" : "View Saved" }
159148 </ button >
160149 </ div >
161150
@@ -174,13 +163,13 @@ const NewsletterSidebar: React.FC<SidebarProps> = ({
174163 { ( selectedTags . length > 0 || sortBy !== "Latest" || showSavedOnly ) && (
175164 < button
176165 onClick = { clearFilters }
177- className = "text-red-500 text-sm hover:underline hover:text-red-700 transition"
166+ className = "text-red-500 text-sm hover:text-red-700 transition animate-shake hover:animate-shake "
178167 >
179- Clear Filters
168+ Clear Filters
180169 </ button >
181170 ) }
182171 </ div >
183- ) }
172+
184173 </ aside >
185174 ) ;
186175} ;
0 commit comments