jsc-modal-oc

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i jsc-modal-oc

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

8.34 kB

Total Files

7

Last publish

Collaborators

  • jowan-jsc