UNPKG

afrcode-product-card

Version:

Este es un paquete de pruebas de despliegue en ```'npm'```

64 lines (63 loc) 1.74 kB
import { CSSProperties, ReactElement } from 'react'; export interface Product { id: string; title: string; img?: string; } export interface ProductCartOnChangeArgs { product: Product; count: number; } export interface ProductCardHandlers { count: number; isMaxCountReached: boolean; maxCount?: number; product: Product; handleIncreseBy: (value: number) => void; handleReset: () => void; } export interface InitialValues { count?: number; maxCount?: number; } export interface ProductCardProps { product: Product; children?: ReactElement | ReactElement[] | ((args: ProductCardHandlers) => JSX.Element); className?: string; style?: CSSProperties; onChange?: (args: ProductCartOnChangeArgs) => void; value?: number; initialValues?: InitialValues; } export interface ProductTitleProps { title?: string; className?: string; style?: CSSProperties; } export interface ProductImageProps { img?: string; className?: string; style?: CSSProperties; } export interface ProductButtonsProps { className?: string; style?: CSSProperties; } export interface ProductContextProps { counter: number; maxCount?: number; product: Product; handleIncreseBy: (value: number) => void; } export interface ProductCardPropsTypes { (Props: ProductCardProps): JSX.Element; Title: (Props: ProductTitleProps) => JSX.Element; Image: (Props: ProductImageProps) => JSX.Element; Buttons: (Props: ProductButtonsProps) => JSX.Element; } export interface ProductInCart extends Product { count: number; } export interface ShoppingCart { [key: string]: ProductInCart; }