-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from Mridul2820/dev-updates
Pinned Repositoty Fixed
- Loading branch information
Showing
9 changed files
with
238 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React from "react"; | ||
|
||
import RepoIcon from "../svgs/RepoIcon"; | ||
import StarIcon from "../svgs/StarIcon"; | ||
import ForkIcon from "../svgs/ForkIcon"; | ||
|
||
import { numberFormatter } from "../../helper/formatNumber"; | ||
|
||
const RepositoryCard = ({ repository, theme }) => { | ||
const getType = () => { | ||
if (!repository?.isPrivate && repository?.isTemplate) { | ||
return "Public template"; | ||
} else if (repository?.isPrivate && repository?.isTemplate) { | ||
return "Private template"; | ||
} else if (repository?.isPrivate) { | ||
return "Private"; | ||
} else if (!repository?.isPrivate) { | ||
return "Public"; | ||
} else if (repository?.isFork) { | ||
return "Forked"; | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="flex justify-between flex-col rounded-md p-4 w-80 h-44 border-2 border-border-default dark:border-border-dark bg-canvas-default dark:bg-canvas-dark"> | ||
<div> | ||
<div className="flex items-center gap-2"> | ||
<RepoIcon theme={theme} /> | ||
<a | ||
href={repository?.url} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="text-accent-default dark:text-accent-dark hover:underline text-sm font-semibold" | ||
title={repository?.url} | ||
> | ||
<p className="leading-5">{repository?.name}</p> | ||
</a> | ||
<span className="px-2 py-0.5 border-[1px] border-border-default dark:border-border-dark text-xs text-muted-default dark:text-muted-dark rounded-full font-medium"> | ||
{getType()} | ||
</span> | ||
</div> | ||
<p className="text-xs text-muted-default dark:text-muted-dark mt-2 leading-5"> | ||
{repository?.description} | ||
</p> | ||
</div> | ||
<p className="flex items-center gap-4 mt-2"> | ||
{repository?.languages?.nodes?.length > 0 && ( | ||
<> | ||
<span | ||
className="h-3 w-3 rounded-full" | ||
style={{ | ||
background: repository?.languages?.nodes[0]?.color, | ||
}} | ||
/> | ||
<span className="text-xs text-muted-default dark:text-muted-dark leading-5 -ml-3"> | ||
{repository?.languages?.nodes[0]?.name} | ||
</span> | ||
</> | ||
)} | ||
<a | ||
href={`${repository?.url}/stargazers`} | ||
className="flex items-center gap-1" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<StarIcon theme={theme} /> | ||
<span className="text-xs text-muted-default dark:text-muted-dark leading-5"> | ||
{numberFormatter(repository?.stargazers?.totalCount, 1)} | ||
</span> | ||
</a> | ||
<a | ||
href={`${repository?.url}/network/members`} | ||
className="flex items-center gap-1" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<ForkIcon theme={theme} /> | ||
<span className="text-xs text-muted-default dark:text-muted-dark leading-5"> | ||
{numberFormatter(repository?.forks?.totalCount, 1)} | ||
</span> | ||
</a> | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RepositoryCard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from "react"; | ||
import RepositoryCard from "./GitHubCard"; | ||
import { useTheme } from "next-themes"; | ||
|
||
const PinnedRepositories = ({ username, pinnedRepositories }) => { | ||
const { theme } = useTheme(); | ||
|
||
return ( | ||
<div className="card-item p-5"> | ||
<p className="text-center mb-5 text-xl font-semibold"> | ||
<div> | ||
{"@"} {username} Pinned Repositories | ||
</div> | ||
</p> | ||
<div className="flex flex-wrap justify-center gap-4 max-h-[450px] overflow-y-scroll pt-2 pr-5"> | ||
{pinnedRepositories?.nodes.map((repo) => ( | ||
<RepositoryCard repository={repo} theme={theme} key={repo.id} /> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PinnedRepositories; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
|
||
const ForkIcon = () => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
aria-hidden="true" | ||
viewBox="0 0 16 16" | ||
version="1.1" | ||
data-view-component="true" | ||
className="w-4 h-4 fill-slate-900 dark:fill-slate-100" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M5 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm0 2.122a2.25 2.25 0 10-1.5 0v.878A2.25 2.25 0 005.75 8.5h1.5v2.128a2.251 2.251 0 101.5 0V8.5h1.5a2.25 2.25 0 002.25-2.25v-.878a2.25 2.25 0 10-1.5 0v.878a.75.75 0 01-.75.75h-4.5A.75.75 0 015 6.25v-.878zm3.75 7.378a.75.75 0 11-1.5 0 .75.75 0 011.5 0zm3-8.75a.75.75 0 100-1.5.75.75 0 000 1.5z" | ||
></path> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default ForkIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from "react"; | ||
|
||
const RepoIcon = () => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
title="Repository" | ||
aria-label="Repository" | ||
role="img" | ||
viewBox="0 0 16 16" | ||
version="1.1" | ||
data-view-component="true" | ||
className="w-4 h-4 fill-slate-900 dark:fill-slate-100" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z" | ||
></path> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default RepoIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
|
||
const StarIcon = () => { | ||
return ( | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
aria-hidden="true" | ||
viewBox="0 0 16 16" | ||
version="1.1" | ||
data-view-component="true" | ||
className="w-4 h-4 fill-slate-900 dark:fill-slate-100" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z" | ||
></path> | ||
</svg> | ||
); | ||
}; | ||
|
||
export default StarIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export const numberFormatter = (num, digits) => { | ||
const lookup = [ | ||
{ value: 1, symbol: "" }, | ||
{ value: 1e3, symbol: "k" }, | ||
{ value: 1e6, symbol: "M" }, | ||
{ value: 1e9, symbol: "G" }, | ||
{ value: 1e12, symbol: "T" }, | ||
{ value: 1e15, symbol: "P" }, | ||
{ value: 1e18, symbol: "E" }, | ||
]; | ||
const rx = /\.0+$|(\.[0-9]*[1-9])0+$/; | ||
var item = lookup | ||
.slice() | ||
.reverse() | ||
.find(function (item) { | ||
return num >= item.value; | ||
}); | ||
return item | ||
? (num / item.value).toFixed(digits).replace(rx, "$1") + item.symbol | ||
: "0"; | ||
}; |
Oops, something went wrong.
6802810
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
git-to-get – ./
git-to-get-mridul28.vercel.app
git-o-get.mridul.tech
git-to-get-git-main-mridul28.vercel.app