diff --git a/site/src/components/Alert/Alert.tsx b/site/src/components/Alert/Alert.tsx index 6db0a99ff2..9bb73908c2 100644 --- a/site/src/components/Alert/Alert.tsx +++ b/site/src/components/Alert/Alert.tsx @@ -7,13 +7,7 @@ import { TriangleAlertIcon, XIcon, } from "lucide-react"; -import { - type FC, - forwardRef, - type PropsWithChildren, - type ReactNode, - useState, -} from "react"; +import { type FC, type ReactNode, useState } from "react"; import { cn } from "utils/cn"; const alertVariants = cva( @@ -131,7 +125,9 @@ export const Alert: FC = ({ ); }; -export const AlertDetail: FC = ({ children }) => { +export const AlertDetail: React.FC = ({ + children, +}) => { return ( {children} @@ -139,13 +135,11 @@ export const AlertDetail: FC = ({ children }) => { ); }; -export const AlertTitle = forwardRef< - HTMLHeadingElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -

-)); +export const AlertTitle: React.FC> = ({ + className, + ...props +}) => { + return ( +

+ ); +}; diff --git a/site/src/components/Avatar/Avatar.tsx b/site/src/components/Avatar/Avatar.tsx index 3b9de3657d..e2e8637d67 100644 --- a/site/src/components/Avatar/Avatar.tsx +++ b/site/src/components/Avatar/Avatar.tsx @@ -13,7 +13,6 @@ import { useTheme } from "@emotion/react"; import * as AvatarPrimitive from "@radix-ui/react-avatar"; import { cva, type VariantProps } from "class-variance-authority"; -import * as React from "react"; import { getExternalImageStylesFromUrl } from "theme/externalImages"; import { cn } from "utils/cn"; @@ -58,17 +57,22 @@ export type AvatarProps = AvatarPrimitive.AvatarProps & VariantProps & { src?: string; fallback?: string; + ref?: React.Ref>; }; -const Avatar = React.forwardRef< - React.ElementRef, - AvatarProps ->(({ className, size, variant, src, fallback, children, ...props }, ref) => { +export const Avatar: React.FC = ({ + className, + size, + variant, + src, + fallback, + children, + ...props +}) => { const theme = useTheme(); return ( @@ -85,7 +89,4 @@ const Avatar = React.forwardRef< {children} ); -}); -Avatar.displayName = AvatarPrimitive.Root.displayName; - -export { Avatar }; +}; diff --git a/site/src/components/Badge/Badge.tsx b/site/src/components/Badge/Badge.tsx index df542e4678..9c12fca7d7 100644 --- a/site/src/components/Badge/Badge.tsx +++ b/site/src/components/Badge/Badge.tsx @@ -4,7 +4,6 @@ */ import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; -import { forwardRef } from "react"; import { cn } from "utils/cn"; const badgeVariants = cva( @@ -58,28 +57,26 @@ const badgeVariants = cva( }, ); -interface BadgeProps - extends React.HTMLAttributes, - VariantProps { - asChild?: boolean; -} +type BadgeProps = React.ComponentPropsWithRef<"div"> & + VariantProps & { + asChild?: boolean; + }; -export const Badge = forwardRef( - ( - { className, variant, size, border, hover, asChild = false, ...props }, - ref, - ) => { - const Comp = asChild ? Slot : "div"; +export const Badge: React.FC = ({ + className, + variant, + size, + border, + hover, + asChild = false, + ...props +}) => { + const Comp = asChild ? Slot : "div"; - return ( - - ); - }, -); + return ( + + ); +}; diff --git a/site/src/components/Badges/Badges.tsx b/site/src/components/Badges/Badges.tsx index 9cd62de362..4de9539053 100644 --- a/site/src/components/Badges/Badges.tsx +++ b/site/src/components/Badges/Badges.tsx @@ -1,13 +1,7 @@ import { Badge } from "components/Badge/Badge"; import { Stack } from "components/Stack/Stack"; -import { - type FC, - forwardRef, - type HTMLAttributes, - type PropsWithChildren, -} from "react"; -export const EnabledBadge: FC = () => { +export const EnabledBadge: React.FC = () => { return ( Enabled @@ -15,25 +9,25 @@ export const EnabledBadge: FC = () => { ); }; -export const EntitledBadge: FC = () => { +export const EntitledBadge: React.FC = () => { return ( Entitled ); }; -export const DisabledBadge: FC = forwardRef< - HTMLDivElement, - HTMLAttributes ->((props, ref) => { + +export const DisabledBadge: React.FC> = ({ + ...props +}) => { return ( - + Disabled ); -}); +}; -export const EnterpriseBadge: FC = () => { +export const EnterpriseBadge: React.FC = () => { return ( Enterprise @@ -45,7 +39,7 @@ interface PremiumBadgeProps { children?: React.ReactNode; } -export const PremiumBadge: FC = ({ +export const PremiumBadge: React.FC = ({ children = "Premium", }) => { return ( @@ -55,7 +49,7 @@ export const PremiumBadge: FC = ({ ); }; -export const PreviewBadge: FC = () => { +export const PreviewBadge: React.FC = () => { return ( Preview @@ -63,7 +57,7 @@ export const PreviewBadge: FC = () => { ); }; -export const AlphaBadge: FC = () => { +export const AlphaBadge: React.FC = () => { return ( Alpha @@ -71,7 +65,7 @@ export const AlphaBadge: FC = () => { ); }; -export const DeprecatedBadge: FC = () => { +export const DeprecatedBadge: React.FC = () => { return ( Deprecated @@ -79,7 +73,7 @@ export const DeprecatedBadge: FC = () => { ); }; -export const Badges: FC = ({ children }) => { +export const Badges: React.FC = ({ children }) => { return ( & { - separator?: ReactNode; - } ->(({ ...props }, ref) =>