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