UNPKG

nerm-product-card

Version:
42 lines (41 loc) 1.31 kB
import React from 'react'; import { Props as ProductCardProps } from '../components/ProductCard'; import { Props as ProductTitleProps } from '../components/ProductTitle'; import { Props as ProductImageProps } from '../components/ProductImage'; import { Props as ProductButtonsProps } from '../components/ProductButtons'; export interface Product { id: number; title: string; img?: string; } export interface ProductContextProps { counter: number; increaseBy: (value: number) => void; product: Product; maxCount?: number; } export interface ProductCardHOCProps { ({ children, product }: ProductCardProps): React.ReactElement; Title: (Props: ProductTitleProps) => React.ReactElement; Image: (Props: ProductImageProps) => React.ReactElement; Buttons: (Props: ProductButtonsProps) => React.ReactElement; } export interface onChangeArgs { product: Product; count: number; } export interface ProductInTheCart extends Product { count: number; } export interface InitialValues { count?: number; maxCount?: number; } export interface ProductCardhandlers { count: number; isMaxCountReached: boolean; maxCount?: number; product: Product; increaseBy: (value: number) => void; reset: () => void; }