Skip to content

Commit

Permalink
create page to show info about project
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomKnight287 committed Sep 14, 2023
1 parent 6b67f6f commit d68f42b
Show file tree
Hide file tree
Showing 11 changed files with 275 additions and 22 deletions.
10 changes: 3 additions & 7 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import "./globals.css";
import { Inter } from "next/font/google";
import { Hanken_Grotesk } from "next/font/google";
const font = Hanken_Grotesk({ subsets: ["latin"] });

const inter = Inter({
weight: ["100", "200", "300", "400", "500", "600", "700", "800", "900"],
subsets: ["latin-ext", "latin"],
display: "swap",
});
export const metadata = {
title: "Create Next App",
description: "Generated by create next app",
Expand All @@ -18,7 +14,7 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<body className={`${inter.className} bg-[#111010] flex justify-center`}>
<body className={`${font.className} bg-[#111010] flex justify-center`}>
{children}
</body>
</html>
Expand Down
17 changes: 8 additions & 9 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FiGithub } from "react-icons/fi";
import { Projects } from "@/constants";
import Badge from "@/components/badge";
import Image from "next/image";
import Link from "next/link";

export const metadata = {
title: "Gurpal Singh | PhantomKnight287",
Expand Down Expand Up @@ -69,7 +70,7 @@ export default function Home() {
am a self-taught developer who loves to code and make things.
</p>
<p className="mt-5 text-xl text-gray-400">
Currently working in a startup and messing with
Currently working in a startup and messing with{" "}
<Badge href="https://nextjs.org">
<svg
width="14"
Expand Down Expand Up @@ -138,7 +139,7 @@ export default function Home() {
</svg>
Next.js
</Badge>
,
,{" "}
<Badge href="https://nestjs.com">
<svg
xmlns="http://www.w3.org/2000/svg"
Expand Down Expand Up @@ -166,7 +167,7 @@ export default function Home() {
</svg>
Nest.js
</Badge>
,
,{" "}
<Badge href="https://www.prisma.io/" className="mr-1">
<svg
width="14"
Expand All @@ -185,7 +186,7 @@ export default function Home() {
</svg>
Prisma
</Badge>
,
,{" "}
<Badge href="https://turbo.build/repo" className="ml-10">
<svg
className={"inline-block mr-1"}
Expand Down Expand Up @@ -282,12 +283,10 @@ export default function Home() {
<h1 className="text-2xl text-white mt-5 mb-5">Projects</h1>
<div className="flex flex-col">
{Projects.map((project) => (
<a
<Link
className="proj group"
key={project.name.replace(" ", "-")}
href={project.href}
target="_blank"
rel="noopener noreferrer"
href={`/project/${project.slug}`}
>
<article className="flex flex-row gap-0 items-center justify-between lg:justify-center mt-3 mb-3 w-full">
<div className="flex flex-col justify-start opacity-100 flex-none shrink-0 h-auto relative whitespace-pre w-auto mr-3">
Expand All @@ -301,7 +300,7 @@ export default function Home() {
size={20}
/>
</article>
</a>
</Link>
))}
</div>
</div>
Expand Down
27 changes: 27 additions & 0 deletions app/project/[name]/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default function Loading() {
return (
<div
className={"flex flex-col items-center h-screen justify-center w-full"}
>
<div role="status">
<svg
aria-hidden="true"
className="w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"
/>
</svg>
<span className="sr-only">Loading...</span>
</div>
</div>
);
}
100 changes: 100 additions & 0 deletions app/project/[name]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import BackButton from "@/components/shared/back";
import { Projects } from "@/constants";
import { upperFirst } from "@/utils/uppercase";
import { Metadata } from "next";
import Image from "next/image";
import { FiExternalLink, FiGithub } from "react-icons/fi";

export async function generateStaticParams() {
return Projects.map((p) => ({
name: encodeURIComponent(p.name),
}));
}
interface Props {
params: {
name: string;
};
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const project = Projects.find((p) => p.slug === params.name)!;

return {
title: project.name,
description: project.description,
openGraph: {
type: "website",
title: project.name,
description: project.description,
images: [
{
url: project.image?.url,
width: project.image?.width,
height: project.image?.height,
alt: project.image?.alt,
},
],
},
twitter: {
card: "summary_large_image",
site: "@gurpalsingh287",
},
};
}

async function ProjectPage(props: Props) {
const project = Projects.find((p) => p.slug === props.params.name)!;
return (
<div className="min-h-screen lg:pt-20 pt-10 container items-center justify-center flex-col lg:max-w-xl">
<BackButton />
<Image
className="max-w-[850px] max-h-[450px] mx-auto rounded-md mt-5"
src={project.image?.url}
alt={project.image?.alt}
width={project.image?.width}
height={project.image?.height}
/>
{project.image.source ? (
<p className="text-center text-gray-400">Source: {project.image.source}</p>
) : null}
<div className="flex flex-row items-center my-5">
<h1 className="text-2xl font-bold text-left">{project.name}</h1>
<div className="flex flex-row items-center flex-nowrap ml-auto">
{Object.keys(project.urls).map((key: keyof typeof project.urls) => (
<a
href={project.urls[key]}
target="_blank"
rel="noreferrer"
key={key}
className="flex flex-row items-center justify-start gap-2.5
text-white transition duration-300 ease-in-out
bg-neutral-700 hover:bg-neutral-900 rounded-md px-3 py-2.5"
>
{key === "githubUrl" ? (
<FiGithub className="text-white text-xl" />
) : (
<FiExternalLink className="text-white text-xl" />
)}
</a>
))}
</div>
</div>

<div className="flex flex-col items-start justify-start gap-2.5">
<p className="text-lg text-left text-gray-300">{project.description}</p>
<div className="flex flex-row flex-wrap items-center justify-start gap-2.5">
{project.tags?.map((tag) => (
<span
key={tag}
className=" text-sm bg-neutral-200 text-black font-medium rounded-xl px-2 py-1"
>
{upperFirst(tag)}
</span>
))}
</div>
</div>
</div>
);
}

export default ProjectPage;
21 changes: 21 additions & 0 deletions components/shared/back.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use client";

import { useRouter } from "next/navigation";
import { BiArrowBack } from "react-icons/bi";

export default function BackButton() {
const { back } = useRouter();
return (
<button
onClick={back}
className="flex flex-row items-center justify-start gap-2.5
text-white transition duration-300 ease-in-out
bg-neutral-700 hover:bg-neutral-900 rounded-md px-3 py-2.5"
title="Back"
aria-label="Back"
aria-roledescription="button"
>
<BiArrowBack />
</button>
);
}
120 changes: 114 additions & 6 deletions constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,131 @@
interface Project {
name: string;
slug: string;
image: {
url: string;
alt: string;
width: number;
height: number;
source?: string;
};
urls: {
githubUrl?: string;
liveUrl?: string;
[key: string]: string | undefined;
};
description: string;
tags: string[];
}

export const Projects = [
export const Projects: Project[] = [
{
name: "Lend My Skill",
href: "https://github.com/PhantomKnight287/lend-my-skill",
slug: "lend-my-skill",
image: {
url: "https://github.com/PhantomKnight287/lend-my-skill/blob/main/assets/lms-logo.png?raw=true",
alt: "Lend My Skill",
width: 164,
height: 164,
},
urls: {
githubUrl: "https://github.com/PhantomKnight287/lend-my-skill",
},
description: `A Freelance platform designed specially for Indians supporting payment methods like Rupay Card and UPI.`,
tags: [
"Next.js",
"TypeScript",
"Tailwind CSS",
"Nest.js",
"Socket.io",
"PostgreSQL",
],
},
{
name: "Voto",
description:
"A realtime voting platform where organisations can register and create junior admins to create and manage polls, register candidates and allow them to participate in certain polls, voters can register and vote for their favourite candidates and view a realtime graph of the results. Used by 3000 voters and over 7000 votes casted in the first 1 month of launch.",
slug: "voto",
urls: {
liveUrl: "https://voto.com.ng",
},
image: {
url: "/voto.png",
width: 417,
height: 234,
alt: "Voto",
},
tags: [
"Next.js",
"Express",
"Typescript",
"Cloudinary",
"PostgreSQL",
"Prisma",
"Socket.io",
"Tailwind CSS",
"Mantine",
"Chart.js",
],
},
{
name: "PhantomKnight",
href: "https://github.com/PhantomKnight287/phantomknight",
slug: "phantomknight",
urls: {
githubUrl: "https://github.com/PhantomKnight287/phantomknight",
},
image: {
url: "/phantomknight.jpg",
alt: "PhantomKnight",
width: 520,
height: 360,
source: "Unsplash.com",
},
description: `A discord bot built using discord.js and TypeScript.`,
tags: ["TypeScript", "Discord.js", "Node.js"],
},
{
name: "Fluxt",
href: "https://github.com/PhantomKnight287/fluxt",
slug: "fluxt",
urls: {
githubUrl: "https://github.com/PhantomKnight287/fluxt",
},
image: {
url: "/chat.png",
alt: "Fluxt",
width: 360,
height: 360,
},
description: `A Realtime chat app created using flask,socket io and nextjs`,
tags: ["Flask", "Socket.io", "Next.js", "TypeScript", "Mantine", "Sqlite3"],
},
{
name: "Reactive Chat",
href: "https://github.com/PhantomKnight287/reactnative",
slug: "reactive-chat",
urls: {
githubUrl: "https://github.com/PhantomKnight287/reactnative",
},
tags: ["React Native", "Firebase"],
description: `A Realtime chat app created using React Native and Firebase`,
image: {
url: "/chat.png",
alt: "Fluxt",
width: 360,
height: 360,
},
},
{
name: "React Cli",
href: "https://github.com/PhantomKnight287/react-cli",
slug: "react-cli",
urls: {
githubUrl: "https://github.com/PhantomKnight287/react-cli",
},
tags: ["Rust"],
description: "A CLI tool to generate react components and hooks.",
image: {
url: "/cli.png",
width: 360,
height: 360,
alt: "React Cli",
},
},
];
Binary file added public/chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/cli.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/phantomknight.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/voto.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions utils/uppercase.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const upperFirst = (str: string) =>
str.charAt(0).toUpperCase() + str.slice(1);

0 comments on commit d68f42b

Please sign in to comment.