ael-modal
v1.1.2
Published
Un package pour ouvrir et fermer une modal en React.
Downloads
42
Readme
About The Project
HRNet project which aims to be able to add new employees to a sortable table.
Built With
Getting Started
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Prerequisites
This is an example of how to list things you need to use the software and how to install them.
- npm
npm install npm@latest -g
Installation
Below is an example of how you can instruct your audience on installing and setting up your app. This template doesn't rely on any external dependencies or services.
- install
npm install ael-modal
- Install packages
npm install sass
Example
import React, { useState } from "react"; // Assurez-vous d'importer React également
import Modal from "ael-modal";
const Example = () => {
const [modalIsDisplayed, setModalIsDisplayed] = useState(false);
const handleSubmit = e => {
e.preventDefault();
setModalIsDisplayed(true);
};
const onCloseModal = () => {
setModalIsDisplayed(false);
};
return (
<section className="container">
<h1 className="title">Modal Exemple</h1>
<form onSubmit={handleSubmit}>
<button type="submit">Click me</button>
</form>
<Modal
isDisplayed={modalIsDisplayed}
onCloseModal={onCloseModal}
content={
<div className="modal">
<p>Message de la modal</p>
{/* <div onClick={onCloseModal} className="custom-modal-btn-close">
Fermer
</div> */}
</div>
}
/>
</section>
);
};
export default Example;
License
Distributed under the MIT License. See LICENSE.txt
for more information.
LINK
Project Link: [https://www.npmjs.com/package/ael-modal)