-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidebar-items.tsx
42 lines (36 loc) · 1004 Bytes
/
sidebar-items.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use client'
import { Chat } from '@/lib/types'
import { AnimatePresence, motion } from 'framer-motion'
import { removeChat, shareChat } from '@/app/actions'
import { SidebarActions } from '@/components/sidebar-actions'
import { SidebarItem } from '@/components/sidebar-item'
interface SidebarItemsProps {
chats?: Chat[]
}
export function SidebarItems({ chats }: SidebarItemsProps) {
if (!chats?.length) return null
return (
<AnimatePresence>
{chats.map(
(chat, index) =>
chat && (
<motion.div
key={chat?.id}
exit={{
opacity: 0,
height: 0
}}
>
<SidebarItem index={index} chat={chat}>
<SidebarActions
chat={chat}
removeChat={removeChat}
shareChat={shareChat}
/>
</SidebarItem>
</motion.div>
)
)}
</AnimatePresence>
)
}