Socket
Socket
Sign inDemoInstall

react-catalog-view

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-catalog-view

React component to render catalog view for products, services or any other E-commerce applications.


Version published
Weekly downloads
72
decreased by-32.08%
Maintainers
2
Weekly downloads
 
Created
Source

logo

Introduction

React component to render catalog view for products, services or any other E-commerce applications.

rcv-demo

Installation:

   npm install react-catalog-view

Features:

  • JSON data array: Accepts formatted JSON data array and renders them as cards in a catalog view.

  • Fully Customizable: Classes can be overridden easily to customize catalog view.

  • Responsive FlexBox: Based on CSS flexbox. Default view is responsive for all screens.

  • Card Sizes: Cards are available in small, medium and large size.

  • Custom Action Buttons: Two action buttons with custom css, button text & custom callbacks on click event.

  • Skeleton Loading: Show custom number of skeleton content cards while loading.

  • Lightweight: No additional dependencies or CSS Framework required.

Preview:

Responsive on small screens

rcv-demo-2

Skeleton loading

rcv-demo-3

With Custom CSS

rcv-demo-4

E-Commerce Example

rcv-demo-5

Example:

    import React from 'react';
    import Catalog from "react-catalog-view";
    
    function ProductData(props){
      let products = 
       [
         {
            id: 1,
            title: "Canvas",
            description: "High quality canvas shoes.",
            price: "20",
            discounted: "15",
            currency: "$",
            image: "http://domain.com/images/1.jpg",
         },
         {
            id: 2,
            title: "Sport shoes",
            description: "Sporty shoes, durable at affordable ranges.",
            price: "25",
            currency: "$",
            discounted: "15",
            image: "http://domain.com/images/5.jpg",
         },
         {
            id: 3,
            title: "Heels",
            description: "Fashionable trendy heels.",
            currency: "$",
            price: "30",
            image: "http://domain.com/images/6.jpg",
         }
      ];

      const CONTENT_KEYS = 
      {             
         imgKey: "image",
         cardTitleKey: "title",
         cardDescriptionKey: "description",
         priceKey: "price",
         discountedPriceKey: "discounted",
         priceCurrencyKey: "currency",
         discountCurrencyKey: "currency"
      };
	
      return(
        <Catalog
           data = {products}		
           // Array of JSON Objects (required)
           contentKeys={CONTENT_KEYS}  
           // JSON Object defining the keys that will be 
           // used from the data array, keys should match. (required)
           cardSize="sm"
           // Card sizes, sm, md and lg for small, medium  and large
           btnOneText="View"
           // Enter text for action button one 
           // or pass empty string to hide.  
           btnTwoText="Purchase Now"
           // Enter text for action button two 
           // or pass empty string to hide.
           btnOneHandler={(args, event, objectData)=>{
            // 'objectData' returns object data
            // any arguments passed will be before 'event' 
            // and 'objectData'
           }}
           btnTwoHandler={(args, event, row)=>{
            // 'objectData' returns object data
            // any arguments passed will be before 'event' 
            // and 'objectData'
           }}
           skeleton={0}
           // Any non zero number will override default cards
           // and will show that many skeleton cards.
        />
      )
  }

Props:

PropTypeDescription
dataArrayArray of JSON objects to be rendered (required)
contentKeysJSONJSON object which matches the keys in 'data' array (required)
{ 
imgKey: "image",
cardTitleKey: "title",
cardDescriptionKey: "description",
priceKey: "price",
discountedPriceKey: "discounted",
priceCurrencyKey: "currency",
discountCurrencyKey: "currency"
}
cardSizeStringCard sizes, sm, md and lg for small, medium and large
skeletonnumberAny non zero number will generate that many skeleton cards, skeleton cards over rides default view
btnOneTextStringEnter text for action button one or pass empty string to hide
btnTwoTextStringEnter text for action button two or pass empty string to hide
btnOneHandlercallbackCallback function for onClick
btnTwoHandlercallbackCallback function for onClick

CSS Classes:

Default CSS classes for easy css customization.

ClassNameDescription
rcv-container-customFor parent container
rcv-object-sm-custom
@media(max-width: 575px)
For container of small cards
rcv-object-md-custom
@media(max-width: 575px)
For container of medium cards
rcv-object-lg-custom
@media(max-width: 575px)
For container of large cards
rcv-catalog-card-customFor customizing card
rcv-product-image-container-customFor product image container
rcv-product-image-container-custom>imgFor product image
rcv-product-text-customFor product text
rcv-product-name-customFor product name
rcv-product-description-customFor product description
rcv-original-price-customFor original price text
rcv-discount-price-customFor discount price text
rcv-btn-one-customFor button one
rcv-btn-two-customFor button two

Support:

For support contact: adnanali17official@gmail.com, daniyal_09.2005@hotmail.com

Keywords

FAQs

Package last updated on 28 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc