@acctglobal/skuselector
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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

image

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request
  6. And don't forget to update the changelog

Contact

Paulo Ferraz - paulo.ferraz@acctglobal.com

Dependents (0)

Package Sidebar

Install

npm i @acctglobal/skuselector

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

21.4 kB

Total Files

21

Last publish

Collaborators

  • luiz.priolli
  • ricardo.freitas
  • fabioacct