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

confirmation-modal

v1.0.7

Published

A library of React components created using `create-react-app`.

Downloads

14

Readme

Modal-confirm

A library of React components created using create-react-app.

Introduction

The Modal Confirmation Component is a reusable React component that provides a flexible and customizable modal dialog for use in your web applications. This component is designed to allow you to easily create modal dialogs for various use cases, such as confirming user actions or displaying important information.

Installation

Run the following command:

npm install confirmation-modal

How to use

To import

import { ModalConfirmation }  from "confirmation-modal" ;

function ModalConfirm() {
  
    const handleCancelClick = () =>{
       alert('Cancel')
    }
    const handleConfirmClick = () =>{
       alert('Confirm')
    }
    return (        
            <ModalConfirmation title ='Modal Confirmation' handleCancelClick={handleCancelClick} handleConfirmClick={handleConfirmClick}/>        
    )
}

To personalize

To use the Modal Confirmation Component, you can import it into your React application and pass various props to customize its appearance and behavior.

Action Props

You can specify the actions to be taken when the buttons are clicked with the following props:

  • handleCancelClick: Defines the action when the "Cancel" button is clicked.
  • handleConfirmClick: Defines the action when the "Confirm" button is clicked.

Styling Props

The component provides a wide range of styling props to customize the modal, title, and buttons. Here are the available styling props:

For Modal

Modifiers

    fontFamily: fontFamily, // Specifies the font family for the element.
    fontSize: `${fontSize}px`, // Sets the font size for the element using the `fontSize` variable (in pixels) and adds "px" to the value.
    color: textColor, // Defines the text color for the element.
    backgroundColor: backgroundColor, // Sets the background color for the element.
    display: display, // Determines the display property for the element, controlling how it is rendered.
    padding: padding, // Specifies the padding for the element, creating space around the content inside.
    border: borderStyle, // Sets the border style for the element, defining its border characteristics.
    borderRadius: borderRadius, // Controls the border radius, determining the roundness of the element's corners.
    width: width, // Defines the width of the element.
    height: height, // Specifies the height of the element.
    margin: margin, // Sets the margin for the element, controlling the space around the outside.
    />   

For Title

Modifiers

     fontFamily: fontFamilyTitle, // Specifies the font family for the title.
    fontSize: `${fontSizeTitle}px`, // Sets the font size for the title using the `fontSizeTitle` variable (in pixels) and adds "px" to the value.
    color: textColorTitle, // Defines the text color for the title.        backgroundColor: backgroundColorTitle, // Sets the background color for the title.
    display: displayTitle, // Determines the display property for the title, controlling how it is rendered.
    padding: paddingTitle, // Specifies the padding for the title, creating space around the content inside.
    border: borderStyleTitle, // Sets the border style for the title, defining its border characteristics.
    borderRadius: borderRadiusTitle, // Controls the border radius for the title, determining the roundness of its corners.
    width: widthTitle, // Defines the width of the title.
    height: heightTitle, // Specifies the height of the title.
    margin: marginTitle, // Sets the margin for the title, controlling the space around the outside.
      

For Buttons

Modifiers

    fontFamily: fontFamilyButton, // Specifies the font family for the button.
    fontSize: `${fontSizeButton}px`, // Sets the font size for the button using the `fontSizeButton` variable (in pixels) and adds "px" to the value.
    color: textColorButton, // Defines the text color for the button.
    backgroundColor: backgroundColorButton, // Sets the background color for the button.
    padding: paddingButton, // Specifies the padding for the button, creating space around the content inside.
    border: borderStyleButton, // Sets the border style for the button, defining its border characteristics.
    borderRadius: borderRadiusButton, // Controls the border radius for the button, determining the roundness of its corners.
    width: widthButton, // Defines the width of the button.
    height: heightButton, // Specifies the height of the button.
    margin: marginButton, // Sets the margin for the button, controlling the space around the outside.
    transition: transitionButton, // Defines the transition property for the button, controlling how changes are animated.
          

Example :

   <ModalConfirmation 
      title='Modal Confirmation' 
      handleCancelClick={handleCancelClick} 
      handleConfirmClick={handleConfirmClick} 
      textColor='blue' 
      borderRadiusButton={10} 
      textColorTitle='purple' 
      backgroundColor='#F0F0F0' 
      padding='20px' 
      borderStyle='1px solid black' 
      borderRadius={15} 
      fontSize={30} 
      fontFamily='Arial, sans-serif' 
      fontSizeTitle={28}
      fontFamilyTitle='Times New Roman, serif' 
      backgroundColorTitle='#E0E0E0' 
      borderStyleTitle='1px solid gray' 
      borderRadiusTitle={5} 
      fontSizeButton={20} 
      fontFamilyButton='Verdana, sans-serif' 
      paddingButton='8px' 
      borderStyleButton='1px solid #FFA500' 
      widthButton='120px' 
      heightButton='40px'
      marginButton='0 10px' 
      margin='0 auto' 
    />    

Animation

For animations, simply modify the .modal__box__button:hover class in your css and add your code

Example :

.modal__box__button:hover {
    background-color: #C36244;
    color: #ECECEE;
    border: 2px solid black;
}