1.1.5 • Published 2 years ago

afournier-modal v1.1.5

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

afournier-modal

What is it ?

afournier-modal is a library created by Alexis Fournier for the project 14 of Open Classroom developer courses.

What's the purpose of this library ?

afournier-modal allows you to create and use some modals and custom it.

How to use it

import Modal from "afournier-modal"

const App = ():React.FunctionComponent => {
  const [isModalOpen, toggleModal] = useState(false);

  const closeModal = ():void => {
    toggleModal(false);
  }

  return (
    <main>
      <button onClick={toggleModal(true)}>Open</button>
      <Modal 
        isOpen={isModalOpen}
        handleClose={closeModal}
      >
        <h1>I'm a modal !</h1>
      </Modal>
    </main>
  )
}

Type

type Position = {
  vertical: "top" | "bottom";
  horizontal: "left" | "right";
}

Parameters

ParameterRequiredTypeDefault
isOpentruebooleanfalse
handleClosetrue() => voidundefined
backgroundOpacityfalsenumber0.6
closePositionfalsePositiontop-right
closeColorfalsestring#5D3FD3
childrenfalseReact.ReactChildundefined
1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago