npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-single-product-page

v1.0.0

Published

A React component for displaying a single product page

Downloads

5

Readme

react-single-product-page

A fully customizable React component for rendering a detailed single product page with a clean, responsive design.

npm version License: MIT

Features

  • 📱 Responsive layout for all device sizes
  • 🖼️ Dynamic product image gallery
  • 🔢 Size and quantity selectors
  • 🛒 Add to Cart functionality
  • ❤️ Wishlist and share options
  • 📦 Expandable sections for product details, shipping info, and customer reviews
  • 🎨 Easily customizable with standard CSS (no Tailwind dependencies)

Installation

npm install react-single-product-page

Peer Dependencies

Ensure you have the following peer dependencies installed:

npm install react lucide-react

Quick Start

  1. Import the component and its styles:
import SingleProductPage from "react-single-product-page";
import "react-single-product-page/dist/styles.css";
  1. Use the component in your React application:
function App() {
  const product = {
    name: "Perfectly Imperfect Half Sleeve Unisex T-Shirt",
    price: 6.0,
    description:
      "Embrace your uniqueness with our Perfectly Imperfect t-shirt.",
    imageUrl: "/path/to/main-image.jpg",
    additionalImages: [
      "https://via.placeholder.com/100x100",
      "https://via.placeholder.com/100x100",
      "https://via.placeholder.com/100x100",
      "https://via.placeholder.com/100x100",
    ],
    rating: 4.5,
    reviewCount: 123,
    sizes: ["XS", "S", "M", "L", "XL"],
    colors: ["#000000", "#FFFFFF", "#008000", "#0000FF"],
    detailedDescription: "This t-shirt is made from 100% organic cotton...",
    features: [
      "100% organic cotton",
      "Unisex fit",
      "Available in multiple colors",
      "Machine washable",
    ],
    shippingInfo: "Free shipping on all orders over $50...",
    returnPolicy:
      "We offer a 30-day return policy for all unworn and unwashed items.",
    reviews: [
      {
        rating: 5,
        title: "Great shirt!",
        comment:
          "Fits perfectly and the material is so soft. Highly recommend!",
        author: "Jane D.",
        date: "2023-05-15",
      },
      // More reviews...
    ],
  };

  return (
    <div className="App">
      <SingleProductPage product={product} />
    </div>
  );
}

API Reference

Props

The SingleProductPage component accepts a single product prop with the following structure:

type Product = {
  name: string;
  price: number;
  description: string;
  imageUrl: string;
  additionalImages: string[];
  rating: number;
  reviewCount: number;
  sizes: string[];
  colors: string[];
  detailedDescription: string;
  features: string[];
  shippingInfo: string;
  returnPolicy: string;
  reviews: {
    rating: number;
    title: string;
    comment: string;
    author: string;
    date: string;
  }[];
};

Customization

To customize the component's appearance:

  1. Create a new CSS file (e.g., custom-product-page.css)
  2. Import it after the component's default styles:
import "react-single-product-page/dist/styles.css";
import "./custom-product-page.css";
  1. Override existing classes in your custom CSS file:
.product-title {
  font-size: 28px;
  color: #333;
}

.add-to-cart-button {
  background-color: #ff5722;
}

Development

To contribute or modify the package:

  1. Clone the repository:

    git clone https://github.com/waleedcodes/Single-Product-Page-Component.git
  2. Install dependencies:

    cd react-single-product-page
    npm install
  3. Make changes to src/SingleProductPage.js and src/styles.css

  4. Build the package:

    npm run build
  5. Test locally using npm link:

    npm link

    In your test project:

    npm link react-single-product-page

Contributing

We welcome contributions! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for details.