diff --git a/components/molecules/ContributorTable/contributor-table.tsx b/components/molecules/ContributorTable/contributor-table.tsx new file mode 100644 index 0000000000..1f18604fd9 --- /dev/null +++ b/components/molecules/ContributorTable/contributor-table.tsx @@ -0,0 +1,111 @@ +import Text from "components/atoms/Typography/text"; +import { IconContext } from "react-icons"; +import { FaRegDotCircle, FaRegCheckCircle } from "react-icons/fa"; +import { BsFileDiff } from "react-icons/bs"; +import { GoDiff } from "react-icons/go"; +import { VscGitPullRequest,VscGitPullRequestClosed, VscGitMerge, VscGitPullRequestDraft } from "react-icons/vsc"; + +interface PRs { + prStatus: string; + prName: string; + prIssuedTime: string; + prClosedTime: string; + noOfFilesChanged: number; + noOfLinesChanged: number; +} + +interface CardTableProps { + prList: PRs[]; +} + +const CardTable = ({ prList }: CardTableProps) => { + return ( + prList.length > 0 ? + <> +
+
+ + Latest PRs + +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+ {prList.map(({prName, prStatus, prIssuedTime, prClosedTime, noOfFilesChanged, noOfLinesChanged}, index) => +
+
+ {prStatus === "open" ? + + + + + : + + prStatus === "closed" ? + + + + + : + + prStatus === "merged" ? + + + + + : + + + + + } + + {prIssuedTime} + + + {prName} + +
+
+ {prIssuedTime} +
+
+ {prClosedTime} +
+
+ {noOfFilesChanged} +
+
+ {noOfLinesChanged} +
+
+ )} + + + : + +
+ There are currently no PRs... +
+ ); +}; + +export default CardTable; \ No newline at end of file diff --git a/stories/molecules/contributor-table.stories.tsx b/stories/molecules/contributor-table.stories.tsx new file mode 100644 index 0000000000..962b018b49 --- /dev/null +++ b/stories/molecules/contributor-table.stories.tsx @@ -0,0 +1,59 @@ +import React from "react"; +import { ComponentStory, ComponentMeta } from "@storybook/react"; +import ContributorTable from "components/molecules/ContributorTable/contributor-table"; + +const storyConfig = { + title: "Design System/Molecules/Contributor Table", + component: "Card Table" +}; + +export default storyConfig; + +const testPRs = [ + { + prName: "Merging some work", + prStatus: "merged", + prIssuedTime: "2mo", + prClosedTime: "2mo", + noOfFilesChanged: 13, + noOfLinesChanged: 837 + }, + { + prName: "Merging some work", + prStatus: "closed", + prIssuedTime: "2mo", + prClosedTime: "2mo", + noOfFilesChanged: 13, + noOfLinesChanged: 837 + }, + { + prName: "Merging some work", + prStatus: "open", + prIssuedTime: "2mo", + prClosedTime: "2mo", + noOfFilesChanged: 13, + noOfLinesChanged: 837 + }, + { + prName: "Merging some work", + prStatus: "draft", + prIssuedTime: "2mo", + prClosedTime: "2mo", + noOfFilesChanged: 13, + noOfLinesChanged: 837 + } +]; + +//CardTable Template +const ContributorTableTemplate: ComponentStory = (args) => ; + +export const AddedPullRequests = ContributorTableTemplate.bind({}); +export const NoPullRequests = ContributorTableTemplate.bind({}); + +AddedPullRequests.args = { + prList: testPRs +}; + +NoPullRequests.args = { + prList: [] +}; \ No newline at end of file