Skip to content

Commit

Permalink
feat(label): Add Label component using Radix UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Texiko-texiko committed Nov 6, 2024
1 parent f37100a commit f2c513c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"dependencies": {
"@monaco-editor/react": "4.6.0",
"@radix-ui/react-accordion": "^1.2.1",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.1",
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/components/ui/label.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from "react"
import * as LabelPrimitive from "@radix-ui/react-label"
import { cva, type VariantProps } from "class-variance-authority"

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

const labelVariants = cva(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
)

const Label = React.forwardRef<
React.ElementRef<typeof LabelPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
VariantProps<typeof labelVariants>
>(({ className, ...props }, ref) => (
<LabelPrimitive.Root
ref={ref}
className={cn(labelVariants(), className)}
{...props}
/>
))
Label.displayName = LabelPrimitive.Root.displayName

export { Label }
2 changes: 1 addition & 1 deletion frontend/src/routes/submissions/$submissionId/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Label } from "@/components/ui/label"
import {
Table,
TableBody,
Expand All @@ -17,7 +18,6 @@ import {
import { Textarea } from "@/components/ui/textarea"
import { $api } from "@/lib/api"
import MonacoEditor from "@monaco-editor/react"
import { Label } from "@radix-ui/react-label"
import { createFileRoute, Link } from "@tanstack/react-router"
import {
ArrowLeft,
Expand Down

0 comments on commit f2c513c

Please sign in to comment.