| 1 | import ImageWithLoader from "@/components/loadingimage"; |
| 2 | import BackButton from "@/components/shared/back |
| 3 | import { Projects } |
| 4 | import { cn } |
| 5 | import { upperFirst } |
| 6 | import { Metadata } |
| 7 | import { FiExternalLink, FiGithub |
| 8 | |
| 9 | export async function generateStaticParams |
| 10 | return Projects.map |
| 11 | name: encodeURIComponent(p |
| 12 | })); |
| 13 | } |
| 14 | interface Props { |
| 15 | params: { |
| 16 | name: string |
| 17 | }; |
| 18 | } |
| 19 | |
| 20 | export async function generateMetadata |
| 21 | const project = |
| 22 | (p) => |
| 23 | )!; |
| 24 | |
| 25 | return { |
| 26 | title: project.name |
| 27 | description: project.description |
| 28 | openGraph: { |
| 29 | type: "website", |
| 30 | title: project.name |
| 31 | description: project.description |
| 32 | images: [ |
| 33 | { |
| 34 | url: project.image |
| 35 | width: project.image |
| 36 | height: project.image |
| 37 | alt: project.image |
| 38 | }, |
| 39 | ], |
| 40 | }, |
| 41 | twitter: { |
| 42 | card: "summary_large_image", |
| 43 | site: "@gurpalsingh287", |
| 44 | }, |
| 45 | }; |
| 46 | } |
| 47 | |
| 48 | async function ProjectPage( |
| 49 | const project = |
| 50 | (p) => |
| 51 | )!; |
| 52 | return ( |
| 53 | <div className="min-h-screen lg:pt-20 lg:p-0 p-5 container items-center justify-center flex-col lg:max-w-xl overflow-hidden |
| 54 | <BackButton /> |
| 55 | |
| 56 | <ImageWithLoader |
| 57 | className={cn( |
| 58 | "mx-auto rounded-md mt-5 object-cover h-[unset]", |
| 59 | project.image.width |
| 60 | )} |
| 61 | src={project.image |
| 62 | alt={project.image |
| 63 | loading="eager" |
| 64 | width={project.image |
| 65 | height={project.image |
| 66 | /> |
| 67 | |
| 68 | {project.image.source |
| 69 | <p className="text-center text-gray-400 |
| 70 | Source: {project.image.source |
| 71 | </p> |
| 72 | ) : null} |
| 73 | <div className="flex flex-row items-center my-5 |
| 74 | <h1 className="text-2xl font-bold text-left |
| 75 | <div className="flex flex-row items-center flex-nowrap ml-auto gap-2 |
| 76 | {Object.keys(project |
| 77 | <a |
| 78 | href={project.urls |
| 79 | target="_blank" |
| 80 | rel="noreferrer" |
| 81 | key={key} |
| 82 | className="flex flex-row items-center justify-start gap-2.5 |
| 83 | text-white transition duration-300 ease-in-out |
| 84 | bg-neutral-700 hover:bg-neutral-900 rounded-md px-3 py-2.5" |
| 85 | > |
| 86 | {key === "githubUrl |
| 87 | <FiGithub className=" |
| 88 | ) : ( |
| 89 | <FiExternalLink className=" |
| 90 | )} |
| 91 | </a> |
| 92 | ))} |
| 93 | </div> |
| 94 | </div> |
| 95 | |
| 96 | <div className="flex flex-col items-start justify-start gap-2.5 |
| 97 | <p className="text-lg text-left text-gray-300 |
| 98 | <div className="flex flex-row flex-wrap items-center justify-start gap-2.5 |
| 99 | {project.tags?.map |
| 100 | <span |
| 101 | key={tag} |
| 102 | className=" text-sm bg-neutral-200 text-black font-medium rounded-xl px-2 py-1" |
| 103 | > |
| 104 | {upperFirst(tag)} |
| 105 | </span> |
| 106 | ))} |
| 107 | </div> |
| 108 | </div> |
| 109 | </div> |
| 110 | ); |
| 111 | } |
| 112 | |
| 113 | export default ProjectPage; |