"use client" import { ChevronsUpDownIcon, FileTextIcon } from "lucide-react" import type { ComponentProps } from "react" import { createContext, useContext } from "react" import { Button } from "@/components/ui/button" import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card" import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible" import { cn } from "@/lib/utils" import { Shimmer } from "@/components/ai/shimmer" interface PlanContextValue { isStreaming: boolean } const PlanContext = createContext(null) const usePlan = () => { const context = useContext(PlanContext) if (!context) { throw new Error("Plan components must be used within Plan") } return context } export type PlanProps = ComponentProps & { isStreaming?: boolean } export const Plan = ({ className, isStreaming = false, children, ...props }: PlanProps) => ( {children} ) export type PlanHeaderProps = ComponentProps export const PlanHeader = ({ className, ...props }: PlanHeaderProps) => ( ) export type PlanTitleProps = Omit, "children"> & { children: string } export const PlanTitle = ({ children, ...props }: PlanTitleProps) => { const { isStreaming } = usePlan() return ( {isStreaming ? {children} : children} ) } export type PlanDescriptionProps = Omit, "children"> & { children: string } export const PlanDescription = ({ className, children, ...props }: PlanDescriptionProps) => { const { isStreaming } = usePlan() return ( {isStreaming ? {children} : children} ) } export type PlanActionProps = ComponentProps export const PlanAction = (props: PlanActionProps) => ( ) export type PlanContentProps = ComponentProps export const PlanContent = (props: PlanContentProps) => ( ) export type PlanFooterProps = ComponentProps<"div"> export const PlanFooter = (props: PlanFooterProps) => ( ) export type PlanTriggerProps = ComponentProps export const PlanTrigger = ({ className, ...props }: PlanTriggerProps) => ( ) /** Demo component for preview */ export default function PlanDemo() { return (
Rewrite AI Elements to SolidJS
Rewrite the AI Elements component library from React to SolidJS while maintaining compatibility with existing React-based shadcn/ui components.

Key Steps

  • Set up SolidJS project structure
  • Install solid-js/compat for React compatibility
  • Migrate components one by one
  • Update test suite for each component
) }