import { useState } from 'react'; import { BookmarkFilledIcon, BookmarkIcon } from '@radix-ui/react-icons'; import type { FC } from 'react'; import { Spinner } from '~/components/svg'; import { cn } from '~/utils'; type MenuItemProps = { tag: string; selected: boolean; count?: number; handleSubmit: (tag: string) => Promise; icon?: React.ReactNode; highlightSelected?: boolean; }; const BookmarkItem: FC = ({ tag, selected, count, handleSubmit, icon, highlightSelected, ...rest }) => { const [isLoading, setIsLoading] = useState(false); const clickHandler = async () => { setIsLoading(true); await handleSubmit(tag); setIsLoading(false); }; return (
{icon ? ( icon ) : isLoading ? ( ) : selected ? ( ) : ( )}
{tag}
{count !== undefined && (
)}
); }; export default BookmarkItem;