header is responsive now

This commit is contained in:
parsa aghaei committed 2024-09-23 16:31:48 +03:30
1 parent f984d61091
commit 3e757c5481
124 files changed
+238 -402

No files matched your search

+85 -40
View File
@@ -1,56 +1,101 @@
"use client";
import Image from "next/image";
import React from "react";
import React, { useEffect, useState } from "react";
import Skeleton from "react-loading-skeleton";
import "react-loading-skeleton/dist/skeleton.css";
type Skill = {
id: 1;
title: string;
image: string;
description: string;
link: string;
percentage: number;
about_me_id: number;
created_at: string;
updated_at: string;
};
type AboutMeData = {
id: number;
title: string;
description: string;
image: string;
created_at: string;
updated_at: string;
skills: Skill[];
};
export default function AboutMe() {
const [aboutMe, setAboutMe] = useState<AboutMeData | null>(null);
useEffect(() => {
const fetchAboutMeData = async () => {
const res = await fetch("/api/about-me");
if (res.ok) {
const data = await res.json();
// اطمینان از وجود skills
setAboutMe(data); // بروزرسانی aboutMe با آرایه skills
} else {
console.error("Failed to fetch about me data");
}
};
fetchAboutMeData()
}, []);
// if (!aboutMe) {
// return <Skeleton width={40} height={10} />; // نمایش بارگذاری
// }
return (
<div
className="flex flex-nowrap items-center justify-between"
id="about-me"
>
<div className="img-container">
<div className="top-half-circle">
<Image
src={"/images/profile.png"}
alt="profile picture"
width={538}
height={617}
className="bottom-0"
/>
{aboutMe?.image ? (
<div className="img-container">
<div className="top-half-circle">
<Image
src={aboutMe.image}
alt="profile picture"
width={538}
height={617}
className="bottom-0"
/>
</div>
<div className="bottom-half-circle"></div>
</div>
<div className="bottom-half-circle"></div>
</div>
) : (
<Skeleton circle={true} width={538} height={538} />
)}
<div className="ms-[105px] flex w-[756px] flex-col items-start">
<h2 className="text-[65px] font-[600] text-black">About Me</h2>
<h2 className="text-[65px] font-[600] text-black">
{aboutMe?.title || <Skeleton width={300} height={100} />}
</h2>
<p className="text-[21px] font-[400] text-black">
Lorem ipsum dolor sit amet consectetur. Tristique amet sed massa nibh
lectus netus in. Aliquet donec morbi convallis pretium. Turpis tempus
pharetra
{aboutMe?.description || <Skeleton width={350} height={30} />}
</p>
<ul className="mt-10 flex flex-col gap-10">
<li>
<h3 className="mb-2">UI</h3>
<div className="h relative h-[12px] w-[753px] rounded-lg bg-[#EDECEC]">
<span className="progress absolute h-[12px] w-[50%] rounded-lg bg-[#FD6F00]"></span>
</div>
</li>
<li>
<h3 className="mb-2">UX</h3>
<div className="h relative h-[12px] w-[753px] rounded-lg bg-[#EDECEC]">
<span className="progress absolute h-[12px] w-[80%] rounded-lg bg-[#FD6F00]"></span>
</div>
</li>
<li>
<h3 className="mb-2">Fronend</h3>
<div className="h relative h-[12px] w-[753px] rounded-lg bg-[#EDECEC]">
<span className="progress absolute h-[12px] w-[95%] rounded-lg bg-[#FD6F00]"></span>
</div>
</li>
<li>
<h3 className="mb-2">Backend</h3>
<div className="h relative h-[12px] w-[753px] rounded-lg bg-[#EDECEC]">
<span className="progress absolute h-[12px] w-[90%] rounded-lg bg-[#FD6F00]"></span>
</div>
</li>
{aboutMe?.skills ? (
aboutMe?.skills.map((skill, key) => (
<li key={key}>
<h3 className="mb-2">{skill.title}</h3>
<div className="h relative h-[12px] w-[753px] rounded-lg bg-[#EDECEC]">
<span
className="progress absolute h-[12px] rounded-lg bg-[#FD6F00]"
style={{ width: `${skill.percentage}%` }}
></span>
</div>
</li>
))
) : (
<>
<Skeleton width={750} height={50} />
<Skeleton width={750} height={50} />
<Skeleton width={750} height={50} />
<Skeleton width={750} height={50} />
</>
)}
</ul>
</div>
</div>
+75 -326
View File
@@ -1,6 +1,8 @@
"use client";
import Image from "next/image";
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import Skeleton from "react-loading-skeleton";
import "react-loading-skeleton/dist/skeleton.css";
type Category = {
label: string;
@@ -14,313 +16,56 @@ type Image = {
};
type Project = {
id: number;
title: string;
category: string;
images: Image[];
images: { src: string; position: string; zIndex: number }[];
created_at: string;
updated_at: string;
};
const categories: Category[] = [
{ label: "All", active: false },
{ label: "UI/UX", active: false },
{ label: "Web Design", active: true },
{ label: "App Design", active: false },
{ label: "Graphic Design", active: false },
];
const projects: Project[] = [
{
title: "AirCalling Landing Page Design",
category: "Web Design",
images: [
{
src: "/images/web-design-11.png",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/web-design-12.png",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Business Landing Page Design",
category: "Web Design",
images: [
{
src: "/images/web-design-21.png",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/web-design-22.png",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Ecom Web Page Design",
category: "Web Design",
images: [
{
src: "/images/web-design-31.png",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/web-design-32.png",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Creative Portfolio Design",
category: "Web Design",
images: [
{
src: "/images/web-design-11.png",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/web-design-12.png",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Personal Blog Design",
category: "Web Design",
images: [
{
src: "/images/web-design-21.png",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/web-design-22.png",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Mobile App Design",
category: "App Design",
images: [
{
src: "/images/app-design-11.jpg",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/app-design-12.jpg",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Task Management App Design",
category: "App Design",
images: [
{
src: "/images/app-design-21.png",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/app-design-22.png",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "E-Commerce App Design",
category: "App Design",
images: [
{
src: "/images/app-design-31.jpg",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/app-design-32.jpg",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Fitness Tracker App Design",
category: "App Design",
images: [
{
src: "/images/app-design-11.jpg",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/app-design-12.jpg",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Music Streaming App Design",
category: "App Design",
images: [
{
src: "/images/app-design-21.png",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/app-design-22.png",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Creative Poster Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-11.webp",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-12.webp",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Marketing Flyer Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-21.webp",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-22.webp",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Event Invitation Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-31.avif",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-33.jpeg",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Magazine Cover Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-21.webp",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-22.webp",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Magazine Cover Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-21.webp",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-22.webp",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Magazine Cover Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-21.webp",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-22.webp",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Magazine Cover Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-21.webp",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-22.webp",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
{
title: "Brand Identity Design",
category: "Graphic Design",
images: [
{
src: "/images/graphic-design-11.webp",
position: "bottom-[-5px] left-[-5px]",
zIndex: 20,
},
{
src: "/images/graphic-design-12.webp",
position: "top-[-5px] right-[-5px]",
zIndex: 10,
},
],
},
];
export default function MyProjects() {
const [categories, setCategories] = useState<Category[]>([]);
const [projects, setProjects] = useState<Project[]>([]);
const [selectedCategory, setSelectedCategory] = useState<string>("All");
useEffect(() => {
const fetchProjects = async () => {
const res = await fetch("/api/projects");
const data: {
id: number;
title: string;
images: string;
category: string;
created_at: string;
updated_at: string;
}[] = await res.json();
// Convert JSON string to array
const updatedData = data.map((project) => ({
...project,
images: JSON.parse(project.images),
}));
setProjects(updatedData);
// Extract unique categories
const uniqueCategories: Category[] = [
{ label: "All", active: false },
...Array.from(
new Set(updatedData.map((project) => project.category)),
).map((category) => ({
label: category,
active: false,
})),
];
setCategories(uniqueCategories);
};
fetchProjects();
}, []);
// Group projects by category
const groupProjectsByCategory = (projects: Project[]) => {
return projects.reduce<Record<string, Project[]>>((acc, project) => {
@@ -374,21 +119,30 @@ export default function MyProjects() {
est risus lectus. Phasellus consequat urna tellus
</p>
<ul className="mb-10 mt-20 flex items-center justify-center gap-5">
{categories.map((category, index) => (
<li
key={index}
onClick={() => setSelectedCategory(category.label)}
className={`rounded-md border border-[#545454] bg-[#F8F8F8] px-[20px] py-[10px] text-[24px] font-[400] hover:cursor-pointer hover:border-[#FD6F00] ${
selectedCategory === category.label
? "bg-[#FD6F00] text-[#FFFFFF]"
: "text-[#000]"
}`}
>
{category.label}
</li>
))}
{categories.length > 0 ? (
categories.map((category, index) => (
<li
key={index}
onClick={() => setSelectedCategory(category.label)}
className={`rounded-md border border-[#545454] bg-[#F8F8F8] px-[20px] py-[10px] text-[24px] font-[400] hover:cursor-pointer hover:border-[#FD6F00] ${
selectedCategory === category.label
? "bg-[#FD6F00] text-[#FFFFFF]"
: "text-[#000]"
}`}
>
{category.label}
</li>
))
) : (
<div className="flex gap-5">
<Skeleton width={200} height={60} />
<Skeleton width={200} height={60} />
<Skeleton width={200} height={60} />
<Skeleton width={200} height={60} />
</div>
)}
</ul>
<div className="flex w-[1420px] flex-wrap items-center justify-between gap-[30px]">
<div className="flex w-[1420px] flex-wrap items-start justify-between gap-[30px]">
{filteredProjects.length > 0 ? (
filteredProjects.map((project, index) => (
<div key={index} className="project flex w-[445px] flex-wrap">
@@ -398,7 +152,7 @@ export default function MyProjects() {
key={idx}
src={image.src}
alt="UI/UX Vector"
className={`absolute ${image.position} z-${image.zIndex} max-w-[350px]`}
className={`absolute ${image.position} z-${image.zIndex} max-w-[350px] project-image`}
/>
))}
</div>
@@ -411,16 +165,11 @@ export default function MyProjects() {
</div>
))
) : (
<p className="flex w-full flex-col items-center gap-5 py-5 text-center text-[24px] font-[700] text-black">
<Image
src={"/images/icons/no-data-illustration.jpg"}
quality={90}
alt="nothing fonded icon"
width={250}
height={250}
/>
Nothing found!
</p>
<div className="flex gap-5">
<Skeleton width={450} height={450} />
<Skeleton width={450} height={450} />
<Skeleton width={450} height={450} />
</div>
)}
</div>
</div>
-1
View File
@@ -1,4 +1,3 @@
import Image from "next/image";
import React from "react";
// تعریف یک نوع برای سرویس‌ها
+7 -7
View File
@@ -4,7 +4,7 @@ import React, { useEffect, useState } from "react";
export default function Testimonials() {
const [currentIndex, setCurrentIndex] = useState(0);
const [autoSlideInterval, setAutoSlideInterval] = useState<any>(null);
// const [autoSlideInterval, setAutoSlideInterval] = useState<any>(null);
const nextSlide = () => {
setCurrentIndex((prevIndex) =>
@@ -12,14 +12,14 @@ export default function Testimonials() {
);
};
const prevSlide = () => {
setCurrentIndex((prevIndex) =>
prevIndex === 0 ? testimonials.length - 1 : prevIndex - 1,
);
};
// const prevSlide = () => {
// setCurrentIndex((prevIndex) =>
// prevIndex === 0 ? testimonials.length - 1 : prevIndex - 1,
// );
// };
useEffect(() => {
const interval = setInterval(nextSlide, 5000); // Slide every 5 seconds
setAutoSlideInterval(interval);
// setAutoSlideInterval(interval);
return () => clearInterval(interval); // Clean up interval on component unmount
}, []);
+9
View File
@@ -0,0 +1,9 @@
import { NextResponse } from "next/server";
export async function GET() {
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/about-me`, {
cache: "no-store" // غیرفعال کردن کش
});
const data = await response.json();
return NextResponse.json(data);
}
+9
View File
@@ -0,0 +1,9 @@
import { NextResponse } from "next/server";
export async function GET() {
const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/projects`, {
cache: "no-store" // غیرفعال کردن کش
});
const data = await response.json();
return NextResponse.json(data);
}
+13 -3
View File
@@ -2,6 +2,10 @@
@tailwind components;
@tailwind utilities;
:root {
--color-orange: #fd6f00;
}
* {
margin: 0;
padding: 0;
@@ -16,7 +20,7 @@ html {
position: fixed;
top: 0;
z-index: 1000;
background-color: #fd6f00;
background-color: var(--color-orange);
width: 100%;
scale: 0 1;
animation: scroll-watcher linear;
@@ -97,7 +101,7 @@ html {
width: 538px;
height: 269px;
bottom: 269px;
border: 10px solid #fd6f00;
border: 10px solid var(--color-orange);
border-bottom: 10px solid transparent;
border-top-left-radius: 269px;
border-top-right-radius: 269px;
@@ -116,7 +120,7 @@ html {
bottom: 0;
width: 538px;
height: 269px;
border: 10px solid #fd6f00;
border: 10px solid var(--color-orange);
border-top: 10px solid transparent;
border-bottom-left-radius: 269px;
border-bottom-right-radius: 269px;
@@ -239,3 +243,9 @@ html {
border-radius: 25% 46% 25% 25% / 25% 50% 25% 25%;
}
}
.project-image:hover {
scale: 1.05;
z-index: 10000;
cursor:zoom-in
}
+26 -24
View File
@@ -22,71 +22,73 @@ export default function RootLayout({
<html lang="en">
<body
suppressHydrationWarning={true}
className={`${geistSans.variable} antialiased flex flex-col items-center justify-between w-full relative`}
className={`${geistSans.variable} relative flex w-full flex-col items-center justify-between border-2 border-red-600 antialiased`}
>
<div className="scroll-watcher" id="top"></div>
<a
href="/#header"
className="flex items-center justify-center scroll-to-top fixed bottom-[100px] right-20 h-[50px] w-[50px] p-5 text-center border-2 hover:border-[#f3a66b] text-white text-[25px] font-[800] bg-[#fd6f00] rounded-full"
className="scroll-to-top fixed bottom-[100px] right-20 flex h-[50px] w-[50px] items-center justify-center rounded-full border-2 bg-[#fd6f00] p-5 text-center text-[25px] font-[800] text-white hover:border-[#f3a66b]"
id="back-to-top"
>
^
</a>
<div
className="flex items-center justify-between w-[1420px] h-[67px] bg-[#fff] z-40 py-[50px]"
className="z-40 flex h-[67px] w-full items-center justify-between bg-[#fff] px-2 py-[50px] xl:px-10"
id="header"
>
<div className="flex items-center">
<div className="flex flex-wrap items-center justify-center xl:flex-nowrap xl:justify-normal">
<Image src={"/images/logo.svg"} width={67} height={67} alt="logo" />
<p className="text-[48px] font-[400] ms-[20px]">Parsa Aghayi</p>
<p className="ms-[5px] whitespace-nowrap text-[38px] font-[400] xl:ms-[20px] xl:text-[48px]">
Parsa Aghayi
</p>
</div>
<ul className="flex items-center justify-center">
<ul className="hidden items-center justify-center lg:flex">
<a
href="/#home"
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
>
Home
</a>
<a
href="/#about-me"
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
>
About Me
</a>
<a
href="/#services"
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
>
Services
</a>
<a
href="/#projects"
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
>
Projects
</a>
<a
href="/#testimonials"
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
>
Testimonials
</a>
<a
href="/#contact"
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
>
Contact
</a>
</ul>
<button className="w-[188px] h-[52px] bg-[#FD6F00] rounded-md text-[#fff] text-[21px] font-[400] whitespace-nowrap p-[18px] flex items-center">
<button className="flex h-[52px] w-[188px] items-center whitespace-nowrap rounded-md bg-[#FD6F00] p-[18px] text-[21px] font-[400] text-[#fff]">
Download CV
</button>
</div>
<div className="main my-[67px]">{children}</div>
<div className="flex flex-col w-full">
<div className="flex flex-col items-center gap-[50px] py-[50px] bg-[#F8F8F8]">
<div className="flex w-full flex-col">
<div className="flex flex-col items-center gap-[50px] bg-[#F8F8F8] py-[50px]">
<div className="flex items-center">
<Image
src={"/images/logo.svg"}
@@ -94,41 +96,41 @@ export default function RootLayout({
height={67}
alt="logo"
/>
<p className="text-[48px] font-[400] ms-[20px]">Parsa Aghayi</p>
<p className="ms-[20px] text-[48px] font-[400]">Parsa Aghayi</p>
</div>
<ul className="flex items-center justify-center">
<a
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
href="/#home"
>
Home
</a>
<a
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
href="/#about-me"
>
About Me
</a>
<a
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
href="/#services"
>
Services
</a>
<a
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
href="/#projects"
>
Projects
</a>
<a
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
href="/#testimonials"
>
Testimonials
</a>
<a
className="px-[14px] py-[10px] text-[21px] font-[400] whitespace-nowrap"
className="whitespace-nowrap px-[14px] py-[10px] text-[21px] font-[400]"
href="/#contact"
>
Contact
@@ -161,9 +163,9 @@ export default function RootLayout({
/>
</div>
</div>
<p className="h-[84px] bg-[#545454] flex items-center justify-center text-white text-[21px] font-[400]">
<p className="flex h-[84px] items-center justify-center bg-[#545454] text-[21px] font-[400] text-white">
© 2023
<span className="text-[#FD6F00] text-[21px] font-[700] mx-[5px]">
<span className="mx-[5px] text-[21px] font-[700] text-[#FD6F00]">
Parsa Aghayi
</span>{" "}
All Rights Reserved , Inc.