0.2.4 • Published 2 years ago

react-dialogue-component v0.2.4

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

react-dialogue-component

npm version coverage tests

A simple React component made with styled-components

Example gif

Table of Contents

Getting started

Installing

To install, you can use npm or yarn:

$ npm install --save react-dialogue-component
$ yarn add react-dialogue-component

Example

  import { useState } from "react";
  import { Dialogue } from "react-dialogue-component";
  
  export default function App() {
  const [dialogue, setDialogue] = useState(false);
  return (
    <div>
      <button
      onClick={() => setDialogue(!dialogue)}
      >
        active dialogue
      </button>
      <Dialogue
        isOpen={dialogue}
        onClose={() => setDialogue(false)}
        closeOnOverlayClick
        title="React Dialogue Demo"
        children="Dialogue example"
      />
    </div>
  );
}

Demo of this example

Docs

Props

NameTypeDefaultDescriptionRequired
titlestringThe title of the dialogue:x:
childrenReactNode, stringThe description text for the component to render:x:
isOpenbooleanfalseDefine if dialogue appear on screen:heavy_check_mark:
onClosefunction() => voidTriggerd when the user performs some modal closing action the default actions are called when user press Esc button or click in close button "X":heavy_check_mark:
closeOnOverlayClickbooleanfalseIf is true onClose is called when user click on dialogue overlay:heavy_check_mark:

Run Local

  1. Clone this repository.

     git clone git@github.com:UmberBn/react-dialogue-component.git
  2. Go to project folder.

    cd react-dialogue-component
3. Install the dependencies using yarn or npm

 ```bash
 yarn
 or
 npm install

Scripts

For execute a script you need to clone this repository and install the project dependencies See Local section

  • Run all tests

      "npm|yarn" test
  • Generate the coverage of tests

      "npm|yarn" run test:coverage
  • Open the coverage file (run after test:coverage)

    You need google chrome.

      "npm|yarn" run open:coverage
0.2.4

2 years ago

0.2.3

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.17

2 years ago

0.1.16

2 years ago

0.1.15

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago