Skip to content

Commit 818e7f9

Browse files
committed
update docs
1 parent 846bc96 commit 818e7f9

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

src/stories/components/CioPlp/Props.mdx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Groups from '../../../components/Groups';
88

99
<ArgTypes />
1010

11-
1211
## Formatters
1312

1413
Formatters will be used to modify how certain fields are rendered.
@@ -21,20 +20,26 @@ Formatters will be used to modify how certain fields are rendered.
2120

2221
Callbacks will be composed with the library's internal tracking calls for a given event.
2322

24-
| Property | Type | Description |
25-
| ------------------ | ------------------------------------------------------------------------------- | -------------------------------------- |
23+
| Property | Type | Description |
24+
| ------------------ | ------------------------------------------------------------------------------ | -------------------------------------- |
2625
| onAddToCart | `(event: React.MouseEvent, item: Item, selectedVariation?: Variation) => void` | Product add to cart callback function |
27-
| onProductCardClick | `(event: React.MouseEvent, item: Item) => void` | Product click callback function |
28-
| onSwatchClick | `(e: React.MouseEvent, clickedSwatch: SwatchItem) => void` | Product swatch click callback function |
29-
| onRedirect | `(url: string) => void` | Redirect callback function |
26+
| onProductCardClick | `(event: React.MouseEvent, item: Item) => void` | Product click callback function |
27+
| onSwatchClick | `(e: React.MouseEvent, clickedSwatch: SwatchItem) => void` | Product swatch click callback function |
28+
| onRedirect | `(url: string) => void` | Redirect callback function |
3029

3130
## ItemFieldGetters
3231

3332
ItemFieldGetters maps the fields sent in the catalog feeds to the fields the library expects for rendering.
3433

35-
| Property | Type | Description |
36-
| -------- | ------------------------ | ------------------ |
37-
| getPrice | `(item: Item) => number` | Get price function |
34+
| Property | Type | Description |
35+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
36+
| getPrice | `(item: Item \| Variation) => number` | Maps the price field from the API Response in `item.data`. Defaults to `item.data.price` |
37+
| getSalePrice | `(item: Item \| Variation) => number \| undefined` | Maps the sale price from the API Response in `item.data`. Defaults to `item.data.sale_price` |
38+
| getRolloverImage | `(item: Item \| Variation) => string \| undefined` | Maps the rollover/hover image URL field from the API Response in `item.data`. Defaults to `item.data.rolloverImage` |
39+
| getSwatchPreview | `(variation: Variation) => string` | Maps the swatch preview image URL from the API Response in `variations.data`. Defaults to `variation.data.swatchPreview` |
40+
| getSwatches | `(item: Item, retrievePrice, retrieveSwatchPreview, retrieveSalePrice, retrieveRolloverImage) => SwatchItem[] \| undefined` | Maps the swatches object from the API Response from `item.variations`. Builds a SwatchItem array by iterating through variations |
41+
| getIsHiddenGroupField | `(group: PlpItemGroup) => boolean \| undefined` | Maps a custom field in item_group.data to determine if a group should be hidden. Defaults to `group.data.cio_plp_hidden` |
42+
| getItemUrl | `(item: Item) => string \| undefined` | Maps the product URL from the API Response. Defaults to `item.url` |
3843

3944
## Configuration Options
4045

@@ -50,8 +55,8 @@ Configuration options for the Groups component behavior.
5055

5156
Configuration options for pagination functionality.
5257

53-
| Property | Type | Description |
54-
| -------------- | -------- | ---------------------------------------------------- |
58+
| Property | Type | Description |
59+
| -------------- | -------- | --------------------------------------------------- |
5560
| windowSize | `number` | Number of page buttons to show in pagination |
5661
| resultsPerPage | `number` | Override the results per page set at Provider level |
5762

@@ -67,13 +72,13 @@ Configuration options for filters functionality. No specific configurations avai
6772

6873
URL Helpers are used for managing the URL and request state. These functions define how this library modifies and parses the URL.
6974

70-
| Property | Type | Description |
71-
| --------------------- | ------------------------------------------------------------------------ | --------------------------------------------------------------- |
72-
| getUrl | `() => string \| undefined` | Get the current URL for a page (Default: getting current href) |
73-
| setUrl | `(newEncodedUrlState: string) => void` | Set the window href using the provided URL |
74-
| getStateFromUrl | `(urlString: string) => RequestConfigs` | Parses the given URL string to a request configuration state |
75-
| getUrlFromState | `(state: RequestConfigs, options: QueryParamEncodingOptions) => string` | Convert the request configuration state to a URL string |
76-
| defaultQueryStringMap | `DefaultQueryStringMap` | Provides a mapping for the query parameters that is used in URL |
75+
| Property | Type | Description |
76+
| --------------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------- |
77+
| getUrl | `() => string \| undefined` | Get the current URL for a page (Default: getting current href) |
78+
| setUrl | `(newEncodedUrlState: string) => void` | Set the window href using the provided URL |
79+
| getStateFromUrl | `(urlString: string) => RequestConfigs` | Parses the given URL string to a request configuration state |
80+
| getUrlFromState | `(state: RequestConfigs, options: QueryParamEncodingOptions) => string` | Convert the request configuration state to a URL string |
81+
| defaultQueryStringMap | `DefaultQueryStringMap` | Provides a mapping for the query parameters that is used in URL |
7782

7883
### getUrl
7984

@@ -222,4 +227,4 @@ const defaultQueryStringMap = Object.freeze({
222227
sortOrder: 'sortOrder',
223228
section: 'section',
224229
});
225-
230+
```

0 commit comments

Comments
 (0)