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

my-react-modal-ad62

v1.4.2

Published

Create a react-modal component that can be published to npm

Downloads

8

Readme

my-react-modal-ad62 - project OCR2022_P14_npm-module

A React modal component created using create-react-app (with Typescript).


Installation

Node version : 20.11.0 (see .nvmrc file)

Text editor: VSCode

Install with npm i my-react-modal-ad62

How to use

import : import { ModalComponent } from "my-react-modal-ad62"

Modal props type :

type ModalComponentProps = {
  showModal: boolean,
  setShowModal: React.Dispatch<React.SetStateAction<boolean>>,
  displayToggleButton?: boolean,
  toggleButtonText?: string,
  toggleButtonClass?: string,
  modalContainerClass?: string,
  children: React.ReactNode,
};

ModalComponentProps props description :

| Prop name | Type | Default value | Description | | ------------------- | :---------------------------: | :--------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | showModal | boolean | false | The boolean state passed in component props to display the modal | | setShowModal | React.SetStateAction | - | The setState action passed in component props to change the boolean state | | displayToggleButton | boolean | true | Display a toggle modal button or not | | toggleButtonText | string | 'Open modal' | Custom text displayed into the toggle modal button | | toggleButtonClass | string | 'toggle-modal-btn' | Custom css for the toggle modal button. Add a custom className will overwrite the default value. | | modalContainerClass | string | 'modal-container-base' | Custom css for the modal container. A default value is passed who sets : position: fixed; left: 50%; transform: translate(-50%, 0%); min-width: 280px; padding: 50px 20px 20px; z-index: 9999; | | children | React.ReactNode | - | Custom nodes to display into the modal (see exemple below) |

Exemple :

// set the state :
const [showModal, setShowModal] = React.useState(false);

// you can add you custom css classes for the modal via props (modalContainerClass and the toggleButtonClass).
// don't forget to pass the state props to the modal component :
<ModalComponent modalContainerClass='you-can-add-here your-custom-class' showModal={showModal} setShowModal={setShowModal}>
  <h1 className='text-3xl font-bold'>Your title</h1>
  <p className='m-0 p-0 leading-relaxed'>
    Lorem ipsum, dolor sit amet consectetur adipisicing elit. Rem perferendis quia fugiat dolor magnam. Sunt recusandae odit ut maiores enim nemo
    assumenda, laudantium iste non eum? Quibusdam accusamus necessitatibus voluptatibus! Distinctio dolore necessitatibus sapiente, consequatur sint
    dignissimos voluptates rem excepturi aliquid obcaecati quo pariatur sequi accusamus illum dolorum voluptatum accusantium ipsa alias consequuntur
    dolorem fuga eos beatae saepe. Dolor, doloribus? Numquam officiis error doloribus harum eius! Architecto magni aliquam, nihil repellendus
    veritatis excepturi eius explicabo molestias a, ad hic. Voluptate necessitatibus debitis minima et assumenda, architecto iusto ut soluta ullam.
  </p>
</ModalComponent>;