diff --git a/app/frontend/components/ui/badge.tsx b/app/frontend/components/ui/badge.tsx new file mode 100644 index 0000000..2e52f3d --- /dev/null +++ b/app/frontend/components/ui/badge.tsx @@ -0,0 +1,36 @@ +import * as React from "react"; +import { type VariantProps, cva } from "class-variance-authority"; + +import { cn } from "@/utils/ui"; + +const badgeVariants = cva( + "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "border-transparent bg-primary text-primary-foreground hover:bg-primary/80", + secondary: + "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", + destructive: + "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + }, +); + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ); +} + +export { Badge, badgeVariants }; diff --git a/app/frontend/pages/companies/show.tsx b/app/frontend/pages/companies/show.tsx index f84f0c6..9723103 100644 --- a/app/frontend/pages/companies/show.tsx +++ b/app/frontend/pages/companies/show.tsx @@ -1,6 +1,7 @@ import { BriefcaseBusiness } from "lucide-react"; import ExternalLink from "@/components/external_link"; +import { Badge } from "@/components/ui/badge"; import { Separator } from "@/components/ui/separator"; import type { Company } from "@/types/company"; @@ -23,6 +24,19 @@ function Show({ company }: Props) { )}
+
+ {company.technologies.map((technology) => ( + + {technology.name} + + ))} +

{company.description}

diff --git a/app/frontend/types/company.ts b/app/frontend/types/company.ts index 9c65cca..ca6d62f 100644 --- a/app/frontend/types/company.ts +++ b/app/frontend/types/company.ts @@ -1,7 +1,10 @@ +import { Technology } from "./technology"; + export interface Company { id: number; name: string; website?: string; careersPage?: string; description?: string; + technologies: Technology[]; } diff --git a/app/frontend/types/technology.ts b/app/frontend/types/technology.ts new file mode 100644 index 0000000..77cbccb --- /dev/null +++ b/app/frontend/types/technology.ts @@ -0,0 +1,6 @@ +export interface Technology { + id: number; + name: string; + backgroundColor?: string; + textColor?: string; +} diff --git a/db/seeds.rb b/db/seeds.rb index ab4fb4f..1bf305f 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -10,7 +10,6 @@ def perform destroy_data! seed_technologies seed_companies - seed_company_technologies end def destroy_data! @@ -44,13 +43,6 @@ def seed_companies end end - def seed_company_technologies - CompanyTechnology.create!(company: @company_1, technology: @ruby) - CompanyTechnology.create!(company: @company_1, technology: @rails) - CompanyTechnology.create!(company: @company_2, technology: @ruby) - CompanyTechnology.create!(company: @company_2, technology: @rails) - end - private def create_records(model, count, &block)