From af578ea4a5581cbf9e76db9ef6362bd8e5f11063 Mon Sep 17 00:00:00 2001 From: Vladyslav Fedoriuk Date: Wed, 30 Aug 2023 23:21:44 +0200 Subject: [PATCH] Format the links to Github repos --- frontend/package.json | 1 + frontend/pnpm-lock.yaml | 38 ++++++++++++++++++ frontend/src/app/columns.tsx | 31 ++++++++++++++- frontend/src/components/ui/button.tsx | 56 +++++++++++++++++++++++++++ 4 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 frontend/src/components/ui/button.tsx diff --git a/frontend/package.json b/frontend/package.json index 08b6588..30af386 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@radix-ui/react-slot": "^1.0.2", "@tanstack/react-table": "^8.9.3", "@types/node": "20.5.1", "@types/react": "18.2.20", diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 52f2db7..ae5d49a 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + "@radix-ui/react-slot": + specifier: ^1.0.2 + version: 1.0.2(@types/react@18.2.20)(react@18.2.0) "@tanstack/react-table": specifier: ^8.9.3 version: 8.9.3(react-dom@18.2.0)(react@18.2.0) @@ -367,6 +370,41 @@ packages: fastq: 1.15.0 dev: false + /@radix-ui/react-compose-refs@1.0.1(@types/react@18.2.20)(react@18.2.0): + resolution: + { + integrity: sha512-fDSBgd44FKHa1FRMU59qBMPFcl2PZE+2nmqunj+BWFyYYjnhIDWL2ItDs3rrbJDQOtzt5nIebLCQc4QRfz6LJw==, + } + peerDependencies: + "@types/react": "*" + react: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + "@types/react": + optional: true + dependencies: + "@babel/runtime": 7.22.10 + "@types/react": 18.2.20 + react: 18.2.0 + dev: false + + /@radix-ui/react-slot@1.0.2(@types/react@18.2.20)(react@18.2.0): + resolution: + { + integrity: sha512-YeTpuq4deV+6DusvVUW4ivBgnkHwECUu0BiN43L5UCDFgdhsRUWAghhTF5MbvNTPzmiFOx90asDSUjWuCNapwg==, + } + peerDependencies: + "@types/react": "*" + react: ^16.8 || ^17.0 || ^18.0 + peerDependenciesMeta: + "@types/react": + optional: true + dependencies: + "@babel/runtime": 7.22.10 + "@radix-ui/react-compose-refs": 1.0.1(@types/react@18.2.20)(react@18.2.0) + "@types/react": 18.2.20 + react: 18.2.0 + dev: false + /@rushstack/eslint-patch@1.3.3: resolution: { diff --git a/frontend/src/app/columns.tsx b/frontend/src/app/columns.tsx index 93278be..1c6cd90 100644 --- a/frontend/src/app/columns.tsx +++ b/frontend/src/app/columns.tsx @@ -1,5 +1,6 @@ "use client"; import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; import { Repo } from "@/lib/schemas"; import { ColumnDef } from "@tanstack/react-table"; @@ -16,6 +17,34 @@ export const columns: ColumnDef[] = [ ); }, + cell: function ({ row }) { + return ( + + ); + }, }, { accessorKey: "description", @@ -41,7 +70,7 @@ export const columns: ColumnDef[] = [ accessorKey: "stars", header: function () { return ( -
+
Stars ⭐ diff --git a/frontend/src/components/ui/button.tsx b/frontend/src/components/ui/button.tsx new file mode 100644 index 0000000..29123a7 --- /dev/null +++ b/frontend/src/components/ui/button.tsx @@ -0,0 +1,56 @@ +import * as React from "react"; +import { Slot } from "@radix-ui/react-slot"; +import { cva, type VariantProps } from "class-variance-authority"; + +import { cn } from "@/lib/utils"; + +const buttonVariants = cva( + "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/90", + destructive: + "bg-destructive text-destructive-foreground hover:bg-destructive/90", + outline: + "border border-input bg-background hover:bg-accent hover:text-accent-foreground", + secondary: + "bg-secondary text-secondary-foreground hover:bg-secondary/80", + ghost: "hover:bg-accent hover:text-accent-foreground", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: "h-10 px-4 py-2", + sm: "h-9 rounded-md px-3", + lg: "h-11 rounded-md px-8", + icon: "h-10 w-10", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + }, +); + +export interface ButtonProps + extends React.ButtonHTMLAttributes, + VariantProps { + asChild?: boolean; +} + +const Button = React.forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button"; + return ( + + ); + }, +); +Button.displayName = "Button"; + +export { Button, buttonVariants };