Skip to content

Commit

Permalink
fix path into ui components docker-false no-release
Browse files Browse the repository at this point in the history
  • Loading branch information
caioricciuti committed Oct 14, 2024
1 parent 29dd84f commit 7553179
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 34 deletions.
28 changes: 0 additions & 28 deletions docs/components/ui/RainbowButton.tsx

This file was deleted.

64 changes: 58 additions & 6 deletions docs/components/ui/carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,62 @@ import useEmblaCarousel, {
type UseEmblaCarouselType,
} from "embla-carousel-react";
import { ArrowLeft, ArrowRight } from "lucide-react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
const cn = (...classes: any[]) => classes.filter(Boolean).join(" ");

// Button component
const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
);

interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> {
asChild?: boolean
}

const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return (
<Comp
className={cn(buttonVariants({ variant, size, className }))}
ref={ref}
{...props}
/>
)
}
);
Button.displayName = "Button";

// Carousel Types
type CarouselApi = UseEmblaCarouselType[1];
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
type CarouselOptions = UseCarouselParameters[0];
Expand All @@ -30,18 +82,18 @@ type CarouselContextProps = {
canScrollNext: boolean;
} & CarouselProps;

// Carousel Context
const CarouselContext = React.createContext<CarouselContextProps | null>(null);

function useCarousel() {
const context = React.useContext(CarouselContext);

if (!context) {
throw new Error("useCarousel must be used within a <Carousel />");
}

return context;
}

// Carousel Components
const Carousel = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement> & CarouselProps
Expand Down Expand Up @@ -206,7 +258,7 @@ const CarouselPrevious = React.forwardRef<
variant={variant}
size={size}
className={cn(
"absolute h-8 w-8 rounded-full",
"absolute h-8 w-8 rounded-full",
orientation === "horizontal"
? "-left-12 top-1/2 -translate-y-1/2"
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
Expand Down Expand Up @@ -259,4 +311,4 @@ export {
CarouselItem,
CarouselPrevious,
CarouselNext,
};
};

0 comments on commit 7553179

Please sign in to comment.