Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

pullRequestIcons.tsx

55 lines1.6 KB

1import {
2 GitMergeIcon,
3 GitPullRequestArrowIcon,
4 GitPullRequestClosedIcon,
5 GitPullRequestDraftIcon,
6 LayersIcon,
7 Link2Icon,
8 Unlink2Icon,
9 TriangleAlertIcon,
10} from "lucide-react";
11import type { PullRequestState } from "@t3tools/contracts";
12import { msg } from "gt-react";
13​
14export const PullRequestGlyph = {
15 pullRequest: GitPullRequestArrowIcon,
16 reopen: GitPullRequestArrowIcon,
17 draft: GitPullRequestDraftIcon,
18 closed: GitPullRequestClosedIcon,
19 merged: GitMergeIcon,
20 conflicting: TriangleAlertIcon,
21 stack: LayersIcon,
22 link: Link2Icon,
23 unlink: Unlink2Icon,
24} as const;
25​
26export type PullRequestGlyphIcon = (typeof PullRequestGlyph)[keyof typeof PullRequestGlyph];
27​
28export interface PullRequestStatePresentation {
29 readonly label: string;
30 readonly toneClassName: string;
31 readonly Icon: PullRequestGlyphIcon;
33​
34export const PULL_REQUEST_STATE_PRESENTATION = {
35 open: {
36 label: msg("Open", { $context: "pull request state" }),
37 toneClassName: "text-emerald-600 dark:text-emerald-300/90",
38 Icon: PullRequestGlyph.pullRequest,
39 },
40 draft: {
41 label: msg("Draft", { $context: "pull request state" }),
42 toneClassName: "text-zinc-500 dark:text-zinc-400/80",
43 Icon: PullRequestGlyph.draft,
44 },
45 closed: {
46 label: msg("Closed", { $context: "pull request state" }),
47 toneClassName: "text-red-600 dark:text-red-300/90",
48 Icon: PullRequestGlyph.closed,
49 },
50 merged: {
51 label: msg("Merged", { $context: "pull request state" }),
52 toneClassName: "text-violet-600 dark:text-violet-300/90",
53 Icon: PullRequestGlyph.merged,
54 },
55} as const satisfies Record<PullRequestState | "draft", PullRequestStatePresentation>;