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

custom-modal_opc_sb_v1

v1.0.4

Published

install and edit a modal with props

Downloads

7

Readme

Install npm package

In the terminal of the folder containing node modules (not inside the folder node modules), use: npm i custom-modal_opc_sb_v1

Import the component

Inside the component's file needing to use the custom modal, add: import Modal from "custom-modal_opc_sb_v1";

Add openModal State, Setter and an opening condition

/add these state and setter, then, add the setter condition turning to "true" (true as string) when you want to activate the modal/ const [openedModal, setOpenedModal] = useState("false"); const closeModal = () => { setOpenedModal("false"); };

//exemple of opening condition

<button onClick={() => setOpenedModal("true")}>open modal</button>

Add the modal component

{//add this content to add the modal
    (openedModal === "true") && <Modal 
    backgroundColor="" borderRadius="" borderColor="" closingIconBackgroundColor="" 
    width="" height=""
    fontAwesomeIconClass=""  fontAwesomeClosingIconClass=""
    customImgSrc="" customImgClass="" customImgAlt="" 
    titleFontSize="" textFontSize="" 
    titleFont="" textFont="" 
    textLineHeight=""
    titleContent="title content"
    textContent="text content"
    titlePosition="" textPosition="" 
    overlay="" 
    modalHorizontalPosition="center"
    topSpace = "110%"
    timer = ""
    addBoxShadow = ""
    openedModalProp = {openedModal}
    onCloseModal= {closeModal}
/>}

Customize your Modal by changing the props value

backgroundColor = "" // add a color value (exemple: "#f2f2f2" or "grey")

borderRadius = "" // add a radius value (exemple: "5px" or "2%")

borderColor = "" // add a color value (exemple: "#f2f2f2" or "grey")

closingIconBackgroundColor = ""; // add a color value (exemple: "#f2f2f2" or "grey")

width = "" // add a width size (exemple: "200px")

height = "" // add a height size (exemple: "150px")

fontAwesomeIconClass = "" // add the fontAwesome icon class (exemple: "fa-sharp fa-light fa-magnifying-glass"). custom your icon in your css file using its class. Warning: you need a fontawesome package in your html file to make this customization working

fontAwesomeClosingIconClass = "" // add the fontAwesome icon class if you want to use an icon

customImgSrc = "" // add the img source if you want to use a picture

customImgClass ="" // add the img class, which will help you to customize it from your own css file

customImgAlt = "" // add the img alt in order to have a good accessibility

titleFontSize = "" // add a font-size (exemple: "2.17em" or "25px")

textFontSize = "" // add a font-size (exemple: "1.1em" or "20px")

titleContent = "" //add text content in the string (exemple: "title")

textContent = "" //add text content in the string (exemple: "text")

titleFont = "" //add the css rule in the string, after "font-family:" (exemple: "'Montserrat', sans-serif;"). Warning: you will also need to add the link to the police on your html file

textFont = "" //add the css rule in the string, after "font-family:" (exemple: "'Montserrat', sans-serif;"). Warning: you you will also need to add the link to the police on your html file

textLineHeight = "" // add a number (exemple: "2")

titlePosition = "" // add position of align-self (exemple: "right","center", "left")

textPosition = "" // add position of align-self (exemple: "right","center", "left")

modalHorizontalPosition = "" // add the modal horizontal position (exemple: "right","center", "left")

topSpace = "" // add the modal vertical position by customizing the top space (exemple: "50%")

overlay = "" // add "no" if you don't want an overlay

timer = "" // add the number of seconds you want the modal to appears (exemple: "3")

addBoxShadow = "" // add "yes" if you want a box shadow

don't modify openedModalProp and onCloseModal