1.0.8 • Published 2 years ago

@jmconcha/shopping-cart v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Shopping Cart Mini App

Shopping Cart Mini-app.

repository

Mini App

  • Shopping Cart - status

Installation

npm install @jmconcha/shopping-cart

 

ShoppingCart Props

Propdefault valueTypeDescription
cartItems[]CartItemList of cart items
disableIncrementButtonfalsebooleandisables the button that increment the cart item quantity

 

CartItem Data Model

Propdefault valueTypeDescription
idstringProduct unique id
namestringProduct name
pricenumberProduct price
quantitynumberProduct quantity in cart
imageUrlstringProduct image link

 

Empty Cart Example

import React from 'react';
import { ShoppingCart } from '@jmconcha/shopping-cart';

function Example() {
  return <ShoppingCart />;
}

export default Example;

Empty Cart Example

 

With Cart Items Example

import React from 'react';
import { ShoppingCart } from '@jmconcha/shopping-cart';

function Example() {
  const cartItems = [
    {
      id: 'id-1',
      name: 'Product 1',
      price: 100,
      quantity: 1,
      imageUrl: 'https://via.placeholder.com/150/24f355',
    },
    {
      id: 'id-2',
      name: 'Product 2',
      price: 200,
      quantity: 2,
      imageUrl: 'https://via.placeholder.com/150/24f355',
    },
    {
      id: 'id-3',
      name: 'Product 3',
      price: 300,
      quantity: 3,
      imageUrl: 'https://via.placeholder.com/150/24f355',
    },
  ];

  return <ShoppingCart cartItems={cartItems} />;
}

export default Example;

With Cart Items Example

 

Disabled Increment Button Example

import React from 'react';
import { ShoppingCart } from '@jmconcha/shopping-cart';

function Example() {
  const cartItems = [
    {
      id: 'id-1',
      name: 'Product 1',
      price: 100,
      quantity: 1,
      imageUrl: 'https://via.placeholder.com/150/24f355',
    },
  ];

  return <ShoppingCart cartItems={cartItems} disableIncrementButton />;
}

export default Example;

Disabled Increment Button Example

 

Peer Dependecies

"react": "^18.2.0",
"react-dom": "^18.2.0"
1.0.8

2 years ago

1.0.7

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago