diff --git a/.gitignore b/.gitignore index 3b0b403..f4c327c 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ dist-ssr *.sln *.sw? -.env \ No newline at end of file +.env +.env.* \ No newline at end of file diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx index d05bbc6..993a5ad 100644 --- a/src/components/ui/card.tsx +++ b/src/components/ui/card.tsx @@ -1,92 +1,44 @@ -import * as React from "react" +import * as React from 'react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; -function Card({ className, ...props }: React.ComponentProps<"div">) { +function Card({ className, ...props }: React.ComponentProps<'div'>) { + return ( +
+ ); +} + +function CardHeader({ className, ...props }: React.ComponentProps<'div'>) { return (
- ) + ); } -function CardHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) +function CardTitle({ className, ...props }: React.ComponentProps<'div'>) { + return
; } -function CardTitle({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) +function CardDescription({ className, ...props }: React.ComponentProps<'div'>) { + return
; } -function CardDescription({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) +function CardAction({ className, ...props }: React.ComponentProps<'div'>) { + return
; } -function CardAction({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) +function CardContent({ className, ...props }: React.ComponentProps<'div'>) { + return
; } -function CardContent({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) +function CardFooter({ className, ...props }: React.ComponentProps<'div'>) { + return
; } -function CardFooter({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) -} - -export { - Card, - CardHeader, - CardFooter, - CardTitle, - CardAction, - CardDescription, - CardContent, -} +export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent }; diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx index defeb01..7803f1f 100644 --- a/src/components/ui/checkbox.tsx +++ b/src/components/ui/checkbox.tsx @@ -1,30 +1,24 @@ -import * as React from "react" -import * as CheckboxPrimitive from "@radix-ui/react-checkbox" -import { CheckIcon } from "lucide-react" +import * as React from 'react'; +import * as CheckboxPrimitive from '@radix-ui/react-checkbox'; +import { CheckIcon } from 'lucide-react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; -function Checkbox({ - className, - ...props -}: React.ComponentProps) { +function Checkbox({ className, ...props }: React.ComponentProps) { return ( - - + + - ) + ); } -export { Checkbox } +export { Checkbox }; diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index d9ccec9..4c56845 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -1,49 +1,38 @@ -"use client" +'use client'; -import * as React from "react" -import * as DialogPrimitive from "@radix-ui/react-dialog" -import { XIcon } from "lucide-react" +import * as React from 'react'; +import * as DialogPrimitive from '@radix-ui/react-dialog'; +import { XIcon } from 'lucide-react'; -import { cn } from "@/lib/utils" +import { cn } from '@/lib/utils'; -function Dialog({ - ...props -}: React.ComponentProps) { - return +function Dialog({ ...props }: React.ComponentProps) { + return ; } -function DialogTrigger({ - ...props -}: React.ComponentProps) { - return +function DialogTrigger({ ...props }: React.ComponentProps) { + return ; } -function DialogPortal({ - ...props -}: React.ComponentProps) { - return +function DialogPortal({ ...props }: React.ComponentProps) { + return ; } -function DialogClose({ - ...props -}: React.ComponentProps) { - return +function DialogClose({ ...props }: React.ComponentProps) { + return ; } -function DialogOverlay({ - className, - ...props -}: React.ComponentProps) { +function DialogOverlay({ className, ...props }: React.ComponentProps) { return ( - ) + ); } function DialogContent({ @@ -52,15 +41,15 @@ function DialogContent({ showCloseButton = true, ...props }: React.ComponentProps & { - showCloseButton?: boolean + showCloseButton?: boolean; }) { return ( - + - Close + Close )} - ) + ); } -function DialogHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) +function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) { + return
; } -function DialogFooter({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ) +function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) { + return
; } -function DialogTitle({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) +function DialogTitle({ className, ...props }: React.ComponentProps) { + return ; } -function DialogDescription({ - className, - ...props -}: React.ComponentProps) { - return ( - - ) +function DialogDescription({ className, ...props }: React.ComponentProps) { + return ; } -export { - Dialog, - DialogClose, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogOverlay, - DialogPortal, - DialogTitle, - DialogTrigger, -} +export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger }; diff --git a/src/components/ui/form.tsx b/src/components/ui/form.tsx index 7d7474c..aae2099 100644 --- a/src/components/ui/form.tsx +++ b/src/components/ui/form.tsx @@ -1,57 +1,41 @@ -import * as React from "react" -import * as LabelPrimitive from "@radix-ui/react-label" -import { Slot } from "@radix-ui/react-slot" -import { - Controller, - FormProvider, - useFormContext, - useFormState, - type ControllerProps, - type FieldPath, - type FieldValues, -} from "react-hook-form" +import * as React from 'react'; +import * as LabelPrimitive from '@radix-ui/react-label'; +import { Slot } from '@radix-ui/react-slot'; +import { Controller, FormProvider, useFormContext, useFormState, type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form'; -import { cn } from "@/lib/utils" -import { Label } from "@/components/ui/label" +import { cn } from '@/lib/utils'; +import { Label } from '@/components/ui/label'; -const Form = FormProvider +const Form = FormProvider; -type FormFieldContextValue< - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, -> = { - name: TName -} +type FormFieldContextValue = FieldPath> = { + name: TName; +}; -const FormFieldContext = React.createContext( - {} as FormFieldContextValue -) +const FormFieldContext = React.createContext({} as FormFieldContextValue); -const FormField = < - TFieldValues extends FieldValues = FieldValues, - TName extends FieldPath = FieldPath, ->({ +const FormField = = FieldPath>({ ...props }: ControllerProps) => { return ( - ) -} + ); +}; const useFormField = () => { - const fieldContext = React.useContext(FormFieldContext) - const itemContext = React.useContext(FormItemContext) - const { getFieldState } = useFormContext() - const formState = useFormState({ name: fieldContext.name }) - const fieldState = getFieldState(fieldContext.name, formState) + const fieldContext = React.useContext(FormFieldContext); + const itemContext = React.useContext(FormItemContext); + const { getFieldState } = useFormContext(); + const formState = useFormState({ name: fieldContext.name }); + const fieldState = getFieldState(fieldContext.name, formState); if (!fieldContext) { - throw new Error("useFormField should be used within ") + throw new Error('useFormField should be used within '); } - const { id } = itemContext + const { id } = itemContext; return { id, @@ -60,106 +44,72 @@ const useFormField = () => { formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState, - } -} + }; +}; type FormItemContextValue = { - id: string -} + id: string; +}; -const FormItemContext = React.createContext( - {} as FormItemContextValue -) +const FormItemContext = React.createContext({} as FormItemContextValue); -function FormItem({ className, ...props }: React.ComponentProps<"div">) { - const id = React.useId() +function FormItem({ className, ...props }: React.ComponentProps<'div'>) { + const id = React.useId(); return ( -
+
- ) + ); } -function FormLabel({ - className, - ...props -}: React.ComponentProps) { - const { error, formItemId } = useFormField() +function FormLabel({ className, ...props }: React.ComponentProps) { + const { error, formItemId } = useFormField(); return (