-
Notifications
You must be signed in to change notification settings - Fork 0
APIDOCS 2573: Docs improvements for Collection #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
daniellekorn
wants to merge
17
commits into
main
Choose a base branch
from
APIDOCS-2573-collection-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
46a50f1
initial improvements
daniellekorn 8f822ed
docs improvements
daniellekorn 5bda48a
refine description of collection
daniellekorn dc7d840
minor edits
daniellekorn 4f52757
add note
daniellekorn 246a64c
reword
daniellekorn ba5e6ec
remove details about store collections
daniellekorn ecfef37
add examples
daniellekorn 2cd9b3d
standard dev preview note
daniellekorn de72cc6
add standard line about what a headless component is
daniellekorn 0218407
docs for category list comp
daniellekorn 8fe3a27
add proper spacing for dev preview alert
daniellekorn 9a44616
update note to notes
daniellekorn 0def6d4
docs for filtered collection
daniellekorn 4db35bf
edits to desc with mention of render props
daniellekorn e68640e
updates to product desc
daniellekorn b4eea0c
remove examples
daniellekorn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,34 +7,48 @@ import { | |
} from "@wix/auto_sdk_stores_products-v-3"; | ||
|
||
/** | ||
* Props for Grid headless component | ||
* Props for the Grid headless component. | ||
*/ | ||
export interface GridProps { | ||
/** Render prop function that receives product grid data */ | ||
children: (props: GridRenderProps) => React.ReactNode; | ||
/** Function that receives product grid data and loading states. Use this function to render your custom UI components with the provided data. */ | ||
children: (props: GridRenderProps) => JSX.Element; | ||
} | ||
|
||
/** | ||
* Render props for Grid component | ||
* Render props for the Grid component. | ||
*/ | ||
export interface GridRenderProps { | ||
/** Array of products */ | ||
/** Array of products. Learn about [managing products and categories](https://support.wix.com/en/managing-products-and-categories). */ | ||
products: V3Product[]; | ||
/** Whether products are loading */ | ||
/** Whether the collection data is loading. */ | ||
isLoading: boolean; | ||
/** Error message if any */ | ||
/** Error message if loading fails. */ | ||
error: string | null; | ||
/** Whether there are no products */ | ||
/** Whether the collection is empty. */ | ||
isEmpty: boolean; | ||
/** Total number of products */ | ||
/** Total number of products in the collection. */ | ||
totalProducts: number; | ||
/** Whether collection has products */ | ||
/** Whether the collection contains any products. */ | ||
hasProducts: boolean; | ||
} | ||
|
||
/** | ||
* Headless component for product grid | ||
* <blockquote class="caution"> | ||
* | ||
* **Developer Preview** | ||
* | ||
* This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period. | ||
* | ||
* </blockquote> | ||
* | ||
* A headless component for displaying products in a grid layout. | ||
* Handles product collection display with loading states and error handling. | ||
* | ||
* > **Notes:** | ||
* > * This component is only relevant for [Wix Vibe](https://support.wix.com/en/article/wix-vibe-an-overview) and [Wix Headless](https://dev.wix.com/docs/go-headless/get-started/about-headless/about-wix-headless) developers. | ||
* > * Headless components use the render props pattern. They provide ready-to-use business logic and state management, while giving you complete control over the UI, so you can build custom experiences faster without maintaining the underlying logic yourself. | ||
* | ||
|
||
* @component | ||
*/ | ||
export const Grid = (props: GridProps) => { | ||
|
@@ -85,42 +99,56 @@ export const Grid = (props: GridProps) => { | |
}; | ||
|
||
/** | ||
* Props for Item headless component | ||
* Props for the Item headless component. | ||
*/ | ||
export interface ItemProps { | ||
/** Product data */ | ||
/** Product data with all available variants and options. */ | ||
product: V3Product; | ||
/** Render prop function that receives product item data */ | ||
/** Function that receives product item data. Use this function to render your custom UI components with the provided product information. */ | ||
children: (props: ItemRenderProps) => React.ReactNode; | ||
} | ||
|
||
/** | ||
* Render props for Item component | ||
* Render props for the Item component. | ||
*/ | ||
export interface ItemRenderProps { | ||
/** Product ID */ | ||
/** Product ID. */ | ||
id: string; | ||
/** Product title */ | ||
/** Display name of the product. */ | ||
title: string; | ||
/** Product slug for URL */ | ||
/** URL-friendly product identifier used in product page URLs. */ | ||
slug: string; | ||
/** Main product image URL */ | ||
/** Main product image URL. */ | ||
image: string | null; | ||
/** Product price */ | ||
/** Formatted product price that reflects the variant pricing. */ | ||
price: string; | ||
/** Compare at price (for strikethrough) */ | ||
/** Original price for comparison. Indicates a discount when available. */ | ||
compareAtPrice: string | null; | ||
/** Product description */ | ||
/** Product description. */ | ||
description: string; | ||
/** Whether product is available */ | ||
/** Whether the product is available for purchase based on inventory status. */ | ||
available: boolean; | ||
/** Product URL */ | ||
/** Direct link to the product page. */ | ||
href: string; | ||
} | ||
|
||
/** | ||
* Headless component for individual product item | ||
* <blockquote class="caution"> | ||
* | ||
* **Developer Preview** | ||
* | ||
* This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period. | ||
* | ||
* </blockquote> | ||
* | ||
* A headless component for displaying individual product items. | ||
* Provides structured product details including pricing, availability, images, and navigation links. | ||
* | ||
* > **Notes:** | ||
* > * This component is only relevant for [Wix Vibe](https://support.wix.com/en/article/wix-vibe-an-overview) and [Wix Headless](https://dev.wix.com/docs/go-headless/get-started/about-headless/about-wix-headless) developers. | ||
* > * Headless components use the render props pattern. They provide business logic and state management, while giving you full control over the UI so you can build custom experiences faster. | ||
* | ||
|
||
* @component | ||
*/ | ||
export const Item = (props: ItemProps) => { | ||
|
@@ -159,35 +187,48 @@ export const Item = (props: ItemProps) => { | |
}; | ||
|
||
/** | ||
* Props for LoadMore headless component | ||
* Props for the LoadMore headless component. | ||
*/ | ||
export interface LoadMoreProps { | ||
/** Render prop function that receives load more data */ | ||
/** Function that receives pagination and loading state data. Use this function to render your custom loading and pagination UI components. */ | ||
children: (props: LoadMoreRenderProps) => React.ReactNode; | ||
} | ||
|
||
/** | ||
* Render props for LoadMore component | ||
* Render props for the LoadMore component. | ||
*/ | ||
export interface LoadMoreRenderProps { | ||
/** Function to load more products */ | ||
/** Function to load additional products. */ | ||
loadMore: () => Promise<void>; | ||
/** Function to refresh products */ | ||
/** Function to refresh the collection data. */ | ||
refresh: () => Promise<void>; | ||
/** Whether load more is currently loading */ | ||
/** Whether additional products are loading. */ | ||
isLoading: boolean; | ||
/** Whether there are products */ | ||
/** Whether the collection contains any products. */ | ||
hasProducts: boolean; | ||
/** Total number of products currently loaded */ | ||
/** Total number of products in the collection. */ | ||
totalProducts: number; | ||
/** Whether there are more products to load */ | ||
/** Whether there are more products available to load. */ | ||
hasMoreProducts: boolean; | ||
} | ||
|
||
/** | ||
* Headless component for load more products functionality | ||
* Note: V3 API uses simplified loading without traditional pagination | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this note here? |
||
* <blockquote class="caution"> | ||
* | ||
* **Developer Preview** | ||
* | ||
* This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period. | ||
* | ||
* </blockquote> | ||
* | ||
* A headless component that enables progressive loading of products. | ||
* Loads additional products without traditional pagination for infinite scroll functionality. | ||
* | ||
* > **Notes:** | ||
* > * This component is only relevant for [Wix Vibe](https://support.wix.com/en/article/wix-vibe-an-overview) and [Wix Headless](https://dev.wix.com/docs/go-headless/get-started/about-headless/about-wix-headless) developers. | ||
* > * Headless components use the render props pattern. They provide business logic and state management, while giving you full control over the UI so you can build custom experiences faster. | ||
* | ||
|
||
* @component | ||
*/ | ||
export const LoadMore = (props: LoadMoreProps) => { | ||
|
@@ -236,28 +277,42 @@ export const LoadMore = (props: LoadMoreProps) => { | |
}; | ||
|
||
/** | ||
* Props for Header headless component | ||
* Props for the Header headless component. | ||
*/ | ||
export interface HeaderProps { | ||
/** Render prop function that receives collection header data */ | ||
/** Function that receives collection metadata such as product count and loading state. Use this function to render your custom header UI components. */ | ||
children: (props: HeaderRenderProps) => React.ReactNode; | ||
} | ||
|
||
/** | ||
* Render props for Header component | ||
* Render props for the Header component. | ||
*/ | ||
export interface HeaderRenderProps { | ||
/** Total number of products */ | ||
/** Total number of products in the collection. */ | ||
totalProducts: number; | ||
/** Whether collection is loading */ | ||
/** Whether the collection data is loading. */ | ||
isLoading: boolean; | ||
/** Whether collection has products */ | ||
/** Whether the collection contains any products. */ | ||
hasProducts: boolean; | ||
} | ||
|
||
/** | ||
* Headless component for collection header with product count | ||
* <blockquote class="caution"> | ||
* | ||
* **Developer Preview** | ||
* | ||
* This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period. | ||
* | ||
* </blockquote> | ||
* | ||
* A headless component for displaying collection metadata. | ||
* Provides product count and loading state information for use in collection headers. | ||
* | ||
* > **Notes:** | ||
* > * This component is only relevant for [Wix Vibe](https://support.wix.com/en/article/wix-vibe-an-overview) and [Wix Headless](https://dev.wix.com/docs/go-headless/get-started/about-headless/about-wix-headless) developers. | ||
* > * Headless components use the render props pattern. They provide business logic and state management, while giving you full control over the UI so you can build custom experiences faster. | ||
* | ||
|
||
* @component | ||
*/ | ||
export const Header = (props: HeaderProps) => { | ||
|
@@ -296,31 +351,44 @@ export const Header = (props: HeaderProps) => { | |
}; | ||
|
||
/** | ||
* Props for Actions headless component | ||
* Props for the Actions headless component. | ||
*/ | ||
export interface ActionsProps { | ||
/** Render prop function that receives collection actions data */ | ||
/** Function that receives collection action controls and state. Use this function to render your custom action UI components. */ | ||
children: (props: ActionsRenderProps) => React.ReactNode; | ||
} | ||
|
||
/** | ||
* Render props for Actions component | ||
* Render props for the Actions component. | ||
*/ | ||
export interface ActionsRenderProps { | ||
/** Function to refresh the collection */ | ||
/** Function to refresh the collection data. */ | ||
refresh: () => Promise<void>; | ||
/** Function to load more products */ | ||
/** Function to load additional products. */ | ||
loadMore: () => Promise<void>; | ||
/** Whether actions are loading */ | ||
/** Whether an action is loading. */ | ||
isLoading: boolean; | ||
/** Error message if any */ | ||
/** Error message if an action fails. */ | ||
error: string | null; | ||
} | ||
|
||
/** | ||
* Headless component for collection actions (refresh, load more) | ||
* Replaces traditional pagination for V3 API | ||
* <blockquote class="caution"> | ||
* | ||
* **Developer Preview** | ||
* | ||
* This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period. | ||
* | ||
* </blockquote> | ||
* | ||
* A headless component that provides collection action controls. | ||
* Manages refresh and load more functionality, and replaces the need for traditional pagination. | ||
* | ||
* > **Notes:** | ||
* > * This component is only relevant for [Wix Vibe](https://support.wix.com/en/article/wix-vibe-an-overview) and [Wix Headless](https://dev.wix.com/docs/go-headless/get-started/about-headless/about-wix-headless) developers. | ||
* > * Headless components use the render props pattern. They provide business logic and state management, while giving you full control over the UI so you can build custom experiences faster. | ||
* | ||
|
||
* @component | ||
*/ | ||
export const Actions = (props: ActionsProps) => { | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this actually work? With the standard API getCollection(), a user needs to provide an ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh I think that this “Collection” is just a group of items displayed in a grid.
I thought that it was like in Wix Stores, where a “Collection” refers to themed groups of products that store owners create to organize their catalog.
I think there is a naming concern here.