jsc-modal-oc
v1.0.1
Published
Modal dialog package created for the 14th project of the OpenClassrooms' frontend development program
Downloads
1
Maintainers
Readme
jsc-modal-oc
Modal dialog package created for the 14th project of the OpenClassrooms' frontend development program
Install
npm install --save jsc-modal-oc
Usage
import React, { useState } from 'react'
import ModalDialog from 'jsc-modal-oc'
import 'jsc-modal-oc/dist/index.css'
const App = () => {
const [openModal, setOpenModal] = useState(false)
const onOpenModal = () => setOpenModal(true)
const onCloseModal = () => setOpenModal(false)
const handleClickOpen = () => {
onOpenModal()
}
return (
<>
<button type='button' onClick={handleClickOpen}>
Click to open the dialog modal
</button>
{openModal && (
<ModalDialog
title='Title of the modal'
description='Description of the modal'
closeContent='Close'
handleCloseModal={onCloseModal}
/>
)}
</>
)
}
export default App
License
MIT © JohanSannier