npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

customizable-toast

v1.1.4

Published

This library allows you to create toasts with custom styles. No need in downloading css files to make it work. Just style it, as you want.

Downloads

2

Readme

Customizable toasts for everyone!

This library allows you to create toasts with custom styles. No need in downloading css files to make it work. Just style it, as you want.

Данная библиотека позволяет вам создавать уведомления с сщбственными стилями. Вам не нужно дополнительно скачивать css файлы, чтобы все работало. Просто стилизуйте уведомления, как вам нужно

Usage

First of all you need to download it via npm/yarn:

Первым делом Вам необходимо скачать библиотеку с помощью npm или yarn

npm install custoast or yarn add custoast

import it in your project (you can call it as you wish, not only custoast):

Импортируйте объект в свой проект(Вы можете использовать другое имя, не только custoast):

import custoast from 'custoast;'

and use it:

И используйте:

custoast.success('Hey, it's working!');
custoast.error('But you did something wrong. Again!');
custoast.warning('Be careful next time!');
custoast.notification('Nice weather today, btw)');

Styling

The most important part is adding styles to toasts. Every toast have two base classes: toast and toast-{success/warning/error/notification} depends on the type of the toast. Add common styles for every type of toast in the 'toast' class:

Самая важная часть - добавление собственных стилей для уведомлений. Каждое уведомление имеет два основных класса toast и toast-{success/warning/error/notification}, название которого зависит от типа уведомления. Добавьте общие стили для всех типов уведомлений в класс 'toast':

.toast{
    padding: 10px;
    font-family: monospace;
	font-weight: 600;
    border-radius: 10px;
    margin-bottom: 14px;
    transition: 0.3s;
    overflow: hidden;
    box-shadow: 0 5px 20px 2px rgba(0,0,0,.15);
}

Don't forget to add transition parametr. It depends on how long the toast removal animation takes. Now style every type of toast like in the example below:

Не забудьте добавить параметр transition. От него зависит, как долго будет происходить анимация удаления уведомления. Теперь стилизуйте каждый тип уведомления, как показано в примере ниже:

.toast-success {
  background: #aaff00;
  color: rgba(0, 0, 0, 0.6);
}

Also you can add custom appearance animation. Just create keyframes animation and add it to the toast or toast-{toast type name} class:

Также вы можете добавить собственную анимацию появления уведомления. Просто создайте keyframes анимацию и добавьте ее в класс toast или toast-{toast type name}:

@keyframes fallUp {
  0% {
    transform: translateY(100px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast-success {
  ...
  animation: fallUp 0.5s;
}

When the toast is about to disapear, he gets class toast-remove. You can add custom animation for it too:

Когда уведомление перейдет в стадию удаления, ему будет присвоен класс toast-remove. В него также можно добавить собственные стили.

.toast-remove {
  transform: scale(0);
}

You can style even toast container. By default toast container have this styles:

Вы даже можете стилизовать контейнер для уведомлений. По умолчанию контейнер имеет следующие стили:

position: fixed;
display: inline-block;
top: 40px;
right: 40px;

If you want to customize it, then add your custom styles to toast-container class.

Important: toast-container class must contain position parametr, then your custom styles would work Если вы хотите кастомизировать контейнер, добавьте собственные стили в класс toast-container. Важно: toast-container класс должен содержать параметр position. Только в этом случае Ваши стили будут работать.

.toast-container{
    position: fixed;
    bottom: 40px;
    left: 40px;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column-reverse;
}