Skip to main content

Interface: UseProductSliderReturn

Defined in: composables/react/useProductSlider.ts:62

State and slider actions returned by useProductSlider.

Properties

canScrollLeft

canScrollLeft: boolean

Defined in: composables/react/useProductSlider.ts:70

true when the slider can scroll further left.


canScrollRight

canScrollRight: boolean

Defined in: composables/react/useProductSlider.ts:72

true when the slider can scroll further right.


error

error: string | null

Defined in: composables/react/useProductSlider.ts:68

Last error message, or null.


fetchCrossupsells

fetchCrossupsells: (input) => Promise<void>

Defined in: composables/react/useProductSlider.ts:74

Fetches crossupsell products for a product/cluster and extracts their targets.

Parameters

input

FetchCrossupsellsInput

Returns

Promise<void>


fetchProducts

fetchProducts: (productIds, clusterIds?) => Promise<void>

Defined in: composables/react/useProductSlider.ts:76

Batch-fetches products/clusters by id.

Parameters

productIds

number[]

clusterIds?

number[]

Returns

Promise<void>


loading

loading: boolean

Defined in: composables/react/useProductSlider.ts:66

true while a fetch is in flight.


onScroll

onScroll: (containerEl) => void

Defined in: composables/react/useProductSlider.ts:82

Recomputes canScrollLeft / canScrollRight from the container's scroll position.

Parameters

containerEl

HTMLElement

Returns

void


products

products: (Product | Cluster)[]

Defined in: composables/react/useProductSlider.ts:64

The products/clusters currently shown in the slider.


scrollLeft

scrollLeft: (containerEl, itemWidth?) => void

Defined in: composables/react/useProductSlider.ts:78

Scrolls the container left by one item width (default 280px).

Parameters

containerEl

HTMLElement

itemWidth?

number

Returns

void


scrollRight

scrollRight: (containerEl, itemWidth?) => void

Defined in: composables/react/useProductSlider.ts:80

Scrolls the container right by one item width (default 280px).

Parameters

containerEl

HTMLElement

itemWidth?

number

Returns

void