diff --git a/templates/website/src/components/ui/button.tsx b/templates/website/src/components/ui/button.tsx index 5b7a65282e..78ef80b8e2 100644 --- a/templates/website/src/components/ui/button.tsx +++ b/templates/website/src/components/ui/button.tsx @@ -34,16 +34,19 @@ export interface ButtonProps extends React.ButtonHTMLAttributes, VariantProps { asChild?: boolean + ref?: React.Ref } -const Button = React.forwardRef( - ({ asChild = false, className, size, variant, ...props }, ref) => { - const Comp = asChild ? Slot : 'button' - return ( - - ) - }, -) -Button.displayName = 'Button' +const Button: React.FC = ({ + asChild = false, + className, + size, + variant, + ref, + ...props +}) => { + const Comp = asChild ? Slot : 'button' + return +} export { Button, buttonVariants } diff --git a/templates/website/src/components/ui/card.tsx b/templates/website/src/components/ui/card.tsx index 6ab031b5e2..5a7e35a51f 100644 --- a/templates/website/src/components/ui/card.tsx +++ b/templates/website/src/components/ui/card.tsx @@ -1,55 +1,48 @@ import { cn } from 'src/utilities/cn' import * as React from 'react' -const Card = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +const Card: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
) -Card.displayName = 'Card' -const CardHeader = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +const CardHeader: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
) -CardHeader.displayName = 'CardHeader' -const CardTitle = React.forwardRef>( - ({ className, ...props }, ref) => ( -

- ), +const CardTitle: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +

) -CardTitle.displayName = 'CardTitle' -const CardDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( +const CardDescription: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => (

-)) -CardDescription.displayName = 'CardDescription' - -const CardContent = React.forwardRef>( - ({ className, ...props }, ref) => ( -

- ), ) -CardContent.displayName = 'CardContent' -const CardFooter = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), +const CardContent: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
+) + +const CardFooter: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
) -CardFooter.displayName = 'CardFooter' export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } diff --git a/templates/website/src/components/ui/checkbox.tsx b/templates/website/src/components/ui/checkbox.tsx index fe23eed55e..db07cad266 100644 --- a/templates/website/src/components/ui/checkbox.tsx +++ b/templates/website/src/components/ui/checkbox.tsx @@ -5,10 +5,11 @@ import * as CheckboxPrimitive from '@radix-ui/react-checkbox' import { Check } from 'lucide-react' import * as React from 'react' -const Checkbox = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( +const Checkbox: React.FC< + { + ref?: React.Ref + } & React.ComponentProps +> = ({ className, ref, ...props }) => ( -)) -Checkbox.displayName = CheckboxPrimitive.Root.displayName +) export { Checkbox } diff --git a/templates/website/src/components/ui/input.tsx b/templates/website/src/components/ui/input.tsx index eb103a810b..b82e875724 100644 --- a/templates/website/src/components/ui/input.tsx +++ b/templates/website/src/components/ui/input.tsx @@ -1,23 +1,22 @@ import { cn } from 'src/utilities/cn' import * as React from 'react' -export interface InputProps extends React.InputHTMLAttributes {} - -const Input = React.forwardRef( - ({ type, className, ...props }, ref) => { - return ( - - ) - }, -) -Input.displayName = 'Input' +const Input: React.FC< + { + ref?: React.Ref + } & React.InputHTMLAttributes +> = ({ type, className, ref, ...props }) => { + return ( + + ) +} export { Input } diff --git a/templates/website/src/components/ui/label.tsx b/templates/website/src/components/ui/label.tsx index da8a964c4e..0df4cf607b 100644 --- a/templates/website/src/components/ui/label.tsx +++ b/templates/website/src/components/ui/label.tsx @@ -9,12 +9,11 @@ const labelVariants = cva( 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70', ) -const Label = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef & VariantProps ->(({ className, ...props }, ref) => ( +const Label: React.FC< + { ref?: React.Ref } & React.ComponentProps & + VariantProps +> = ({ className, ref, ...props }) => ( -)) -Label.displayName = LabelPrimitive.Root.displayName +) export { Label } diff --git a/templates/website/src/components/ui/pagination.tsx b/templates/website/src/components/ui/pagination.tsx index c747432f3b..86b56931a6 100644 --- a/templates/website/src/components/ui/pagination.tsx +++ b/templates/website/src/components/ui/pagination.tsx @@ -13,19 +13,16 @@ const Pagination = ({ className, ...props }: React.ComponentProps<'nav'>) => ( {...props} /> ) -Pagination.displayName = 'Pagination' -const PaginationContent = React.forwardRef>( - ({ className, ...props }, ref) => ( -
    - ), +const PaginationContent: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) => ( +
      ) -PaginationContent.displayName = 'PaginationContent' -const PaginationItem = React.forwardRef>( - ({ className, ...props }, ref) =>
    • , -) -PaginationItem.displayName = 'PaginationItem' +const PaginationItem: React.FC< + { ref?: React.Ref } & React.HTMLAttributes +> = ({ className, ref, ...props }) =>
    • type PaginationLinkProps = { isActive?: boolean @@ -45,7 +42,6 @@ const PaginationLink = ({ className, isActive, size = 'icon', ...props }: Pagina {...props} /> ) -PaginationLink.displayName = 'PaginationLink' const PaginationPrevious = ({ className, @@ -61,7 +57,6 @@ const PaginationPrevious = ({ Previous ) -PaginationPrevious.displayName = 'PaginationPrevious' const PaginationNext = ({ className, ...props }: React.ComponentProps) => ( ) -PaginationNext.displayName = 'PaginationNext' const PaginationEllipsis = ({ className, ...props }: React.ComponentProps<'span'>) => ( More pages ) -PaginationEllipsis.displayName = 'PaginationEllipsis' export { Pagination, diff --git a/templates/website/src/components/ui/select.tsx b/templates/website/src/components/ui/select.tsx index d9da66223f..85b2773ffd 100644 --- a/templates/website/src/components/ui/select.tsx +++ b/templates/website/src/components/ui/select.tsx @@ -11,10 +11,9 @@ const SelectGroup = SelectPrimitive.Group const SelectValue = SelectPrimitive.Value -const SelectTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ children, className, ...props }, ref) => ( +const SelectTrigger: React.FC< + { ref?: React.Ref } & React.ComponentProps +> = ({ children, className, ref, ...props }) => ( span]:line-clamp-1', @@ -28,13 +27,11 @@ const SelectTrigger = React.forwardRef< -)) -SelectTrigger.displayName = SelectPrimitive.Trigger.displayName +) -const SelectScrollUpButton = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( +const SelectScrollUpButton: React.FC< + { ref?: React.Ref } & React.ComponentProps +> = ({ className, ref, ...props }) => ( -)) -SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName +) -const SelectScrollDownButton = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( +const SelectScrollDownButton: React.FC< + { ref?: React.Ref } & React.ComponentProps< + typeof SelectPrimitive.ScrollDownButton + > +> = ({ className, ref, ...props }) => ( -)) -SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName +) -const SelectContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ children, className, position = 'popper', ...props }, ref) => ( +const SelectContent: React.FC< + { + ref?: React.Ref + } & React.ComponentProps +> = ({ children, className, position = 'popper', ref, ...props }) => ( -)) -SelectContent.displayName = SelectPrimitive.Content.displayName +) -const SelectLabel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( +const SelectLabel: React.FC< + { ref?: React.Ref } & React.ComponentProps +> = ({ className, ref, ...props }) => ( -)) -SelectLabel.displayName = SelectPrimitive.Label.displayName +) -const SelectItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ children, className, ...props }, ref) => ( +const SelectItem: React.FC< + { ref?: React.Ref; value: string } & React.ComponentProps< + typeof SelectPrimitive.Item + > +> = ({ children, className, ref, ...props }) => ( {children} -)) -SelectItem.displayName = SelectPrimitive.Item.displayName +) -const SelectSeparator = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( +const SelectSeparator: React.FC< + { ref?: React.Ref } & React.ComponentProps +> = ({ className, ref, ...props }) => ( -)) -SelectSeparator.displayName = SelectPrimitive.Separator.displayName +) export { Select, diff --git a/templates/website/src/components/ui/textarea.tsx b/templates/website/src/components/ui/textarea.tsx index 3dd3492011..9158697c2d 100644 --- a/templates/website/src/components/ui/textarea.tsx +++ b/templates/website/src/components/ui/textarea.tsx @@ -1,22 +1,21 @@ import { cn } from 'src/utilities/cn' import * as React from 'react' -export interface TextareaProps extends React.TextareaHTMLAttributes {} - -const Textarea = React.forwardRef( - ({ className, ...props }, ref) => { - return ( -