mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-12 23:33:43 +08:00
31 lines
901 B
TypeScript
31 lines
901 B
TypeScript
/**
|
|
* FavoritesList - Scrollable list of favorite items
|
|
*/
|
|
|
|
import type { FavoriteItem } from '@/lib/types';
|
|
import { FavoritesItem } from './FavoritesItem';
|
|
import { FavoritesEmptyState } from './FavoritesEmptyState';
|
|
|
|
interface FavoritesListProps {
|
|
favorites: FavoriteItem[];
|
|
onRemove: (videoId: string | number, source: string) => void;
|
|
}
|
|
|
|
export function FavoritesList({ favorites, onRemove }: FavoritesListProps) {
|
|
if (favorites.length === 0) {
|
|
return <FavoritesEmptyState />;
|
|
}
|
|
|
|
return (
|
|
<div className="flex-1 overflow-y-auto -mx-2 px-2 space-y-2 scroll-smooth">
|
|
{favorites.map((item) => (
|
|
<FavoritesItem
|
|
key={`${item.source}:${item.videoId}`}
|
|
item={item}
|
|
onRemove={() => onRemove(item.videoId, item.source)}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|