From 7550d4346c43c4203009bb15b7997873bfb0f481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Casal?= Date: Sun, 3 Sep 2023 17:30:14 +0100 Subject: [PATCH] removed extraneous components --- .../ui+/components/ui/scroll-area-radix.tsx | 66 --------------- .../ui+/components/ui/scroll-area-shadcn.tsx | 33 -------- .../components/ui/slide-in-dialog-shadcn.tsx | 80 ------------------- 3 files changed, 179 deletions(-) delete mode 100644 app/routes/_marketing+/ui+/components/ui/scroll-area-radix.tsx delete mode 100644 app/routes/_marketing+/ui+/components/ui/scroll-area-shadcn.tsx delete mode 100644 app/routes/_marketing+/ui+/components/ui/slide-in-dialog-shadcn.tsx diff --git a/app/routes/_marketing+/ui+/components/ui/scroll-area-radix.tsx b/app/routes/_marketing+/ui+/components/ui/scroll-area-radix.tsx deleted file mode 100644 index bdc2fb9..0000000 --- a/app/routes/_marketing+/ui+/components/ui/scroll-area-radix.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area' -import { extractMarginProps, withMarginProps, withBreakpoints, radiusProp } from '../helpers.ts' -import type { MarginProps, GetPropDefTypes, PropDef } from '../helpers.ts' -import { type ComponentPropsWithRef, type ElementRef, forwardRef } from 'react' -import { cn } from '~/utils/misc.ts' - -const sizes = ['1', '2', '3'] as const -const scrollbarsValues = ['vertical', 'horizontal', 'both'] as const - -const scrollAreaPropDefs = { - size: { type: 'enum', values: sizes, default: '1', responsive: true }, - radius: radiusProp, - scrollbars: { type: 'enum', values: scrollbarsValues, default: 'both' }, -} satisfies { - size: PropDef<(typeof sizes)[number]> - radius: typeof radiusProp - scrollbars: PropDef<(typeof scrollbarsValues)[number]> -} - -export { scrollAreaPropDefs } - -type ScrollAreaElement = ElementRef -type ScrollAreaOwnProps = GetPropDefTypes -interface ScrollAreaProps - extends ComponentPropsWithRef, - Omit, 'dir'>, - MarginProps, - ScrollAreaOwnProps {} -const ScrollArea = forwardRef((props, forwardedRef) => { - const { rest: marginRest, ...marginProps } = extractMarginProps(props) - const { - className, - style, - type, - scrollHideDelay = type !== 'scroll' ? 0 : undefined, - dir, - size = scrollAreaPropDefs.size.default, - radius = scrollAreaPropDefs.radius.default, - scrollbars = scrollAreaPropDefs.scrollbars.default, - ...viewportProps - } = marginRest - return ( - - -
- - {scrollbars !== 'vertical' ? ( - - - - ) : null} - - {scrollbars !== 'horizontal' ? ( - - - - ) : null} - - {scrollbars === 'both' ? : null} - - ) -}) -ScrollArea.displayName = 'ScrollArea' - -export { ScrollArea } -export type { ScrollAreaProps } diff --git a/app/routes/_marketing+/ui+/components/ui/scroll-area-shadcn.tsx b/app/routes/_marketing+/ui+/components/ui/scroll-area-shadcn.tsx deleted file mode 100644 index 129b8e7..0000000 --- a/app/routes/_marketing+/ui+/components/ui/scroll-area-shadcn.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area' -import { type ComponentPropsWithoutRef, type ElementRef, forwardRef } from 'react' -import { cn } from '~/utils/misc.ts' - -const ScrollArea = forwardRef, ComponentPropsWithoutRef>(({ className, children, ...props }, ref) => ( - - {children} - - - -)) -ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName - -const ScrollBar = forwardRef, ComponentPropsWithoutRef>( - ({ className, orientation = 'vertical', ...props }, ref) => ( - - - - ), -) -ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName - -export { ScrollArea, ScrollBar } diff --git a/app/routes/_marketing+/ui+/components/ui/slide-in-dialog-shadcn.tsx b/app/routes/_marketing+/ui+/components/ui/slide-in-dialog-shadcn.tsx deleted file mode 100644 index dac8203..0000000 --- a/app/routes/_marketing+/ui+/components/ui/slide-in-dialog-shadcn.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import * as DialogPrimitive from '@radix-ui/react-dialog' -import { cva, type VariantProps } from 'class-variance-authority' -import { type ComponentPropsWithoutRef, type ElementRef, forwardRef } from 'react' -import { cn } from '~/utils/misc.ts' - -/** - * The `SlideInDialog` needs to have a simple interface. Let's make this happen. - * - * I would want to have the fewest possible composable components as possible. - * If I have to choose between a title prop and a component, I would choose the prop. - * But I'd feel more confident if Radix Themes would do the same. - * - * The title is mandatory, so it should be a prop. - * The description is optional, so it should be an optional prop. - */ - -const SlideInDialog = DialogPrimitive.Root - -const SlideInDialogTrigger = DialogPrimitive.Trigger - -const SlideInDialogClose = DialogPrimitive.Close - -const SlideInDialogPortal = ({ className, ...props }: DialogPrimitive.DialogPortalProps) => -SlideInDialogPortal.displayName = DialogPrimitive.Portal.displayName - -const SlideInDialogOverlay = forwardRef, ComponentPropsWithoutRef>(({ className, ...props }, ref) => ( - -)) -SlideInDialogOverlay.displayName = DialogPrimitive.Overlay.displayName - -const slideInDialogVariants = cva( - 'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500', - { - variants: { - side: { - top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top', - bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom', - left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm', - right: 'inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm', - }, - }, - defaultVariants: { - side: 'right', - }, - }, -) - -interface SlideInDialogContentProps extends ComponentPropsWithoutRef, VariantProps {} - -const SlideInDialogContent = forwardRef, SlideInDialogContentProps>(({ side = 'right', className, children, ...props }, ref) => ( - - - - {children} - - Close - - - -)) -SlideInDialogContent.displayName = DialogPrimitive.Content.displayName - -const SlideInDialogTitle = forwardRef, ComponentPropsWithoutRef>(({ className, ...props }, ref) => ( - -)) -SlideInDialogTitle.displayName = DialogPrimitive.Title.displayName - -const SlideInDialogDescription = forwardRef, ComponentPropsWithoutRef>(({ className, ...props }, ref) => ( - -)) -SlideInDialogDescription.displayName = DialogPrimitive.Description.displayName - -export { SlideInDialog, SlideInDialogTrigger, SlideInDialogContent, SlideInDialogTitle, SlideInDialogDescription, SlideInDialogClose }