/cute-alert

Simple open source JavaScript library that aims to provide beautiful alerts and toasts to your website.

Primary LanguageTypeScriptMIT LicenseMIT

Cute Alert

NPM Version

Simple open source JavaScript library that aims to provide beautiful alerts and toasts to your website. Alerts inspired by Igor Ferrão de Souza's design.

Visit the documentation for more detailed instructions or Storybook if you want to play around / check out the library.

Table of Contents

  1. Getting Started
  2. TypeScript
  3. Contributing

Getting started

Installation

npm install cute-alert

Usage

Alerts

import { cuteAlert } from 'cute-alert'

cuteAlert({
  type: 'success',
  title: 'Title',
  description: 'Description',
  timer: 5000,
  primaryButtonText: 'Confirm',
  secondaryButtonText: 'Cancel'
})

Check out the documentation for more detailed instructions.

Toasts

import { cuteToast } from 'cute-alert'

cuteToast({
  type: 'success',
  title: 'Title',
  description: 'Description',
  timer: 5000
})

Check out the documentation for more detailed instructions.

TypeScript

Cute alert has built-in TypeScript support and provides a set of default exported types that you can import as named imports into your project like:

import type {
  AlertOptions,
  ToastOptions,
  AlertResolveValue,
  ToastResolveValue,
  AlertResolve,
  ToastResolve
} from 'cute-alert'

Contributing

Before pushing a PR, take into account the following checklist:

  • I have linked an issue or discussion.
  • I have added tests (if necessary).
  • I have updated the documentation accordingly (if necessary).
  • My commits are following the conventional commits specification.

Setting up the project

  1. Fork the repository and clone it.

  2. Install the dependencies on the repository:

    npm install
  3. Start storybook:

    npm run storybook

Unit tests

Running unit tests:

npm run test

Updating snapshots:

npm run test:update-snapshots

Coverage:

npm run coverage

Setting up the docs

Make sure you have the latest Ruby version installed.

  1. Open up your terminal and install the bundler gem on version 2.4.22:

    gem install bundler -v 2.4.22
  2. Go to the docs folder and install the dependencies:

    bundle install
  3. Run bundle exec jekyll serve to serve the docs locally.