0.1.7 • Published 2 years ago

amandine_carreno_p14_modal_lib v0.1.7

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Modal_Plugin

Cursus OpenClassrooms: Project 14

This plugin is a part of the project 14 HrNet. You will me able to create easily a customizable Modal component.

Installation

 npm i amandine_carreno_p14_modal_lib 

Usage

This is an example for a simple usage of the Modal component. To show the Modal you have do use the propertie "isOpen" and set it to true and to remove the Modal you have to pass a callback to set "isOpen" at false. You can Embeded the node element of your choice as modal's content.

// import Component
import { Modal } from "amandine_carreno_p14_modal_lib"
// import style
import "amandine_carreno_p14_modal_lib/dist/index.css"

function App() {
    // constent that handles the state of the modal
    const [open, setOpen] = useState(false)
 return (
        <> 
            <button onClick={() => setOpen(true)}>Open</button>
            
            <Modal isOpen={open} 
            handleClose={() => setOpen(false)}
            customButtonShow={false}>            
            <p>Your Message</p>
            </Modal>
        </>
    )
}

Properties

NameTypeDefault.Description
isOpenbooltrueDisplay of the modal
defaultButtonShowbooltrueDisplay default button which only supports function to close the modal
customButtonShowbooltruedisplay customizable button
handleClosefunc--Function that handles closing events on under layer, cross icon and default closing button
handleCustomClickfunc--Function that handles event on custom button can be used as submit, cancel, etc..
childrennode--Modal main content
titlestring--Modal Modal header text content
defaultButtonLabelstring"Close"default button text label
customButtonLabelstring"OK"custom button text label
size"L", "M", "S"--Apply class to change dialog window's width
underlayerColorstring"rgba(83, 157, 131, 0.6)"Modal uderlayer color
underlayerWidthstring"100%"Width of under layer
underlayerHeightstring"100%"Height of under layer
dialogBackgroundColorstring"#FFFF"Modal dialog color
iconColorstring"rgba(83, 157, 131, 0.6)"Modal cross icon color
customButtonBackgroundColorstring--Customizable button background color
customButtonColorstring--Customizable button text color
customButtonMarginstring--Customizable button margin
customButtonTypestring"button"Customizable button type if "submit" propertie formId is needed
formIdstring--Required to link form in modal content and customizable button

Notes

this package use React and StoryBook. link to my project : https://github.com/carra1358/amandine_carreno_p14_02_05_2022

Author

Amandine Carreno

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago