diff --git a/src/components/BlogHistory.tsx b/src/components/BlogHistory.tsx index 210b0c3a9..e7c0c2012 100644 --- a/src/components/BlogHistory.tsx +++ b/src/components/BlogHistory.tsx @@ -58,6 +58,7 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) { const [activeIndex, setActiveIndex] = React.useState(null); const [isHoveringBar, setIsHoveringBar] = React.useState(false); + const [tooltipOpacity, setTooltipOpacity] = React.useState(0); const getOptimalInterval = (months: Date[]) => { const totalMonths = months.length; @@ -66,6 +67,7 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) { if (totalMonths <= 8) return 1; // Show all labels if 8 or fewer months if (totalMonths <= 16) return 2; // Every 2 months if <= 16 months if (totalMonths <= 24) return 3; // Every quarter if <= 2 years + if (totalMonths <= 36) return 4; // Every 4 months if <= 3 years if (totalMonths <= 48) return 6; // Every 6 months if <= 4 years return 12; // Every year for longer periods }; @@ -99,9 +101,9 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) { year: "numeric", month: "short", }), - showLabel, + showLabel, // This property is already being set based on getOptimalInterval posts: postsInMonth, - ...postSizes, // Spread individual post sizes + ...postSizes, }; }); @@ -128,12 +130,24 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) { + - { @@ -161,6 +175,9 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) { borderRadius: "8px", boxShadow: "0 2px 10px rgba(0,0,0,0.1)", width: "600px", + opacity: tooltipOpacity, + transition: "all 1s ease-in-out", + transform: `translateY(${tooltipOpacity ? "0" : "10px"})`, }} >
@@ -256,9 +273,11 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) { onMouseOver={(_, index) => { setActiveIndex(i); setIsHoveringBar(true); + setTooltipOpacity(1); // Fade in }} onMouseLeave={() => { setIsHoveringBar(false); + setTooltipOpacity(0); // Fade out }} onClick={(entry, index) => { if (entry && monthlyData[index].posts[i]) {