projects images updated

This commit is contained in:
parsa aghaei 2024-11-20 16:38:40 +03:30
parent 6861bf9b32
commit 0dccf4b734
3 changed files with 28 additions and 10 deletions

View File

@ -1,3 +1,4 @@
NEXT_PUBLIC_API_URL=http://localhost:8000/api NEXT_PUBLIC_API_URL=http://localhost:8000/api
NEXT_PUBLIC_BLOG_API_URL=http://localhost:8000/api/blog NEXT_PUBLIC_BLOG_API_URL=http://localhost:8000/api/blog
NEXT_PUBLIC_FRONT_URL=http://localhost:3001 NEXT_PUBLIC_FRONT_URL=http://localhost:3001
NEXT_PUBLIC_BACK_URL=http://localhost:8000

View File

@ -1,3 +1,4 @@
NEXT_PUBLIC_API_URL=https://backend.parsaaghayi.ir/api NEXT_PUBLIC_API_URL=https://backend.parsaaghayi.ir/api
NEXT_PUBLIC_BLOG_API_URL=https://backend.parsaaghayi.ir/api/blog NEXT_PUBLIC_BLOG_API_URL=https://backend.parsaaghayi.ir/api/blog
NEXT_PUBLIC_FRONT_URL=https://parsaaghayi.ir NEXT_PUBLIC_FRONT_URL=https://parsaaghayi.ir
NEXT_PUBLIC_BACK_URL=https://backend.parsaaghayi.ir

View File

@ -7,6 +7,7 @@ import {
ProjectResponse, ProjectResponse,
} from "@/app/types/types"; } from "@/app/types/types";
import { getCookie } from "cookies-next"; import { getCookie } from "cookies-next";
import Link from "next/link";
import React, { useEffect, useState, useMemo } from "react"; import React, { useEffect, useState, useMemo } from "react";
import Skeleton from "react-loading-skeleton"; import Skeleton from "react-loading-skeleton";
import "react-loading-skeleton/dist/skeleton.css"; import "react-loading-skeleton/dist/skeleton.css";
@ -92,7 +93,9 @@ export default function Projects({ dict }: MyProjectsProps) {
const groupProjectsByCategory = (projects: Project[]) => { const groupProjectsByCategory = (projects: Project[]) => {
return projects.reduce<Record<string, Project[]>>((acc, project) => { return projects.reduce<Record<string, Project[]>>((acc, project) => {
const category = project.category || (locale === "fa" ? "بدون دسته‌بندی" : "Uncategorized"); const category =
project.category ||
(locale === "fa" ? "بدون دسته‌بندی" : "Uncategorized");
if (!acc[category]) { if (!acc[category]) {
acc[category] = []; acc[category] = [];
} }
@ -165,14 +168,27 @@ export default function Projects({ dict }: MyProjectsProps) {
{filteredProjects.length > 0 {filteredProjects.length > 0
? filteredProjects.map((project, index) => ( ? filteredProjects.map((project, index) => (
<div key={index} className="project flex w-[45%] flex-wrap"> <div key={index} className="project flex w-[45%] flex-wrap">
<div className="relative my-5 h-[200px] w-full overflow-hidden bg-[#FFEBDB] md:h-[250px] lg:h-[300px]"> <div className="relative my-5 h-[200px] w-full overflow-hidden bg-[#FFEBDB] md:h-[250px] lg:h-[300px] rounded-lg">
{project.images.map((image, idx) => ( {project.images.map((image, idx) => (
<img <Link
key={idx} href={
src={image.src} process.env.NEXT_PUBLIC_BACK_URL +
alt={`Image for ${project.title}`} "/images/projects/" +
className={`absolute ${idx === 0 ? "bottom-0 start-0" : "end-0 top-0"} z-${image.zIndex} project-image w-[85%] max-w-[350px]`} image.src
/> }
target="_blank"
>
<img
key={idx}
src={
process.env.NEXT_PUBLIC_BACK_URL +
"/images/projects/" +
image.src
}
alt={`Image for ${project.title}`}
className={`absolute ${idx === 0 ? "bottom-0 start-0 z-[10]" : "end-0 top-0 z-[2]"} project-image w-[85%] max-w-[350px]`}
/>
</Link>
))} ))}
</div> </div>
<h5 className="w-full text-[15px] font-[600] text-[#FD6F00] lg:text-[20px]"> <h5 className="w-full text-[15px] font-[600] text-[#FD6F00] lg:text-[20px]">