thon-product-card
Version:
este es mi paquete de pruebas para subir a NPM.
42 lines (41 loc) • 1.28 kB
TypeScript
/// <reference types="react" />
import { Props as ProductButtonsProp } from "../components/ProductButtons";
import { Props as ProductCardProps } from "../components/ProductCard";
import { Props as ProductImageProps } from "../components/ProductImage";
import { Props as ProductTitleProps } from "../components/ProductTitle";
export interface Product {
id: string;
title: string;
img?: string;
}
export interface ProductContextProps {
counter: number;
increaseBy: (value: number) => void;
product: Product;
maxCount?: number;
}
export interface ProductCardHocProps {
({ product, children }: ProductCardProps): JSX.Element;
Title: (Props: ProductTitleProps) => JSX.Element;
Image: (Props: ProductImageProps) => JSX.Element;
Buttons: (Props: ProductButtonsProp) => JSX.Element;
}
export interface OnChangeArgs {
product: Product;
count: number;
}
export interface ProductInCart extends Product {
count: number;
}
export interface InitialValue {
count?: number;
maxCount?: number;
}
export interface ProductCartHandlers {
count: number;
isMaxCountReached: boolean;
maxCount?: number;
product: Product;
increaseBy: (value: number) => void;
reset: () => void;
}