@jmconcha/shopping-cart
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

Shopping Cart Mini App

Shopping Cart Mini-app.

repository

Mini App

  • Shopping Cart - status

Installation

npm install @jmconcha/shopping-cart

 

ShoppingCart Props

Prop default value Type Description
cartItems [] CartItem List of cart items
disableIncrementButton false boolean disables the button that increment the cart item quantity

 

CartItem Data Model

Prop default value Type Description
id string Product unique id
name string Product name
price number Product price
quantity number Product quantity in cart
imageUrl string Product 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"

Readme

Keywords

Package Sidebar

Install

npm i @jmconcha/shopping-cart

Weekly Downloads

0

Version

1.0.8

License

ISC

Unpacked Size

670 kB

Total Files

49

Last publish

Collaborators

  • jmconcha