mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-25 01:01:29 +00:00
Reuse shared PR chip rendering, persist runtime stage handlers from events, and remove duplicated lifecycle/delete helpers found during review.
40 lines
754 B
TypeScript
40 lines
754 B
TypeScript
import type { ReactNode } from "react";
|
|
|
|
import { GitPullRequestIcon } from "./icons";
|
|
|
|
export function PullRequestChip({
|
|
number,
|
|
url,
|
|
className = "inline-flex items-center gap-1.5 font-mono text-xs text-fg-muted",
|
|
iconClassName = "size-3",
|
|
children,
|
|
}: {
|
|
number: number;
|
|
url?: string;
|
|
className?: string;
|
|
iconClassName?: string;
|
|
children?: ReactNode;
|
|
}) {
|
|
const content = (
|
|
<>
|
|
<GitPullRequestIcon className={iconClassName} />
|
|
#{number}
|
|
{children}
|
|
</>
|
|
);
|
|
|
|
if (url == null) {
|
|
return <span className={className}>{content}</span>;
|
|
}
|
|
|
|
return (
|
|
<a
|
|
href={url}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className={`${className} hover:text-fg`}
|
|
>
|
|
{content}
|
|
</a>
|
|
);
|
|
}
|