import React, { useCallback, useState } from 'react' import { Button } from 'theme-ui' import type { PropsWithChildren } from 'react' import Spinner from '../../../Spinner' import type { Item } from '../../types' interface Props { item: T variant: string removeItem: (item: T) => Promise | void } const MinicartDrawerRemoveItem = ({ item, variant, removeItem, }: PropsWithChildren>) => { const [isLoading, setIsLoading] = useState(false) const onClick = useCallback(async () => { try { setIsLoading(true) await removeItem(item) } finally { setIsLoading(false) } }, [item, removeItem]) return ( ) } export default MinicartDrawerRemoveItem