3.1.0 • Published 2 years ago

react-nmp-modal v3.1.0

Weekly downloads
-
License
pavageau F
Repository
github
Last release
2 years ago

react-nmp-modal

validation message for form

NPM JavaScript Style Guide

Install

npm install --save react-nmp-modal

or

yarn add react-nmp-modal

Prerequisites

npm install
yarn add react react-dom
yarn add styled-components

Usage

import React, { useState } from 'react'
import Modal from 'react-nmp-modal'

const Form = () => {
  // write the logic for the display of the modal
  const [isShowing, setIsShowing] = useState(false)

  // write the function for close the modal
  const handleClickToClose = () => {
    setIsShowing(!isShowing)
  }

  // define the css in an object to customize the modal
  const myStylesModal = {
    modalContainerBg: 'rgba(0, 0, 0, 0.7)',
    bg: '#fff',
    width: '200px',
    height: '200px',
    radius: '5px',
    messageColor: '#000',
    messageFontSize: '1em',
    buttonColor: '#000',
    buttonBg: '#fff',
    buttonWidth: '30px',
    buttonHeight: '30px',
    buttonHoverColor: '#fff',
    buttonHoverBg: '#000'
  }

  /* then, add props in the modal component:
modalStyle = css style,
onClick = modal closing function,
messageText = the message to display */
  return (
    <>
      <form>.... </form>
      {isShowing ? (
        <>
          <Modal
            modalStyles={myStylesModal}
            onClick={handleClickToClose}
            messageText='Employee created !'
          />
        </>
      ) : null}
    </>
  )
}

License

pavageau F © pavageau f(https://github.com/pavageau f)

3.1.0

2 years ago

3.0.0

2 years ago

2.9.0

2 years ago

2.8.0

2 years ago

2.7.0

2 years ago

2.6.0

2 years ago

2.5.0

2 years ago

2.4.0

2 years ago

2.3.0

2 years ago

2.2.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.9.0

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.0.0

2 years ago