'use client'; import { AnimatePresence, motion } from 'framer-motion'; import { useState } from 'react'; import { useWindowSize } from 'usehooks-ts'; import type { UISuggestion } from '@/lib/editor/suggestions'; import { CrossIcon, MessageIcon } from './icons'; import { Button } from './ui/button'; import { cn } from '@/lib/utils'; import type { ArtifactKind } from './artifact'; export const Suggestion = ({ suggestion, onApply, artifactKind, }: { suggestion: UISuggestion; onApply: () => void; artifactKind: ArtifactKind; }) => { const [isExpanded, setIsExpanded] = useState(false); const { width: windowWidth } = useWindowSize(); return ( {!isExpanded ? ( { setIsExpanded(true); }} whileHover={{ scale: 1.1 }} > ) : (
Assistant
{suggestion.description}
)} ); };