Skip to content

Commit 4fca322

Browse files
committed
Add close button to notification bubble
1 parent 9112266 commit 4fca322

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

components/chat-widget.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type Message = {
1212

1313
export function ChatWidget() {
1414
const [isOpen, setIsOpen] = useState(false);
15+
const [showNotification, setShowNotification] = useState(true);
1516
const [messages, setMessages] = useState<Message[]>([
1617
{ role: "model", text: "Hello! I'm Devendra's AI assistant. Ask me anything about his projects, skills, or experience." }
1718
]);
@@ -76,6 +77,38 @@ export function ChatWidget() {
7677
)}
7778
</motion.button>
7879

80+
{/* Notification Bubble */}
81+
<AnimatePresence>
82+
{!isOpen && showNotification && (
83+
<motion.div
84+
initial={{ opacity: 0, y: 10, scale: 0.9 }}
85+
animate={{ opacity: 1, y: 0, scale: 1 }}
86+
exit={{ opacity: 0, scale: 0.9 }}
87+
transition={{ delay: 2, duration: 0.5 }}
88+
className="fixed bottom-24 right-6 z-40 max-w-[200px]"
89+
>
90+
<div className="relative bg-background/80 backdrop-blur-md border border-purple-500/80 p-3 rounded-lg shadow-[0_0_15px_rgba(168,85,247,0.15)]">
91+
<p className="text-xs font-mono text-purple-400 leading-relaxed pr-2">
92+
Free to ask any questions. I am Devendra's AI assistant.
93+
</p>
94+
{/* Triangle Tail */}
95+
<div className="absolute -bottom-2 right-6 w-4 h-4 bg-background/80 border-b border-r border-purple-500/80 transform rotate-45"></div>
96+
97+
{/* Close Button */}
98+
<button
99+
onClick={(e) => {
100+
e.stopPropagation();
101+
setShowNotification(false);
102+
}}
103+
className="absolute -top-2 -left-2 bg-zinc-900 border border-purple-500/50 rounded-full p-1 hover:bg-purple-500/20 text-purple-400 transition-colors shadow-sm"
104+
>
105+
<X className="w-3 h-3" />
106+
</button>
107+
</div>
108+
</motion.div>
109+
)}
110+
</AnimatePresence>
111+
79112
{/* Chat Window */}
80113
<AnimatePresence>
81114
{isOpen && (

0 commit comments

Comments
 (0)