1.0.30 • Published 1 year ago

modalia v1.0.30

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

Logo

Modalia

Modalia is a React library designed for displaying textual messages consisting of a title and a commentary. Multiple parameters are available for customizing the modal to suit your specific requirements.

Usage/Examples

Install Modalia as a dependency in your project using npm:

npm install modalia

Import the Modal library in the file where you want to use it:

import React from "react";
import Modalia from "modalia";

Utilize the Modal component within your React component, providing necessary props:

const YourComponent = () => {
  constructor() {
    super();
    this.state = {
      showingModal: false,
    };
  }

  closeModal = () => {
    this.setState({ showingModal: false });
  };

  componentDidMount() {
    window.addEventListener('modalClose', this.closeModal);
  };

  componentWillUnmount() {
    window.removeEventListener('modalClose', this.closeModal);
  };

  return (
    <div>
      {/* Your existing components */}
      <Modalia title="Example" commentary='👍 Great example.' position='center' backgroundColor="" titleColor="" commentaryColor="" show={this.state.showingModal} />
    </div>
  );
};

Customizing and parameters

The Modal component provides various props for customization:

  • show (boolean): Controls the visibility of the modal.
  • title (string): Specifies the title of the modal.
  • titleColor (string): Specifies color of title text.
  • commentary (string): Adds additional text or commentary to the modal.
  • commentaryColor (string): Specifies color of commentary text.
  • backgroundColor (string): Custom background color.
  • position (string): Defines the position of the modal.

position possibilities :

(Default set as center even with properties defined as null.)

  • center
  • top
  • bottom
  • corner-top-left
  • corner-top-right
  • corner-bottom-left
  • corner-bottom-right

Example :

<Modalia
  title="Example"
  commentary="👍 Great example."
  position="center"
  backgroundColor=""
  titleColor=""
  commentaryColor=""
  show={this.state.showingModal}
/>

Authors

License

MIT

1.0.30

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.6

2 years ago

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