1.0.0 • Published 1 year ago

@epatrice/hrnetmodalcomponent v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

hrnetvalidatemodal

This is a modal component for React written in TypeScript.

Installation

npm install @epatrice/hrnetmodalcomponent

Usage

import Modal from '@epatrice/hrnetmodalcomponent'

export default MyComponent() {

...
  <Modal>
    ...
  </Modal>
...
}

Required parameters

There are 3 required parameters:

  • isOpen : a boolean value to set if modal should be shown or not
  • onConfirm : a function that defines what happens when user clic on the "Confirm" button
  • onCancel : a function that defines what happens when user clic on the "Cancel" button (generaly should do nothing exept closing modal)
import { useState } from 'react';
import Modal from 'hrnetvalidatemodal'

export default MyComponent() {
  const [open, setOpen] = useState(false)
  const [content, useContent] = useState('')

...
  <Modal isOpen={true or false} onConfirm={() => {}} onCancel={() => {}}>
    {content}
  </Modal>
...
}

optional parameter

There is an optional parameter called title, a string that appears as a title for the modal

import { useState } from 'react';
import Modal from 'hrnetvalidatemodal'

export default MyComponent() {
  const [open, setOpen] = useState(false)
  const [content, useContent] = useState('')

...
  <Modal isOpen={open} onConfirm={() => {}} onCancel={() => {}} title="Do you want to confirm ?">
    ...
  </Modal>
...
}
1.0.0

1 year ago

0.9.0

1 year ago

0.8.0

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago