From 08e2254c2d11f2fd5c479277b85fb924e5772fef Mon Sep 17 00:00:00 2001 From: "sa.cux" Date: Tue, 30 Jan 2024 10:17:32 +0100 Subject: [PATCH] add TS type --- .../RepositoryContributionsCard.tsx | 63 ++++++++++--------- src/types/github.ts | 1 + 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/components/RepositoryContributionsCard.tsx b/src/components/RepositoryContributionsCard.tsx index d50f6bc..1a0feb1 100644 --- a/src/components/RepositoryContributionsCard.tsx +++ b/src/components/RepositoryContributionsCard.tsx @@ -1,4 +1,4 @@ -import { Contributions, Repository } from "@/types/github"; +import { Contributions, PullRequestNode, Repository } from "@/types/github"; import Image from "next/image"; import Link from "next/link"; import { FaCodeMerge } from "react-icons/fa6"; @@ -52,35 +52,40 @@ export const RepositoryContributionsCard = ({
- {nodes?.map(({ pullRequest: { state, title, id, url } }: any) => ( -
- - {title} - - ( +
- {state === "MERGED" ? ( - - ) : state === "CLOSED" ? ( - - ) : ( - - )} - -
- ))} + + {title} + + + {state === "MERGED" ? ( + + ) : state === "CLOSED" ? ( + + ) : ( + + )} + +
+ ) + )}
diff --git a/src/types/github.ts b/src/types/github.ts index 422a76b..cdb7a13 100644 --- a/src/types/github.ts +++ b/src/types/github.ts @@ -16,6 +16,7 @@ export type PullRequest = { id: string; title: string; state: "MERGED" | "CLOSED" | "OPEN"; + url: string; }; export type Repository = {