1.0.1 • Published 2 years ago

jsc-modal-oc v1.0.1

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

jsc-modal-oc

Modal dialog package created for the 14th project of the OpenClassrooms' frontend development program

NPM JavaScript Style Guide

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

1.0.1

2 years ago

1.0.0

2 years ago