0.18.11 • Published 2 months ago

@bolttech/molecules-summary-card v0.18.11

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

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:

PropTypeDescription
dataTestIdstringThe data-testid attribute for testing purposes.
titlestringThe title to be displayed at the top of the card.
productImgstring orThe image URL or JSX element for the product image.
ReactNode
detailsarrayAn array of detail items to be displayed.
totalValueLabelstringThe label for the total value section.
totalValuestringThe total value to be displayed.
mainButtonLabelstringThe label for the main action button.
mainButtonClickfunctionThe function to be called when the main button is clicked.
periodstringThe period label to be displayed.
legalTextstringThe legal text to be displayed.
stickyDistancestringThe 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.

0.18.11

2 months ago

0.18.10

2 months ago

0.18.9

3 months ago

0.18.8

3 months ago

0.18.5

3 months ago

0.18.6

3 months ago

0.18.7

3 months ago

0.18.4

3 months ago

0.0.1

3 months ago

0.18.3

4 months ago

0.18.2

4 months ago

0.18.1

5 months ago

0.18.0

5 months ago

0.17.2

6 months ago

0.17.3

6 months ago

0.17.1

6 months ago

0.15.4

8 months ago

0.15.5

8 months ago

0.15.6

8 months ago

0.11.0

9 months ago

0.12.0

9 months ago

0.13.0

9 months ago

0.14.0

8 months ago

0.15.0

8 months ago

0.16.0

6 months ago

0.15.1

8 months ago

0.17.0

6 months ago

0.16.1

6 months ago

0.15.2

8 months ago

0.16.2

6 months ago

0.3.0

10 months ago

0.2.0

10 months ago

0.1.1

10 months ago

0.9.0

9 months ago

0.8.1

10 months ago

0.8.0

10 months ago

0.4.0

10 months ago

0.7.0

10 months ago

0.6.0

10 months ago

0.1.0

11 months ago