gitscope
← marzneshin / v0.6.4 / dashboard/src/features/github-repo/github-repo.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/github-repo/github-repo.tsx · TypeScript
Blame Raw
 1import {
 2    Card,
 3    CardTitle,
 4    CardContent,
 5    CardDescription,
 6    Button,
 7} from "@marzneshin/common/components"
 8import { type FC } from "react";
 9import {
10    GithubIcon,
11    StarIcon,
12} from "lucide-react";
13import { projectInfo } from "@marzneshin/common/utils";
14
15interface GithubRepoProps {
16    variant?: "full" | "mini"
17    stargazers_count: number;
18    full_name?: string;
19    description?: string;
20}
21
22export const GithubRepo: FC<GithubRepoProps> = ({ variant = "full", stargazers_count, full_name, description }) => {
23    return (
24        <Button variant="secondary" className="bg-gray-800 border-0 dark:text-primary text-secondary dark:hover:text-secondary dark:hover:bg-primary hover:bg-secondary hover:text-primary p-2" asChild>
25            <Card>
26                <a href={projectInfo.github} target="_blank">
27                    <CardContent className="hstack size-fit p-0 gap-2 items-center">
28                        <GithubIcon className="size-6" />
29                        {variant === "full" ? (
30                            <div className="vstack items-start">
31                                <CardTitle className="font-mono text-xs hstack justify-between w-full">
32                                    {full_name}
33                                    <div className="hstack gap-1 font-bold items-center text-xs">
34                                        <StarIcon className="size-3" />
35                                        {stargazers_count}
36                                    </div>
37                                </CardTitle>
38                                <CardDescription className="text-xs">
39                                    {description}
40                                </CardDescription>
41                            </div>
42                        ) : (
43                            <CardDescription className="hstack gap-1 font-bold items-center text-xs">
44                                <StarIcon className="size-3" />
45                                {stargazers_count}
46                            </CardDescription>
47                        )}
48                    </CardContent>
49                </a>
50            </Card>
51        </Button>
52    )
53}