From 44497619fce83f7ecb492bb0d0b91635fdb6aaa0 Mon Sep 17 00:00:00 2001 From: Abumahid Islam Date: Wed, 6 May 2026 19:29:40 +0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20refactor(pages):=20rearrange=20i?= =?UTF-8?q?mports=20and=20formatting=20for=20Blog,=20BlogArticle,=20Projec?= =?UTF-8?q?tDetails,=20and=20Projects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit organizes import statements and standardizes code formatting across the Blog, BlogArticle, ProjectDetails, and Projects pages. Improvements include consistent spacing, use of double quotes, and more readable conditional rendering, contributing to better maintainability and readability of the codebase. --- src/pages/Blog.tsx | 68 ++++++++-------- src/pages/BlogArticle.tsx | 154 +++++++++++++++++++++++++---------- src/pages/ProjectDetails.tsx | 98 +++++++++++++++------- src/pages/Projects.tsx | 80 ++++++++++-------- 4 files changed, 257 insertions(+), 143 deletions(-) diff --git a/src/pages/Blog.tsx b/src/pages/Blog.tsx index d858faa..6938bb1 100644 --- a/src/pages/Blog.tsx +++ b/src/pages/Blog.tsx @@ -1,15 +1,19 @@ -import { useState } from 'react'; -import { motion } from 'framer-motion'; -import { ArrowLeft, Calendar, Clock, User, Search } from 'lucide-react'; -import { Link } from 'react-router-dom'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import Navbar from '@/components/Navbar'; -import Footer from '@/components/Footer'; -import PageTransition from '@/components/PageTransition'; -import { useBlogs } from './../hooks/queires/useBlogs'; +import PageTransition from "@/components/PageTransition"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { motion } from "framer-motion"; +import { ArrowLeft, Calendar, Clock, Search, User } from "lucide-react"; +import { useState } from "react"; +import { Link } from "react-router-dom"; +import { useBlogs } from "./../hooks/queires/useBlogs"; -const categories = ['All', 'AI & Machine Learning', 'Cloud Solutions', 'Web Development', 'Mobile Development']; +const categories = [ + "All", + "AI & Machine Learning", + "Cloud Solutions", + "Web Development", + "Mobile Development", +]; const containerVariants = { hidden: { opacity: 0 }, @@ -24,23 +28,22 @@ const itemVariants = { visible: { opacity: 1, y: 0, - transition: { duration: 0.5, ease: 'easeOut' as const }, + transition: { duration: 0.5, ease: "easeOut" as const }, }, }; export default function Blog() { - - const {data} = useBlogs(); + const { data } = useBlogs(); const blogPosts = data?.data.result; - + const [activeCategory, setActiveCategory] = useState("All"); + const [searchQuery, setSearchQuery] = useState(""); - const [activeCategory, setActiveCategory] = useState('All'); - const [searchQuery, setSearchQuery] = useState(''); - - const filteredPosts = blogPosts?.filter(post => { - const matchesCategory = activeCategory === 'All' || post.category === activeCategory; - const matchesSearch = post.title.toLowerCase().includes(searchQuery.toLowerCase()) || + const filteredPosts = blogPosts?.filter((post) => { + const matchesCategory = + activeCategory === "All" || post.category === activeCategory; + const matchesSearch = + post.title.toLowerCase().includes(searchQuery.toLowerCase()) || post.excerpt.toLowerCase().includes(searchQuery.toLowerCase()); return matchesCategory && matchesSearch; }); @@ -48,8 +51,6 @@ export default function Blog() { return (
- - {/* Hero Section */}
@@ -81,7 +82,8 @@ export default function Blog() { Our Blog

- Insights, tutorials, and thought leadership from our team of experts. + Insights, tutorials, and thought leadership from our team of + experts.

@@ -114,12 +116,13 @@ export default function Blog() { {categories.map((category) => ( @@ -171,7 +174,10 @@ export default function Blog() { - {new Date(post.date).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })} + {new Date(post.date).toLocaleDateString("en-US", { + month: "short", + day: "numeric", + })} @@ -197,8 +203,6 @@ export default function Blog() { )}
- -
); diff --git a/src/pages/BlogArticle.tsx b/src/pages/BlogArticle.tsx index ff61a7b..1d37d3b 100644 --- a/src/pages/BlogArticle.tsx +++ b/src/pages/BlogArticle.tsx @@ -1,21 +1,27 @@ -import { useParams, Link, useNavigate } from 'react-router-dom'; -import { motion } from 'framer-motion'; -import { ArrowLeft, Calendar, Clock, Twitter, Linkedin, Facebook, Link2 } from 'lucide-react'; -import { Button } from '@/components/ui/button'; -import { toast } from 'sonner'; -import ReactMarkdown from 'react-markdown'; -import remarkGfm from 'remark-gfm'; -import Navbar from '@/components/Navbar'; -import Footer from '@/components/Footer'; -import PageTransition from '@/components/PageTransition'; -import { getPostBySlug, getRelatedPosts } from '@/data/blogData'; -import { useBlogById } from '@/hooks/queires/useBlogs'; +import PageTransition from "@/components/PageTransition"; +import { Button } from "@/components/ui/button"; +import { getRelatedPosts } from "@/data/blogData"; +import { useBlogById } from "@/hooks/queires/useBlogs"; +import { motion } from "framer-motion"; +import { + ArrowLeft, + Calendar, + Clock, + Facebook, + Link2, + Linkedin, + Twitter, +} from "lucide-react"; +import ReactMarkdown from "react-markdown"; +import { Link, useNavigate, useParams } from "react-router-dom"; +import remarkGfm from "remark-gfm"; +import { toast } from "sonner"; export default function BlogArticle() { const { id } = useParams<{ id: string }>(); - const {data} = useBlogById(id); + const { data } = useBlogById(id); - const post = data?.data.data + const post = data?.data.data; const navigate = useNavigate(); // const post = getPostBySlug(id || ''); @@ -25,8 +31,10 @@ export default function BlogArticle() {

Article Not Found

-

The article you're looking for doesn't exist.

- +

+ The article you're looking for doesn't exist. +

+
@@ -43,19 +51,17 @@ export default function BlogArticle() { facebook: `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(shareUrl)}`, }; - if (platform === 'copy') { + if (platform === "copy") { navigator.clipboard.writeText(shareUrl); - toast.success('Link copied to clipboard!'); + toast.success("Link copied to clipboard!"); } else { - window.open(urls[platform], '_blank', 'width=600,height=400'); + window.open(urls[platform], "_blank", "width=600,height=400"); } }; return (
- - {/* Hero */}
@@ -110,13 +116,19 @@ export default function BlogArticle() { className="w-10 h-10 rounded-full object-cover border-2 border-primary/50" />
-

{post.author.name}

+

+ {post.author.name} +

{post.author.role}

- {new Date(post.date).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })} + {new Date(post.date).toLocaleDateString("en-US", { + month: "long", + day: "numeric", + year: "numeric", + })} @@ -154,17 +166,57 @@ export default function BlogArticle() {

{children}

, - h2: ({ children }) =>

{children}

, - h3: ({ children }) =>

{children}

, - h4: ({ children }) =>

{children}

, - p: ({ children }) =>

{children}

, - ul: ({ children }) =>
    {children}
, - ol: ({ children }) =>
    {children}
, - li: ({ children }) =>
  • {children}
  • , - a: ({ href, children }) => {children}, - strong: ({ children }) => {children}, - em: ({ children }) => {children}, + h1: ({ children }) => ( +

    + {children} +

    + ), + h2: ({ children }) => ( +

    + {children} +

    + ), + h3: ({ children }) => ( +

    + {children} +

    + ), + h4: ({ children }) => ( +

    + {children} +

    + ), + p: ({ children }) => ( +

    + {children} +

    + ), + ul: ({ children }) => ( +
      + {children} +
    + ), + ol: ({ children }) => ( +
      + {children} +
    + ), + li: ({ children }) => ( +
  • {children}
  • + ), + a: ({ href, children }) => ( + + {children} + + ), + strong: ({ children }) => ( + + {children} + + ), + em: ({ children }) => ( + {children} + ), blockquote: ({ children }) => (
    {children} @@ -173,7 +225,11 @@ export default function BlogArticle() { code: ({ className, children }) => { const isInline = !className; if (isInline) { - return {children}; + return ( + + {children} + + ); } return ( @@ -181,7 +237,11 @@ export default function BlogArticle() { ); }, - pre: ({ children }) =>
    {children}
    , + pre: ({ children }) => ( +
    +                        {children}
    +                      
    + ), hr: () =>
    , }} > @@ -194,12 +254,14 @@ export default function BlogArticle() {
    {/* Share */}
    -

    Share

    +

    + Share +

    )} - -
    ); diff --git a/src/pages/ProjectDetails.tsx b/src/pages/ProjectDetails.tsx index c6fe2d3..0720b41 100644 --- a/src/pages/ProjectDetails.tsx +++ b/src/pages/ProjectDetails.tsx @@ -1,18 +1,23 @@ -import { useParams, Link, useNavigate } from 'react-router-dom'; -import { motion } from 'framer-motion'; -import { ArrowLeft, ExternalLink, Github, Calendar, Clock, Users, ChevronRight } from 'lucide-react'; -import { Button } from '@/components/ui/button'; -import ReactMarkdown from 'react-markdown'; -import remarkGfm from 'remark-gfm'; -import Navbar from '@/components/Navbar'; -import Footer from '@/components/Footer'; -import PageTransition from '@/components/PageTransition'; -import { getProjectBySlug, getRelatedProjects } from '@/data/projectData'; +import PageTransition from "@/components/PageTransition"; +import { Button } from "@/components/ui/button"; +import { getProjectBySlug, getRelatedProjects } from "@/data/projectData"; +import { motion } from "framer-motion"; +import { + Calendar, + ChevronRight, + Clock, + ExternalLink, + Github, + Users, +} from "lucide-react"; +import ReactMarkdown from "react-markdown"; +import { Link, useNavigate, useParams } from "react-router-dom"; +import remarkGfm from "remark-gfm"; export default function ProjectDetails() { const { slug } = useParams<{ slug: string }>(); const navigate = useNavigate(); - const project = getProjectBySlug(slug || ''); + const project = getProjectBySlug(slug || ""); if (!project) { return ( @@ -20,8 +25,12 @@ export default function ProjectDetails() {

    Project Not Found

    -

    The project you're looking for doesn't exist.

    - +

    + The project you're looking for doesn't exist. +

    +
    @@ -30,17 +39,15 @@ export default function ProjectDetails() { const relatedProjects = getRelatedProjects(project); const categoryLabels: Record = { - web: 'Web Development', - mobile: 'Mobile App', - ai: 'AI & Machine Learning', - cloud: 'Cloud Solutions', + web: "Web Development", + mobile: "Mobile App", + ai: "AI & Machine Learning", + cloud: "Cloud Solutions", }; return (
    - - {/* Hero */}
    @@ -56,9 +63,16 @@ export default function ProjectDetails() { transition={{ duration: 0.5 }} className="flex items-center gap-2 text-sm text-muted-foreground mb-8" > - Home + + Home + - Projects + + Projects + {project.title} @@ -132,7 +146,10 @@ export default function ProjectDetails() { View Live - @@ -181,7 +198,9 @@ export default function ProjectDetails() {

    {result.value}

    -

    {result.label}

    +

    + {result.label} +

    ))}
    @@ -203,10 +222,24 @@ export default function ProjectDetails() {

    {children}

    , - strong: ({ children }) => {children}, - ul: ({ children }) =>
      {children}
    , - li: ({ children }) =>
  • {children}
  • , + p: ({ children }) => ( +

    + {children} +

    + ), + strong: ({ children }) => ( + + {children} + + ), + ul: ({ children }) => ( +
      + {children} +
    + ), + li: ({ children }) => ( +
  • {children}
  • + ), }} > {project.fullDescription} @@ -262,7 +295,9 @@ export default function ProjectDetails() { {project.challenges.map((challenge, index) => (
  • - {challenge} + + {challenge} +
  • ))} @@ -356,7 +391,10 @@ export default function ProjectDetails() { className="text-center mt-12" > - @@ -364,8 +402,6 @@ export default function ProjectDetails() {
    )} - -