Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
492 changes: 179 additions & 313 deletions app/blogs/Content/dsaDifferent/content.jsx

Large diffs are not rendered by default.

413 changes: 173 additions & 240 deletions app/blogs/Content/dsaWebDev/content.jsx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/blogs/Content/timeRequired/.next/trace
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"generate-buildid","duration":164,"timestamp":9284183925,"id":4,"parentId":1,"tags":{},"startTime":1787298771578,"traceId":"8c2b8dc63e5595cb"},{"name":"load-custom-routes","duration":214,"timestamp":9284184152,"id":5,"parentId":1,"tags":{},"startTime":1787298771578,"traceId":"8c2b8dc63e5595cb"},{"name":"create-dist-dir","duration":4215,"timestamp":9284184381,"id":6,"parentId":1,"tags":{},"startTime":1787298771579,"traceId":"8c2b8dc63e5595cb"},{"name":"clean","duration":1317,"timestamp":9284191456,"id":7,"parentId":1,"tags":{},"startTime":1787298771586,"traceId":"8c2b8dc63e5595cb"},{"name":"next-build","duration":109137,"timestamp":9284084427,"id":1,"tags":{"buildMode":"default","version":"16.2.12","bundler":"turbopack","failed":true},"startTime":1787298771478,"traceId":"8c2b8dc63e5595cb"}]
1 change: 1 addition & 0 deletions app/blogs/Content/timeRequired/.next/trace-build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"next-build","duration":109137,"timestamp":9284084427,"id":1,"tags":{"buildMode":"default","version":"16.2.12","bundler":"turbopack","failed":true},"startTime":1787298771478,"traceId":"8c2b8dc63e5595cb"}]
510 changes: 268 additions & 242 deletions app/blogs/Content/timeRequired/content.jsx

Large diffs are not rendered by default.

431 changes: 189 additions & 242 deletions app/blogs/Content/whatIsDS/content.jsx

Large diffs are not rendered by default.

64 changes: 28 additions & 36 deletions app/blogs/blogPage.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
"use client";
import { useState, useEffect, useRef } from "react";
import { useState } from "react";
import Link from "next/link";
import Image from "next/image";
import {
FiClock,
FiCalendar,
FiArrowRight,
} from "react-icons/fi";
import { motion, AnimatePresence } from "framer-motion";
import { motion } from "framer-motion";
import PopularTopics from "@/app/blogs/components/PopularTopics";
import blogData from "@/app/blogs/data/blogs.json";

