header is responsive now
This commit is contained in:
1 parent
f984d61091
commit
3e757c5481
124 files changed
+238
-402
No files matched your search
@@ -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>
|
||||
|
||||
@@ -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,4 +1,3 @@
|
||||
import Image from "next/image";
|
||||
import React from "react";
|
||||
|
||||
// تعریف یک نوع برای سرویسها
|
||||
|
||||
@@ -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
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in new issue
Block a user