import Drawer from '@vtex-components/drawer' import React from 'react' import type { DrawerProps } from '@vtex-components/drawer' import type { PropsWithChildren, ComponentPropsWithoutRef } from 'react' import MinicartDrawerContent from './Content' import MinicartDrawerFooter from './Footer' import MinicartDrawerHeader from './Header' import MinicartDrawerToast from './Toast' import type { Props as MinicartDrawerContentProps } from './Content' import type { Item } from '../types' interface Message extends Pick< ComponentPropsWithoutRef, 'type' | 'content' > { id: string } export interface Props extends DrawerProps, Pick< MinicartDrawerContentProps, 'removeItem' | 'updateItem' | 'numberFormat' | 'items' >, Pick< ComponentPropsWithoutRef, 'onCheckout' | 'total' | 'subTotal' | 'numberFormat' | 'disableViewCart' > { hideToast: (id: string) => void messages: Message[] variant?: string } const MinicartDrawer = ({ isOpen, items, total, subTotal, onClose, removeItem, updateItem, numberFormat, onCheckout, hideToast, disableViewCart, messages, variant = 'default', }: PropsWithChildren>) => { const drawerVariant = `minicart.${variant}` const customVariant = `minicart.${variant}.drawer` return ( {messages.map(({ id, ...messageProps }) => ( hideToast(id)} /> ))} ) } export default MinicartDrawer