"use client"; import { Slot } from "@radix-ui/react-slot"; import * as React from "react"; import { cn } from "~/lib/utils"; type TimelineContextProps = { orientation: "horizontal" | "vertical"; }; const TimelineContext = React.createContext(null); function useTimeline() { const context = React.useContext(TimelineContext); if (!context) { throw new Error("useTimeline must be used within a ."); } return context; } interface TimelineProps extends React.ComponentPropsWithoutRef<"ol"> { orientation?: "horizontal" | "vertical"; } function Timeline({ className, orientation = "vertical", ...props }: TimelineProps) { return (
    ); } interface TimelineItemProps extends React.ComponentPropsWithoutRef<"li"> { asChild?: boolean; } function TimelineItem({ className, asChild, ...props }: TimelineItemProps) { const { orientation } = useTimeline(); const Comp = asChild ? Slot : "li"; return ( ); } interface TimelineSeparatorProps extends React.ComponentPropsWithoutRef<"div"> { asChild?: boolean; } function TimelineSeparator({ className, asChild, ...props }: TimelineSeparatorProps) { const { orientation } = useTimeline(); const Comp = asChild ? Slot : "div"; return ( ); } interface TimelineDotProps extends React.ComponentPropsWithoutRef<"div"> { variant?: "default" | "outline"; asChild?: boolean; } function TimelineDot({ variant = "default", className, asChild, ...props }: TimelineDotProps) { const { orientation } = useTimeline(); const Comp = asChild ? Slot : "div"; return ( ); } interface TimelineConnectorProps extends React.ComponentPropsWithoutRef<"div"> { asChild?: boolean; } function TimelineConnector({ className, asChild, ...props }: TimelineConnectorProps) { const { orientation } = useTimeline(); const Comp = asChild ? Slot : "div"; return ( ); } interface TimelineContentProps extends React.ComponentPropsWithoutRef<"div"> { asChild?: boolean; } function TimelineContent({ className, asChild, ...props }: TimelineContentProps) { const { orientation } = useTimeline(); const Comp = asChild ? Slot : "div"; return ( ); } interface TimelineTitleProps extends React.ComponentPropsWithoutRef<"div"> { asChild?: boolean; } function TimelineTitle({ className, asChild, ...props }: TimelineTitleProps) { const { orientation } = useTimeline(); const Comp = asChild ? Slot : "div"; return ( ); } interface TimelineDescriptionProps extends React.ComponentPropsWithoutRef<"div"> { asChild?: boolean; } function TimelineDescription({ className, asChild, ...props }: TimelineDescriptionProps) { const { orientation } = useTimeline(); const Comp = asChild ? Slot : "div"; return ( ); } export { Timeline, TimelineItem, TimelineSeparator, TimelineDot, TimelineConnector, TimelineContent, TimelineTitle, TimelineDescription, useTimeline, };