diff --git a/app/components/SocialItem.tsx b/app/components/SocialItem.tsx index 6fe9087..4a6f691 100644 --- a/app/components/SocialItem.tsx +++ b/app/components/SocialItem.tsx @@ -3,8 +3,16 @@ import type { FC } from 'react'; import type { SocialType } from '../../types/global'; const SocialItem: FC = ({ Icon, href }) => { - return ( - + const isExternal = typeof href === 'string'; + + return isExternal ? ( + + + + + + ) : ( + diff --git a/app/projects/[slug]/page.tsx b/app/projects/[slug]/page.tsx index ca8207f..981e5b2 100644 --- a/app/projects/[slug]/page.tsx +++ b/app/projects/[slug]/page.tsx @@ -6,17 +6,26 @@ import type { ProjectType } from '../../../types/global'; import { projectsData } from '../../data/content'; interface ProjectPageProps { - params: { slug: string }; + params: Promise<{ slug: string }>; +} + +export function generateStaticParams(): Array<{ slug: string }> { + return projectsData.projectsList.map((project) => ({ + slug: project.slug, + })); } export default async function ProjectPage({ params }: ProjectPageProps) { + const resolvedParams = await params; const project: ProjectType | undefined = projectsData.projectsList.find( - (proj) => proj.slug === params.slug, + (proj) => proj.slug === resolvedParams.slug, ); if (!project) { notFound(); + return null; } + const MDXContent = ( (await import(`../../data/projects/${project.slug}.mdx`)) as { default: (props: { @@ -32,6 +41,7 @@ export default async function ProjectPage({ params }: ProjectPageProps) { src={project.image} alt={project.name} width={2000} + height={1000} className="object-cover" /> diff --git a/types/global.d.ts b/types/global.d.ts index c2aceec..96da6d6 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -1,4 +1,4 @@ -import type { UrlObject } from 'node:url'; +import { UrlObject } from 'node:url'; import type { StaticImageData } from 'next/image'; import type { JSX } from 'react'; @@ -39,7 +39,7 @@ type StatType = { type SocialType = { Icon: React.ComponentType; - href: UrlObject; + href: string | UrlObject; }; declare module '*.mdx' {