const BlogPage = () => {
// State management
const [searchQuery, setSearchQuery] = useState("");
const [activeCategory, setActiveCategory] = useState("All");
const [isSearchFocused, setIsSearchFocused] = useState(false);
const searchRef = useRef(null);

// Filtered blogs
const filteredBlogs = blogData.filter((blog) => {
Expand All @@ -40,30 +39,11 @@ const BlogPage = () => {
.sort((a, b) => new Date(b.date) - new Date(a.date))
.slice(0, 4);

// Popular tags
const popularTags = [
"React",
"JavaScript",
"CSS",
"TypeScript",
"Web Dev",
"Performance",
"DSA",
];

// Handle click outside search
useEffect(() => {
const handleClickOutside = (event) => {
if (searchRef.current && !searchRef.current.contains(event.target)) {
setIsSearchFocused(false);
}
};
document.addEventListener("mousedown", handleClickOutside);
return () => document.removeEventListener("mousedown", handleClickOutside);
}, []);
// Popular tags, taken from the posts themselves so every chip returns results
const popularTags = [...new Set(blogData.flatMap((blog) => blog.tags))];

return (
<div className="min-h-screen bg-gradient-to-br from-zinc-50 to-zinc-100 dark:from-zinc-900 dark:to-zinc-950">
<div className="min-h-screen bg-linear-to-br from-zinc-50 to-zinc-100 dark:from-zinc-900 dark:to-zinc-950">
<main className="container mx-auto max-w-6xl px-6 pt-32 pb-20">
{/* Hero Section */}
<section className="mb-20 text-center">
Expand All @@ -74,7 +54,7 @@ const BlogPage = () => {
className="text-5xl mt-10 md:text-5xl font-bold text-zinc-800 dark:text-white mb-6 leading-tight"
>
Insights for{" "}
<span className="bg-gradient-to-r from-blue-600 to-blue-400 bg-clip-text text-transparent">
<span className="bg-linear-to-r from-blue-600 to-blue-400 bg-clip-text text-transparent">
Modern Developers
</span>
</motion.h1>
Expand All @@ -88,7 +68,10 @@ const BlogPage = () => {
programming, and more.
</motion.p>

{/* Email Subscribe Section */}
{/* Email Subscribe Section — hidden until the mailing list backend
exists. The form has no submit handler yet, so re-enable this
only once there is somewhere for the address to go. */}
{/*
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
Expand All @@ -111,6 +94,7 @@ const BlogPage = () => {
By clicking "Subscribe", you agree to receive updates when new blogs are published.
</p>
</motion.div>
*/}
</section>

{/* Featured Posts */}
Expand All @@ -134,10 +118,13 @@ const BlogPage = () => {
>
<Link href={featuredPosts[0].slug}>
<div className="relative h-64 w-full overflow-hidden">
<img
<Image
src={featuredPosts[0].image}
alt={featuredPosts[0].title}
className="w-full h-full object-cover transition-transform duration-500 hover:scale-105"
fill
sizes="(min-width: 1024px) 50vw, 100vw"
priority
className="object-cover transition-transform duration-500 hover:scale-105"
/>
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent" />
<span className="absolute top-4 right-4 bg-blue-600 text-white text-xs font-medium px-2.5 py-1 rounded-full">
Expand Down Expand Up @@ -182,11 +169,13 @@ const BlogPage = () => {
whileHover={{ y: -5 }}
className="flex gap-4 items-start bg-white dark:bg-zinc-800 rounded-xl p-4 shadow hover:shadow-md transition-shadow border border-zinc-100 dark:border-zinc-700/50"
>
<div className="w-32 h-24 overflow-hidden rounded-md">
<img
<div className="relative w-32 h-24 shrink-0 overflow-hidden rounded-md">
<Image
src={post.image}
alt={post.title}
className="w-full h-full object-cover transition-transform duration-500 hover:scale-105"
fill
sizes="128px"
className="object-cover transition-transform duration-500 hover:scale-105"
/>
</div>
<div className="flex-1">
Expand All @@ -212,6 +201,7 @@ const BlogPage = () => {
{/* Popular Tags */}
<PopularTopics
tags={popularTags}
value={searchQuery}
onTagClick={(tag) => {
setSearchQuery(tag);
setActiveCategory("All");
Expand Down Expand Up @@ -262,10 +252,12 @@ const BlogPage = () => {
<Link href={post.slug}>
<div className="flex flex-col h-full">
<div className="aspect-video overflow-hidden relative">
<img
<Image
src={post.image}
alt={post.title}
className="w-full h-full object-cover transition-transform duration-500 hover:scale-105"
fill
sizes="(min-width: 1024px) 33vw, (min-width: 768px) 50vw, 100vw"
className="object-cover transition-transform duration-500 hover:scale-105"
/>
</div>
<div className="p-5 flex flex-col gap-3 flex-grow">
Expand Down Expand Up @@ -306,7 +298,7 @@ const BlogPage = () => {
No articles found
</h3>
<p className="text-zinc-500 dark:text-zinc-400 mb-6 max-w-md mx-auto">
We couldn't find any articles matching your search. Try a
We couldn{"\'"}t find any articles matching your search. Try a
different term or browse our categories.
</p>
<button
Expand Down
5 changes: 3 additions & 2 deletions app/blogs/components/PopularTopics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import { motion } from 'framer-motion';
import { useState } from 'react';

const PopularTopics = ({ tags, onTagClick }) => {
const PopularTopics = ({ tags, value = "", onTagClick }) => {
const [showFilters, setShowFilters] = useState(false);
return (
<section className="mt-20 mb-5">
<h2 className="text-3xl font-medium text-zinc-800 dark:text-white mb-2">
Explore Popular Topics
</h2>
<div className='h-[2px] max-w-6xl rounded-full bg-gradient-to-l from-zinc-600 via-black to-zinc-600 mb-6'></div>
<div className='h-[2px] max-w-6xl rounded-full bg-gradient-to-r from-blue-500 via-blue-400 to-transparent dark:from-blue-500 dark:via-blue-600 dark:to-transparent mb-6'></div>
<div className="mb-6 flex flex-col md:flex-row items-center justify-center gap-4 max-w-4xl mx-auto">
<div className="relative w-full md:w-2/3">
<span className="absolute inset-y-0 left-3 flex items-center pointer-events-none text-zinc-500 dark:text-zinc-400">
Expand All @@ -20,6 +20,7 @@ const PopularTopics = ({ tags, onTagClick }) => {
<input
type="text"
placeholder="Search articles..."
value={value}
onChange={(e) => onTagClick(e.target.value)}
className="w-full pl-10 pr-4 py-2 rounded-lg border border-zinc-300 dark:border-zinc-700 bg-white dark:bg-zinc-800 text-zinc-800 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500"
/>
Expand Down
Loading