Ghost

phantomknight287/Portfolio

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