Skip to content

Commit

Permalink
fix(*): tags
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoxAzrot committed Nov 20, 2024
1 parent b4dbbc9 commit 73441f6
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function GithubLabels({ githubLabels }: GithubLabelsProps) {
if (!githubLabels?.length) return null;

return githubLabels.map(({ name }) => (
<Badge key={name} size="xxs" shape="squared" variant="outline" icon={{ component: Tag }}>
<Badge key={name} size="xxs" shape="squared" icon={{ component: Tag }}>
{name}
</Badge>
));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,21 @@
import { Badge } from "@/design-system/atoms/badge";
import { Popover } from "@/design-system/atoms/popover";
import { AvatarLabelGroup } from "@/design-system/molecules/avatar-label-group";

import { LangaugesProps } from "./languages.types";

// TODO: DO IT
export function Languages({ languages }: LangaugesProps) {
if (!languages?.length) return null;

const languagesCount = languages.length;
const [{ name, logoUrl }] = languages;

if (languagesCount === 1) {
return <Badge avatar={{ src: logoUrl }}>{name}</Badge>;
}

return (
<Popover>
<Popover.Trigger>
{() => (
<div>
<Badge
classNames={{ base: "cursor-pointer" }}
avatar={{
size: "xxs",
src: logoUrl,
}}
>
{name} +{languagesCount - 1}
</Badge>
</div>
)}
</Popover.Trigger>
<Popover.Content>
{() => (
<ul className={"grid gap-3"}>
{languages.map(language => (
<AvatarLabelGroup
key={language.name}
as={"li"}
size={"sm"}
avatars={[{ src: language.logoUrl, alt: language.name }]}
title={{
size: "sm",
children: language.name,
}}
withPopover={false}
/>
))}
</ul>
)}
</Popover.Content>
</Popover>
);
return languages.map(({ name, logoUrl }) => (
<Badge
key={name}
size="xxs"
shape="squared"
avatar={{
src: logoUrl,
alt: name,
}}
>
{name}
</Badge>
));
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function Repo({ repo }: RepoProps) {
if (!repo) return null;

return (
<Badge size="xxs" shape="squared" variant="outline" icon={{ component: GithubIcon }}>
<Badge size="xxs" shape="squared" icon={{ component: GithubIcon }}>
<Emoji>{repo.name}</Emoji>
</Badge>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export function CardContributionKanbanNextUiAdapter<C extends ElementType = "div
return null;
}

// TODO: finish that
function renderTags() {
return (
<div className="flex flex-wrap items-center gap-sm empty:hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export function ContributionsPopover({
contributors={contribution.contributors}
linkedIssues={contribution.linkedIssues}
githubLabels={contribution.githubLabels}
githubHtmlUrl={contribution.githubHtmlUrl}
/>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export function UserContributions({ githubUserId, containerHeight = undefined }:
},
]}
border={isSelected ? "brand-primary" : undefined}
githubHtmlUrl={contribution.htmlUrl}
/>
);
})}
Expand All @@ -212,6 +213,7 @@ export function UserContributions({ githubUserId, containerHeight = undefined }:
},
]}
border={isSelected ? "brand-primary" : undefined}
githubHtmlUrl={contribution.githubHtmlUrl}
/>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function IssueOverview({ contribution }: IssueOverviewProps) {
repo={contribution.repo}
linkedIssues={contribution.linkedIssues}
rewardUsdAmount={contribution.totalRewardedUsdAmount}
githubHtmlUrl={contribution.githubHtmlUrl}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function IssuesSearchSidepanel() {
applicants={[]}
contributors={[]}
githubLabels={issue.githubLabels}
githubHtmlUrl={issue.githubHtmlUrl}
/>
))}
{hasNextPage ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function LinkedIssues({ issues }: LinkedIssuesProps) {
githubLabels={contribution.githubLabels}
languages={contribution.languages}
repo={contribution.repo}
githubHtmlUrl={contribution.githubHtmlUrl}
/>
</div>
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export function ContributionsAccordion({ ids }: ContributionsAccordionProps) {
contributors={contribution.contributors}
linkedIssues={contribution.linkedIssues}
githubLabels={contribution.githubLabels}
githubHtmlUrl={contribution.githubHtmlUrl}
/>
</div>
))}
Expand Down

0 comments on commit 73441f6

Please sign in to comment.