Skip to main content

<FastProduct/>

A product item component

tip

Not using this component will require reporting clicks on your own. Example for this can be found at the

example.

Example

MyProduct.jsx
import {FastProduct} from "fast-component-library";

const MyProduct = ({product}) => {
const onClick = () => {
console.log("cool product clicked :)");
}

return (
<FastProduct label={product.l} id={product.id} price={product.p} comparePrice={product.p_c} image={product.t || product.t2} url={product.u}
onClick={onClick} currency={product.c} index={12} variants={product.vra}/>
)
}

export default MyProduct;
index.tsx
import {Results, ProductGrid,FastSimonApi,SearchBox} from "fast-component-library";
import React from "react";
import MyProduct from "../components"

export const App = () => {
const onClick = (id) => {
console.log(`product clicked: ${id}`);
}

return (
<FastSimonApi storeID={1} uuid={"rand-omuu-id12-3456"}>
<header>
Search: <SearchBox/>
</header>

<Results>
<ProductGrid onClick={onClick} renderProduct={product => <MyProduct product={product} key={product.id}/>}/>
</Results>
</FastSimonApi>
)
}

Props

OptionTypeDescription
labelstring (required)Product card title
idstring (required)Product card id
pricestring (required)Product card price
imagestring (required)Product card image
urlstring (required)Product card url
comparePricestringProduct card compare at price
variantsVariant[]Product variants needed for
addToCartboolean (default=true)Enable / disable add to cart
onAddToCartonAddToCart?: (id: string) => voidOn
clicked
cartStatusCartStatuscart status to animate a cart submission
badgesBadgeProps[]A list of badges to display on the product card
currencyCurrencyProduct card currency
onClick((id: string, url: string) => voidOn product click (redirect on click happens automatically)
indexnumberProduct card position
scorenumberProduct card score
maxScorenumber (default=100)Product card max score
reviewCountnumberProduct card max reviews
swatchTypeSwatchType (default=SwatchType.Image)Product card swatch type
customClassesCustomClassesobject of custom classes for every inner component
redirectTypeRedirectTypesingle-page - will use
to url, multi page will redirect to url directly
descriptionstringproduct description
onSwatchClicked(variantID: string) => voidSwatch clicked callback
toFixnumberformat price .xx toFix()

Types

interface CustomClasses {
card?: string
info?: string
addToCart?: string

image?: string
imageWrapper?: string

title?: string
titleWrapper?: string

price?: string
compare?: string
priceWrapper?: string

swatch?: string
swatchWrapper?: string
swatchMore?: string

reviewCount?: string,
reviewWrapper?: string
reviewStar?: string

description?: string
}