1.0.5 • Published 2 years ago

@jnspk/reactmodal v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ReactModal

This repository is a modal component for React developpers.

Installation

npm i @jnspk/reactmodal

Parameters

You'll need to import useState from React and initialize state to false

import React, { useState } from 'react';
import Modal from '@jnspk/reactmodal';

const [isOpen, setIsOpen] = useState(false);

You can add a const to set css properties to the modal. There are some default values but you can overcharge them with overlayStyle, boxStyle, closeStyle, msgStyle. You can set the fade to true to allow modal to fade in or false if you don't want that behavior.: e.g.

const modalOptions = {
  message: 'You can write wathever you want here!',
  boxStyle: {
    boxShadow: '0px 10px 10px -3px rgba(0,0,0,0.1)',
  },
  overlayStyle: {
    backgroundColor: '#3D1663',
    display: 'flex',
    justifyContent: 'center',
    alignItems: 'center',
  },
  closeStyle: {
    borderRadius: '50%',
    boxShadow: '0px 10px 10px -3px rgba(0,0,0,0.1)',
  },
  msgStyle: {
    color: 'red',
  },
  fade: true,
};

then add the component to your project :

<button className='test-btn' onClick={() => setIsOpen(true)}>
  Open Modal
</button>;

{
  isOpen && (
    <Modal isOpen={isOpen} setIsOpen={setIsOpen} options={modalOptions} />
  );
}
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago