0.1.7 • Published 12 months ago

fv-modal-react v0.1.7

Weekly downloads
-
License
-
Repository
-
Last release
12 months ago

Customizable modal package : fv-modal-react

HTML5 js REACT STYLEDCOMPONENTS

Author size

Presentation

SNAPSHOT This is the repository of the modal package : fv-modal-react. View the composant Modal.jsx in src/components/Modals.jsx

Installing the package

1/ Install package :

npm i fv-modal-react

2/ Import the component from the library :

import { Modal } from 'fv-modal-react'

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

const [isOpen, setIsOpen] = useState(false)

4/ In the return of the function, call the Modal component with at least the setIsOpen and text props :

{isOpen && <Modal setIsOpen={setIsOpen} text={'Hello ' + name} />}

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>
      {isOpen && <Modal setIsOpen={setIsOpen} text={'Hello ' + name} />}
    </>
  )
}

6/ Customize the modal by adding props :

<Modal
  setIsOpen={setIsOpen}
  text={'Hello ' + name}
  // Custom the background of the modal
  modalBgColor={'midnightblue'}
  modalBorder={'3px solid white'}
  modalBorderRadius={'20px'}
  // Custom the closing cross
  crossCloseBg={'red'}
  crossCloseColor={'white'}
  crossCloseBorder={'3px solid white'}
  // Custom the font
  fontFamily={'Trebuchet MS'}
  fontSize={'20px'}
  fontWeight={'bold'}
  fontColor={'white'}
  textAlign={'center'}
/>

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.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.7

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.6

12 months ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago