From 9c09a9d91efef2c6c4270a9ee48188bec583c3b4 Mon Sep 17 00:00:00 2001 From: Ariful Alam Date: Sun, 6 Jul 2025 17:12:37 +0600 Subject: [PATCH] Refactor card components for improved styling and icon updates --- src/components/blog-card/index.tsx | 60 ++++++++------- .../external-project-card/index.tsx | 51 ++++++++----- src/components/github-project-card/index.tsx | 73 +++++++++---------- src/components/publication-card/index.tsx | 51 ++++++++----- src/components/skill-card/index.tsx | 7 +- src/components/theme-changer/index.tsx | 2 +- 6 files changed, 132 insertions(+), 112 deletions(-) diff --git a/src/components/blog-card/index.tsx b/src/components/blog-card/index.tsx index 4c380df..e30dc9c 100644 --- a/src/components/blog-card/index.tsx +++ b/src/components/blog-card/index.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; import LazyImage from '../lazy-image'; -import { AiOutlineContainer } from 'react-icons/ai'; +import { PiNewspaper } from 'react-icons/pi'; import { getDevPost, getMediumPost } from '@arifszn/blog-js'; import { formatDistance } from 'date-fns'; import { SanitizedBlog } from '../../interfaces/sanitized-config'; @@ -38,7 +38,7 @@ const BlogCard = ({ const array = []; for (let index = 0; index < blog.limit; index++) { array.push( -
+
@@ -95,7 +95,7 @@ const BlogCard = ({ return articles && articles.length ? ( articles.slice(0, blog.limit).map((article, index) => ( { @@ -162,7 +162,7 @@ const BlogCard = ({ )) ) : (
- +

No recent post

@@ -172,34 +172,38 @@ const BlogCard = ({ return (
-
-
-
-
-
-
- {loading ? ( - skeleton({ widthCls: 'w-28', heightCls: 'h-8' }) - ) : ( - - My Articles - - )} -
-
-
-
- {loading || !articles ? renderSkeleton() : renderArticles()} +
+
+
+
+ {loading ? ( + skeleton({ + widthCls: 'w-12', + heightCls: 'h-12', + className: 'rounded-xl', + }) + ) : ( +
+
+ )} +
+

+ {loading + ? skeleton({ widthCls: 'w-28', heightCls: 'h-8' }) + : 'My Articles'} +

+

+ {loading + ? skeleton({ widthCls: 'w-32', heightCls: 'h-4' }) + : 'Recent posts'} +

+
+ {loading || !articles ? renderSkeleton() : renderArticles()} +
diff --git a/src/components/external-project-card/index.tsx b/src/components/external-project-card/index.tsx index 7fe3f22..972d1b4 100644 --- a/src/components/external-project-card/index.tsx +++ b/src/components/external-project-card/index.tsx @@ -1,5 +1,6 @@ import { Fragment } from 'react'; import LazyImage from '../lazy-image'; +import { MdOpenInNew } from 'react-icons/md'; import { ga, skeleton } from '../../utils'; import { SanitizedExternalProject } from '../../interfaces/sanitized-config'; @@ -18,7 +19,7 @@ const ExternalProjectCard = ({ const array = []; for (let index = 0; index < externalProjects.length; index++) { array.push( -
+
@@ -69,7 +70,7 @@ const ExternalProjectCard = ({ const renderExternalProjects = () => { return externalProjects.map((item, index) => ( { @@ -126,28 +127,38 @@ const ExternalProjectCard = ({ return (
-
-
-
-
-
-
- {loading ? ( - skeleton({ widthCls: 'w-40', heightCls: 'h-8' }) - ) : ( - - {header} - - )} -
-
-
-
- {loading ? renderSkeleton() : renderExternalProjects()} +
+
+
+
+ {loading ? ( + skeleton({ + widthCls: 'w-12', + heightCls: 'h-12', + className: 'rounded-xl', + }) + ) : ( +
+
+ )} +
+

+ {loading + ? skeleton({ widthCls: 'w-40', heightCls: 'h-8' }) + : header} +

+

+ {loading + ? skeleton({ widthCls: 'w-32', heightCls: 'h-4' }) + : `Showcasing ${externalProjects.length} external projects`} +

+
+ {loading ? renderSkeleton() : renderExternalProjects()} +
diff --git a/src/components/github-project-card/index.tsx b/src/components/github-project-card/index.tsx index 029a6e0..b8c9048 100644 --- a/src/components/github-project-card/index.tsx +++ b/src/components/github-project-card/index.tsx @@ -1,5 +1,5 @@ import { Fragment } from 'react'; -import { AiOutlineFork, AiOutlineStar } from 'react-icons/ai'; +import { AiOutlineFork, AiOutlineStar, AiOutlineGithub } from 'react-icons/ai'; import { MdInsertLink } from 'react-icons/md'; import { ga, getLanguageColor, skeleton } from '../../utils'; import { GithubProject } from '../../interfaces/github-project'; @@ -9,14 +9,12 @@ const GithubProjectCard = ({ githubProjects, loading, limit, - username, googleAnalyticsId, }: { header: string; githubProjects: GithubProject[]; loading: boolean; limit: number; - username: string; googleAnalyticsId?: string; }) => { if (!loading && githubProjects.length === 0) { @@ -27,7 +25,7 @@ const GithubProjectCard = ({ const array = []; for (let index = 0; index < limit; index++) { array.push( -
+
@@ -76,7 +74,7 @@ const GithubProjectCard = ({ const renderProjects = () => { return githubProjects.map((item, index) => ( { @@ -84,9 +82,7 @@ const GithubProjectCard = ({ try { if (googleAnalyticsId) { - ga.event('Click project', { - project: item.name, - }); + ga.event('Click project', { project: item.name }); } } catch (error) { console.error(error); @@ -136,40 +132,41 @@ const GithubProjectCard = ({ return (
-
-
-
-
- -
-
- {loading ? renderSkeleton() : renderProjects()} +
+
+ {/* Enhanced Header Section */} +
+
+ {loading ? ( + skeleton({ + widthCls: 'w-12', + heightCls: 'h-12', + className: 'rounded-xl', + }) + ) : ( +
+
+ )} +
+

+ {loading + ? skeleton({ widthCls: 'w-48', heightCls: 'h-8' }) + : header} +

+

+ {loading + ? skeleton({ widthCls: 'w-32', heightCls: 'h-4' }) + : `Showcasing ${githubProjects.length} featured repositories`} +

+ + {/* Projects Grid */} +
+ {loading ? renderSkeleton() : renderProjects()} +
diff --git a/src/components/publication-card/index.tsx b/src/components/publication-card/index.tsx index e7d339e..49610b3 100644 --- a/src/components/publication-card/index.tsx +++ b/src/components/publication-card/index.tsx @@ -1,4 +1,5 @@ import { Fragment } from 'react'; +import { AiOutlineBook } from 'react-icons/ai'; import { SanitizedPublication } from '../../interfaces/sanitized-config'; import { skeleton } from '../../utils'; @@ -13,7 +14,7 @@ const PublicationCard = ({ const array = []; for (let index = 0; index < publications.length; index++) { array.push( -
+
@@ -76,7 +77,7 @@ const PublicationCard = ({ const renderPublications = () => { return publications.map((item, index) => (
-
-
-
-
-
-
- {loading ? ( - skeleton({ widthCls: 'w-40', heightCls: 'h-8' }) - ) : ( - - Publications - - )} -
-
-
-
- {loading ? renderSkeleton() : renderPublications()} +
+
+
+
+ {loading ? ( + skeleton({ + widthCls: 'w-12', + heightCls: 'h-12', + className: 'rounded-xl', + }) + ) : ( +
+
+ )} +
+

+ {loading + ? skeleton({ widthCls: 'w-40', heightCls: 'h-8' }) + : 'Publications'} +

+

+ {loading + ? skeleton({ widthCls: 'w-32', heightCls: 'h-4' }) + : `Showcasing ${publications.length} publications`} +

+
+ {loading ? renderSkeleton() : renderPublications()} +
diff --git a/src/components/skill-card/index.tsx b/src/components/skill-card/index.tsx index d8f2752..666ca2e 100644 --- a/src/components/skill-card/index.tsx +++ b/src/components/skill-card/index.tsx @@ -33,14 +33,11 @@ const SkillCard = ({
-
+
{loading ? renderSkeleton() : skills.map((skill, index) => ( -
+
{skill}
))} diff --git a/src/components/theme-changer/index.tsx b/src/components/theme-changer/index.tsx index 35d90c4..8289c33 100644 --- a/src/components/theme-changer/index.tsx +++ b/src/components/theme-changer/index.tsx @@ -65,7 +65,7 @@ const ThemeChanger = ({
{loading ? ( skeleton({ - widthCls: 'w-14 md:w-28', + widthCls: 'w-12', heightCls: 'h-10', className: 'mr-6', })