File size: 802 Bytes
f0743f4 | 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 | import type { FC } from 'react';
import { useBookmarkContext } from '~/Providers/BookmarkContext';
import BookmarkItem from './BookmarkItem';
interface BookmarkItemsProps {
tags: string[];
handleSubmit: (tag?: string) => void;
header: React.ReactNode;
}
const BookmarkItems: FC<BookmarkItemsProps> = ({ tags, handleSubmit, header }) => {
const { bookmarks } = useBookmarkContext();
return (
<>
{header}
{bookmarks.length > 0 && <div className="my-1.5 h-px" role="none" />}
{bookmarks.map((bookmark, i) => (
<BookmarkItem
key={`${bookmark._id ?? bookmark.tag}-${i}`}
tag={bookmark.tag}
selected={tags.includes(bookmark.tag)}
handleSubmit={handleSubmit}
/>
))}
</>
);
};
export default BookmarkItems;
|