@acctglobal/skuselector
v0.1.2
Published
<!-- ABOUT THE PROJECT -->
Downloads
4
Keywords
Readme
Sku Selector
About The Component
The SkuSelector component is mainly used in Product Details Pages (PDPs) to display all the SKUs available for a given product...
Getting Started
This component can be used anywhere you want in ecommerce, in a responsive and agnostic way, just passing the skus list and the sku selection function
Installation
To use Sku Selector install the package via yarn or npm and import it wherever you want to use it.
- Install package
yarn add @acctglobal/skuselector or npm install
Usage
Import component
import SkuSelector from '@acctglobal/skuselector';
Call component passing skus list and sku select function
export const mockItems = [
{
id: 1,
label: 'XS',
value: 'XS',
disabled: false,
},
{
id: 2,
label: 'S',
value: 'S',
disabled: true,
},
{
id: 3,
label: 'M',
value: 'M',
disabled: false,
},
];
const selectSku = (sku?: string) => {
console.log('Select sku: ', sku);
};
<SkuSelector items={mockItems} selectSku={selectSku} />;
Props
| Parameter | Type | Description |
| :---------- | :------------- | :-------------------------------------------------- |
| items
| Array(items)
| Mandatory. List of skus items
to be displayed |
| selectSku
| Function
| Mandatory. onClick function to the button |
Styling
There are one way to customize the component
By data styles
[data-sf-sku-selector-container] {
width: 100%;
display: flex;
position: relative;
justify-content: space-around;
}
| Data for styles |
| :--------------------------------------- |
| [data-sf-sku-selector-container]
|
| [data-sf-sku-selector-option]
|
| [data-sf-sku-selector-option]:disabled
|
| [data-sf-sku-selector-option-active]
|
Contributing
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- And don't forget to update the changelog
Contact
Paulo Ferraz - [email protected]