0.1.9 • Published 9 months ago

simple-modal-library v0.1.9

Weekly downloads
-
License
-
Repository
github
Last release
9 months ago

simple-modal-libraryA library of React components created using create-react-app.

1/ InstallationRun the following command:

npm install simple-modal-library

2/ Import the component from the library :

import { Modal } from 'simple-modal-library' import React from 'react' import styles from "./style.module.css"

3/ Place this state hook (concerning the opening/closing of the modal) at the start of the function that uses the Modal component :

cconst [showModal, setShowModal] = useState(false)

4/ In the return of the function, call the Modal component :

{showModal && (<Modal className={styles["box-modal"]} message="Employee Created!" onClose={closeModal} /> )}

5/ Example :

import React, { useState } from 'react'
import { Modal } from '../components/Modal'

export default function Home() {
  const [isOpen, setIsOpen] = useState(false)
  const name = 'John Smith'

  return (
    <>
      <h1>Modal Test</h1>
      <button onClick={() => setIsOpen(true)}>Open Modal</button>
      {showModal && (
        <Modal className={styles["box-modal"]} message="Employee Created!" onClose={closeModal} />
      )}
    </>
  )
}

Prerequisites

npm

yarn

Node.js

Dependencies

GitHub package.json dependencies (dev)

GitHub package.json dependencies (dev)

GitHub package.json dependencies (dev)

DevDependencies

Prop-types

Prettier

Vite

0.1.9

9 months ago

0.1.7

9 months ago

0.1.6

9 months ago

0.1.5

9 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.9.1

2 years ago

0.9.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago