1.0.8 • Published 1 year ago

modal-custom-jb v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

modal-custom-jb

modal custom for student project

NPM JavaScript Style Guide

Install

npm install --save modal-custom-jb

Modal props

NameDescription
openClosea boolean value to initialize the modal to a closed, non-apparent state
onClickfonction à inclure pour ouvrir ou fermer le modal avec le boutton de la modal
messagea message string to display in the modal
colora css color type string customizing the text color of the modal example: "#ffffff" if not filled in by default the color is: #000000
animationTypea string containing the modal's opening animation option, see options below
borderColora string containing the edge color option of the modal, see options below

Modal options

Props nameOptionsDescription
colordefaultthe modal will not have a border
successthe modal will have green borders
alertthe modal will have red borders
bluethe modal will have blue borders
Props nameOptionsDescription
animationTypeupthe modal will appear when descending
dowmthe modal will appear ascending
leftthe modal will appear coming from the left of the screen
rightthe modal will appear coming from the right of the screen

Usage

import React, {useState} from 'react'

import { ModalCustom } from 'modal-custom-jb'

const App = () => {
  // function to display the modal in the example
  const clickButton = () => {
    setIsOpen(true)
  }
  // state for example action display message
  const [displayMessage, setDisplayMessage] = useState(false)
  
  // modal display state needed
  const [isOpen, setIsOpen] = useState(false)

  const modalIsClose = () => {
    setIsOpen(false)
    // example of action performed after closing the modal
    setDisplayMessage(true)
    setTimeout(() => {
      setDisplayMessage(false)
    }, "1000")
  }

  return (
    <>
      <button className='btnForExample' onClick={clickButton}>click to open modal</button>
      {displayMessage && <p className='messageExample'>Hello World !</p>}
      <ModalCustom 
        openModal={isOpen}
        closeModal= {modalIsClose}
        message="Création du nouvel employé réussi !" 
        messageColor="#000000"
        animation="right" 
        border="blue" 
      />
    </>
  )
}

export default App

License

MIT © jb-webdev

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago