as-watson-product-carousel
How to install this package
This package is NPM Private Package Registry On Gitlab
, so you need add token to your project first, just flow the step.
- Open your terminal and enter
echo @evan117:registry=https://gitlab.com/api/v4/packages/npm/ >> .npmrc
.
echo @evan117:registry=https://gitlab.com/api/v4/packages/npm/ >> .npmrc
- Open your project to find the
.npmrc
and open it. - Add
//gitlab.com/api/v4/packages/npm/:\_authToken=srgNyDi6kHsJfhrEbeJk
to second line and save the file.
//gitlab.com/api/v4/packages/npm/:\_authToken=srgNyDi6kHsJfhrEbeJk
- Enter
npm i @evan117/watson_product_carousel
at your terminal
npm i @evan117/watson_product_carousel
.npmrc will be:
@evan117:registry=https://gitlab.com/api/v4/packages/npm/
//gitlab.com/api/v4/packages/npm/:_authToken=srgNyDi6kHsJfhrEbeJk
How to use
If you want to add this component into your project, flow the step
Step 1 import the package
import ProductCarousel from '@evan117/watson_product_carousel';
Step 2 Set your productList type to match the following type
type ProductType = {
code: string;
name: string;
promotionFirstTag: string;
imagesUrl: string;
oldPrice: string;
markDownPrice: string;
averageRating: number;
productNumberOfReview: number;
stockLevelStatus: string;
};
type ProductListType = Array<ProductType>;
Step 3 Use the component way in code,and add the parameter 'products'
<ProductCarousel products={yourProductList} />