npm.io
1.0.0 • Published 2 years ago

veb-modal

Licence
ISC
Version
1.0.0
Deps
5
Size
29 kB
Vulns
0
Weekly
0

##Description :

a modal pluggin for react

##Installation :

npm install --save veb-modal

##Usage :

The Modal component needs 5 props :

{text} : the text to display in the modal
{closeModal} : the function to close the modal (you have to add it closing function in your file)
{styleModalBody} : the style of the modal
{styleButton} : the style of the button
{styleText} : the style of the text

##Example :

import React, { useState } from 'react' import Modal from 'veb-modal' import 'react-modal-component-library/dist/index.css'

function Example () { const [modalVisible, setModalVisible] = useState(false);

const openModal = () => {
    setModalVisible(true);
};

const closeModal = () => {
    setModalVisible(false);
};

return (
  <div> 
    <button onClick={openModal}> Open Modal </button>
    {modalVisible && <Modal text="Employee Created !" closeModal={closeModal} />}
  </div>
)

}