dfcd-product-card-difer
Version:
Este es un paquete de pruebas de despliegue en NPM en react
47 lines (46 loc) • 1.39 kB
TypeScript
import { CSSProperties } from "react";
import { Props as TitleProps } from "../components/ProductTitle";
import { Props as ImageProps } from "../components/ProductImage";
import { Props as ButtonProps } from "../components/ProductButtons";
export interface InitialValues {
count?: number;
maxCount?: number;
}
export interface ProductCardProps {
product: Product;
children: (args: ProductCardHandlers) => JSX.Element;
className?: string;
style?: CSSProperties;
onChange?: (args: OnChangesArgs) => void;
value?: number;
initialValues?: InitialValues;
}
export interface Product {
id: string;
title: string;
img?: string;
}
export interface ProductContextProps {
counter: number;
maxCount?: number;
product: Product;
increaseBy: (value: number) => void;
}
export interface OnChangesArgs {
product: Product;
count: number;
}
export interface ProductCardHOCProps {
({ children, product }: ProductCardProps): JSX.Element;
Title: (props: TitleProps) => JSX.Element;
Image: (props: ImageProps) => JSX.Element;
Buttons: (props: ButtonProps) => JSX.Element;
}
export interface ProductCardHandlers {
count: number;
isMaxCountReached: boolean;
maxCount?: number;
product: Product;
increaseBy: (value: number) => void;
reset: () => void;
}