@tryferos/popups
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Popup & Toast Handler and Layout Component

Install the package for npm here.

Source code on Github.

This is a react component delivering customizable Popups Layout that you can use in your projects, which also adds types support using Typescript.

You can create your own Popups and add them to the popup list.

VERSION 1.1 You can create your own Toasts and add them to the toasts list.

The project is build using React, Typescript and Tailwindcss. Tailwindcss is compiled into css, meaning you do not need it as a depedency.

All files are bundled into 3 seperate files for both cjs, esm and dts using the Rollup bundler. (commonjs, esmodules and declaration for ts types).

🎯 Features

  • ✅ Typescript support
  • FULLY Customizable to your needs
  • ✅ Create as many Popups.
  • ✅ Create as many Toasts.
  • ✅ Light/dark Mode.
  • ✅ Animations.

Install @tryferos/Popups using

  npm install @tryferos/Popups@1.0.3

Remember that you need to have react and react-dom already installed

  npm install react@^18.0.1 react-dom@^18.0.1

This package is build using react 18, you can use with different versions of react at your own risk.

  npm install @tryferos/Popups@1.0.3 --force

Import the components

{/*! Version 1.0*/}
import { PopupItem, PopupWrapper, PopupElement, usePopup } from "@tryferos/Popups";
{/*! Version 1.1*/}
import {ToastItem, PopupToastElement, useToast} from "@tryferos/Popups"

Usage

Wrap your Application in PopupWrapper.

{/*! Version 1.0*/}
const { popup, changePopup, title, closePopup} = usePopup();
{/*! Version 1.1*/}
const { toast, changeToast, title, closeToast} = useToast();
<PopupWrapper>
    {/*! Version 1.1*/}
    <PopupToastElement position={'top-center'} toasts={Object.values(myToastsEnum)}>
        <ToastItem toast={myToastsEnum.Error} element={<MyErrorToastComponent/>} />
        <ToastItem toast={myToastsEnum.Success} element={<MySuccessToastComponent/>} />
        ...
    </PopupToastElement>
    {/*! Version 1.0*/}
    <PopupElement popups={Object.values(MyPopupsEnum)}>
        <PopupItem popup={MyPopupsEnum.Login} element={<MyLoginPopupComponent/>}/>
        <PopupItem popup={MyPopupsEnum.Payment} element={<MyPaymentPopupComponent/>} />
        ...
    <PopupElement/>
    <App/> //Your Application's normal Components here
</PopupWrapper>

👨‍💻 Authors

Readme

Keywords

Package Sidebar

Install

npm i @tryferos/popups

Weekly Downloads

3

Version

1.1.0

License

ISC

Unpacked Size

262 kB

Total Files

6

Last publish

Collaborators

  • tryferos