Skip to content

Commit

Permalink
Stage 20: Setup tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Jihillestad committed Jul 29, 2024
1 parent 062ed53 commit de4521f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
36 changes: 36 additions & 0 deletions components/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"

import { cn } from "@/lib/utils"

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<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
}

export { Badge, badgeVariants }
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@radix-ui/react-slot": "^1.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"github-slugger": "^2.0.0",
"lucide-react": "^0.408.0",
"next": "14.2.5",
"next-themes": "^0.3.0",
Expand Down
1 change: 1 addition & 0 deletions velite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const posts = defineCollection({
description: s.string().max(999).optional(),
date: s.isodate(),
published: s.boolean().default(true),
tags: s.array(s.string()).optional(),
body: s.mdx(),
})
.transform(computedFields),
Expand Down

0 comments on commit de4521f

Please sign in to comment.