From 343a0e93c915121e4fcdddea9dd2e493535e6c58 Mon Sep 17 00:00:00 2001
From: parsa aghaei
Date: Sun, 20 Oct 2024 17:44:16 +0330
Subject: [PATCH] homePage aboutMe component updated for Clean Code
---
.../(website)/components/aboutMe/aboutMe.tsx | 67 +++++--------------
src/app/types/types.ts | 22 ++++++
2 files changed, 37 insertions(+), 52 deletions(-)
diff --git a/src/app/(routes)/(website)/components/aboutMe/aboutMe.tsx b/src/app/(routes)/(website)/components/aboutMe/aboutMe.tsx
index 283c633..4cb40a2 100644
--- a/src/app/(routes)/(website)/components/aboutMe/aboutMe.tsx
+++ b/src/app/(routes)/(website)/components/aboutMe/aboutMe.tsx
@@ -1,35 +1,11 @@
+import { AboutMeDataType } from "@/app/types/types";
import React from "react";
import Skeleton from "react-loading-skeleton";
import "react-loading-skeleton/dist/skeleton.css";
-type SkillType = {
- id: 1;
- title: string;
- image: string;
- description: string;
- link: string;
- percentage: number;
- about_me_id: number;
- created_at: string;
- updated_at: string;
-};
-
-type AboutMeDataType = {
- id: number;
- title: string;
- description: string;
- image: string;
- created_at: string;
- updated_at: string;
- skills: SkillType[];
-};
-
export default async function AboutMe() {
const aboutMeData: AboutMeDataType = await fetch(
`${process.env.NEXT_PUBLIC_FRONT_URL}/api/website/about-me`,
- {
- cache: "no-store",
- },
).then((res) => res.json());
return (
@@ -45,35 +21,22 @@ export default async function AboutMe() {
{aboutMeData?.description || }
- {aboutMeData?.skills ? (
- aboutMeData?.skills.map((skill, key) => (
- -
-
{skill.title}
-
-
-
-
- ))
- ) : (
- <>
-
-
-
-
- >
- )}
+ {aboutMeData.skills.map((skill, index) => (
+ -
+
{skill.title}
+
+
+
+
+ ))}
- {aboutMeData?.image ? (
-
-

-
- ) : (
-
- )}
+
+

+
);
}
diff --git a/src/app/types/types.ts b/src/app/types/types.ts
index b017e90..cbdc58a 100644
--- a/src/app/types/types.ts
+++ b/src/app/types/types.ts
@@ -170,3 +170,25 @@ export type Dictionary = {
CopyRight: string;
};
};
+
+export type SkillType = {
+ id: 1;
+ title: string;
+ image: string;
+ description: string;
+ link: string;
+ percentage: number;
+ about_me_id: number;
+ created_at: string;
+ updated_at: string;
+};
+
+export type AboutMeDataType = {
+ id: number;
+ title: string;
+ description: string;
+ image: string;
+ created_at: string;
+ updated_at: string;
+ skills: SkillType[];
+};