2.0.7 • Published 3 years ago

gr-react-modal v2.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

gr-react-modal

Modal window pluggin for project 14 :

A simple react modal

  1. Installation
  2. Examples of use
  3. Default option

Installation

You can install gr-react-modal with npm: npm i gr-react-modal

For import rs-react-modal: import {Modal} from "gr-react-modal"

Examples of use

Example 1: by default

<Modal
    close = {close}
    open = {active}
/>

Alt text

Example 2: with close button only (showClose = true)

const customButton = {
    display: "none"
}

<Modal
    close = {close}
    escape = {false}
    open = {active}
    outside = {false}
    showClose = {true}
    styleButton = {customButton}
/>

Alt text

Example 3: customized

const customContent = {
    background: "#594B94",
    color: "#FFF",
    borderRadius: "0"
}

const customButton = {
    fontSize: "1rem",
    cursor: "pointer",
    fontWeight: "bold",
    background: "#F04329",
    borderColor: "#F04329",
    width: "12rem",
    padding: "1rem",
    borderRadius: ".3rem"
}

<Modal
    buttonContent = "Example button"
    close = {close}
    modalContent = "Example 3"
    open = {active}
    styleButton = {customButton}
    styleContent = {customContent}
/>

Alt text

Default option

Default content

Modal.defaultProps = {
  buttonContent: "Close", // To customize the button content
  escape: true, // To close the modal by pressing `ESC`
  fadeDelay: null, // Point during the overlay's fade-in that the modal begins to fade in (number between 0 and 1)
  fadeDuration: null, // Number of milliseconds the fade transition takes (null means no transition)
  modalContent: "React modal is open!", // To customize the modal content
  open: false, // To open the modal
  outside: true, // To close the modal by clicking the overlay
  showClose: false, // To activate button x
  styleButton: {}, // To customize button style
  styleButtonX: {}, // To customize button x style
  styleContainer: {}, // To customize overlay style
  styleContent: {} // To customize modal content style
}

Default type

Modal.propTypes = {
  buttonContent: PropTypes.string,
  close: PropTypes.func.isRequired, // REQUIRED - Action when closing
  escape: PropTypes.bool,
  fadeDelay: PropTypes.number,
  fadeDuration: PropTypes.number,
  modalContent: PropTypes.string,
  open: PropTypes.bool.isRequired, // REQUIRED - TRUE to open the modal
  outside: PropTypes.bool,
  showClose: PropTypes.bool,
  styleButton: PropTypes.object,
  styleButtonX: PropTypes.object,
  styleContainer: PropTypes.object,
  styleContent: PropTypes.object
}
2.0.7

3 years ago

2.0.6-npm

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago