feat: smooth collapse/expand animation for terminal toggle
Build & Push Portfolio Image / build-push (push) Successful in 3m41s

This commit is contained in:
Story Crater Bot
2026-09-02 10:05:00 -07:00
parent 82cd8940c2
commit da64fe930b
+17 -11
View File
@@ -1,6 +1,6 @@
'use client' 'use client'
import { motion } from 'framer-motion' import { motion, AnimatePresence } from 'framer-motion'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useTerminal } from '@/lib/TerminalContext' import { useTerminal } from '@/lib/TerminalContext'
import ReactMarkdown from 'react-markdown' import ReactMarkdown from 'react-markdown'
@@ -232,23 +232,28 @@ export function InteractiveTerminal() {
} }
return ( return (
<motion.div <div className="fixed bottom-6 right-6 z-40">
className="fixed bottom-6 right-6 z-40" <AnimatePresence mode="wait">
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
>
{!isOpen ? ( {!isOpen ? (
<button <motion.button
key="trigger"
onClick={() => setIsOpen(true)} onClick={() => setIsOpen(true)}
className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg font-mono text-sm shadow-lg" className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg font-mono text-sm shadow-lg"
initial={{ opacity: 0, scale: 0.9 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0, scale: 0.9 }}
transition={{ duration: 0.2 }}
> >
Ask Poimen ({isMac ? 'Cmd' : 'Ctrl'}+K) Ask Poimen ({isMac ? 'Cmd' : 'Ctrl'}+K)
</button> </motion.button>
) : ( ) : (
<motion.div <motion.div
key="terminal"
ref={containerRef} ref={containerRef}
initial={{ opacity: 0, y: 10 }} initial={{ opacity: 0, y: 20, scale: 0.95 }}
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0, scale: 1 }}
exit={{ opacity: 0, y: 20, scale: 0.95 }}
transition={{ duration: 0.25, ease: 'easeInOut' }}
style={{ width: `${width}px`, height: `${height}px` }} style={{ width: `${width}px`, height: `${height}px` }}
className={`rounded-lg shadow-2xl flex flex-col border relative ${ className={`rounded-lg shadow-2xl flex flex-col border relative ${
isDark isDark
@@ -357,6 +362,7 @@ export function InteractiveTerminal() {
</div> </div>
</motion.div> </motion.div>
)} )}
</motion.div> </AnimatePresence>
</div>
) )
} }