Skip to main content

Catalog

Description

The Catalog allows learners to search and browse for content.

✨🎨 View Component in Storybook 🎨✨

Installation

npm install @thoughtindustries/catalog

Props

Props for CatalogProvider Component

NameRequiredTypeDescription
configYesCatalogProviderConfigA config object that controls various aspects of the Catalog

Props for Catalog

NameRequiredTypeDescription
onAddedToQueueYesfuntionFunction that handles when the "Add to Queue" button is clicked
priceFormatNofunctionFunction that formats how the price is displayed

Examples

Example with Search Params and Custom Pagination

import { Catalog, CatalogProvider } from '@thoughtindustries/catalog';

const config = {
parsedUrl: {
pathname: '/catalog',
searchString: '?query=test'
}
}

<CatalogProvider config={config}>
<Catalog
onAddedToQueue={(item) => Promise.resolve()}
pagination={({page, pageSize, total, getPageLink}) => <>...</>} />
</CatalogProvider>

Example with a Custom Price Formatter

import { Catalog, CatalogProvider } from '@thoughtindustries/catalog';

const config = {
parsedUrl: {
pathname: '/catalog',
searchString: '?query=test'
}
}

const priceFormat = (priceInCents) => {
const formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
});
return formatter.format(priceInCents / 100);
}
<CatalogProvider config={config}>
<Catalog
onAddedToQueue={(item) => Promise.resolve()}
priceFormat={priceFormat} />
</CatalogProvider>