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

@bolttech/molecules-summary-card

v0.20.0

Published

The **SummaryCard** component is a React component that displays a summary card with product details, coverages, and a main action button.

Downloads

385

Readme

Summary Card Component

The SummaryCard component is a React component that displays a summary card with product details, coverages, and a main action button.

Installation

To use the SummaryCard component, you need to install the required dependencies:

npm install @bolttech/frontend-foundations @bolttech/molecules-summary-card

or

yarn add @bolttech/frontend-foundations @bolttech/molecules-summary-card

Usage

You can use the SummaryCard component by importing it and including it in your JSX. Here's an example:

import React from 'react';
import {SummaryCard} from '@bolttech/molecules-summary-card';
import {bolttechTheme, BolttechThemeProvider} from "@bolttech/frontend-foundations"; // Adjust the path to your component

const summaryCardDetails = [
  {
    detailsLabel: 'Plan Details 1',
    detailsActionLabel: 'Action',
    detailsActionClick: () => console.log('Action clicked for Plan Details 1'),
    coverages: [
      {name: 'Coverage 1', value: '$100'},
      // Add more coverages as needed
    ],
  },
  {
    detailsLabel: 'Plan Details 2',
    coverages: [
      {name: 'Coverage 1', value: '$200'},
      // Add more coverages as needed
    ],
  },
];

const summaryCardContent = {
  title: 'Summary',
  productImg: 'path_to_image.png',
  details: summaryCardDetails,
  totalValueLabel: 'Total Value:',
  totalValue: '$300',
  mainButtonLabel: 'Main Button',
  mainButtonClick: () => console.log('Main button clicked'),
  period: 'Monthly',
  legalText: 'Legal information',
  stickyDistance: '10px', // Optional
};

function App() {
  return (
    <BolttechThemeProvider theme={bolttechTheme}>
      {/* SummaryCard component */}
      <SummaryCard {...summaryCardContent} dataTestId="example"/>
    </BolttechThemeProvider>
  );
}

export default App;

Props

The SummaryCard component accepts the following props:

| Prop | Type | Description | | ------------------- | ------------- | ---------------------------------------------------- | | dataTestId | string | The data-testid attribute for testing purposes. | | title | string | The title to be displayed at the top of the card. | | productImg | string or | The image URL or JSX element for the product image. | | | ReactNode | | | details | array | An array of detail items to be displayed. | | totalValueLabel | string | The label for the total value section. | | totalValue | string | The total value to be displayed. | | mainButtonLabel | string | The label for the main action button. | | mainButtonClick | function | The function to be called when the main button is clicked. | | period | string | The period label to be displayed. | | legalText | string | The legal text to be displayed. | | stickyDistance | string | The stickyDistance adds the CSS property 'position: sticky' to an element and sets the top distance based on the provided value. |

Each details item should have the following structure:

{
  detailsLabel: 'Details Label',
  detailsActionLabel: 'Action Label', // Optional
  detailsActionClick: () => {},       // Optional
  coverages: [
    { name: 'Coverage 1', value: '$100' },
    // Add more coverages as needed
  ],
}

Functionality

The SummaryCard component provides the following functionality:

  • Display: Renders a summary card with product image, details, coverages, total value, main action button, period, and legal text.
  • Customizable Content: Allows you to customize the title, product image, detail items, coverages, total value, main action button label, period, and legal text.

Contribution

Contributions to the SummaryCard component are welcomed. If you encounter issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the component's Bitbucket repository.